From: Hajime Tazaki <thehajime@gmail.com>
To: benjamin@sipsolutions.net
Cc: linux-um@lists.infradead.org, ricarkol@google.com,
Liam.Howlett@oracle.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v9 04/13] x86/um: nommu: syscall handling
Date: Sat, 21 Jun 2025 21:40:24 +0900 [thread overview]
Message-ID: <m24iw95kuf.wl-thehajime@gmail.com> (raw)
In-Reply-To: <d1d08a207844b98d0beba96f48beaf73e30c3bd2.camel@sipsolutions.net>
On Thu, 19 Jun 2025 19:31:53 +0900,
Benjamin Berg wrote:
> > diff --git a/arch/x86/um/nommu/do_syscall_64.c b/arch/x86/um/nommu/do_syscall_64.c
> > new file mode 100644
> > index 000000000000..5d0fa83e7fdc
> > --- /dev/null
> > +++ b/arch/x86/um/nommu/do_syscall_64.c
> > @@ -0,0 +1,37 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +
> > +#include <linux/kernel.h>
> > +#include <linux/ptrace.h>
> > +#include <kern_util.h>
> > +#include <sysdep/syscalls.h>
> > +#include <os.h>
> > +
> > +__visible void do_syscall_64(struct pt_regs *regs)
> > +{
> > + int syscall;
> > +
> > + syscall = PT_SYSCALL_NR(regs->regs.gp);
> > + UPT_SYSCALL_NR(®s->regs) = syscall;
> > +
> > + pr_debug("syscall(%d) (current=%lx) (fn=%lx)\n",
> > + syscall, (unsigned long)current,
> > + (unsigned long)sys_call_table[syscall]);
>
> You probably want to drop the pr_debug from the syscall path.
okay, I'll update those parts.
> > + if (likely(syscall < NR_syscalls)) {
> > + PT_REGS_SET_SYSCALL_RETURN(regs,
> > + EXECUTE_SYSCALL(syscall, regs));
> > + }
> > +
> > + pr_debug("syscall(%d) --> %lx\n", syscall,
> > + regs->regs.gp[HOST_AX]);
> > +
> > + PT_REGS_SYSCALL_RET(regs) = regs->regs.gp[HOST_AX];
> > +
> > + /* execve succeeded */
> > + if (syscall == __NR_execve && regs->regs.gp[HOST_AX] == 0)
> > + userspace(¤t->thread.regs.regs);
>
> That said, this is what I am stumbling over. Why do you need to jump
> into userspace() here? It seems odd to me to need a special case in the
> syscall path itself.
> Aren't there other possibilities to hook/override the kernel task
> state?
thanks, I found that this is a leftover of our early implementation
which doesn't have a proper schedule upon an exit from syscall. we
can remove this part and I'll fix them after more investigation.
> > + /* force do_signal() --> is_syscall() */
> > + set_thread_flag(TIF_SIGPENDING);
> > + interrupt_end();
>
> Same here. The MMU UML code seems to also do this, but restricted to
> ptrace'd processes? Maybe I am just missing something obvious …
nommu doesn't have separate process/context to indicate a schedule to
the context here (syscall). without that part we do not have a chance
to schedule tasks and signals to userspace.
But the force on SIGPENDING flag is not actually needed so, I'll
remove that part.
thanks for pointing out.
-- Hajime
next prev parent reply other threads:[~2025-06-21 12:40 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-19 1:04 [PATCH v9 00/13] nommu UML Hajime Tazaki
2025-06-19 1:04 ` [PATCH v9 01/13] x86/um: nommu: elf loader for fdpic Hajime Tazaki
2025-06-19 1:04 ` [PATCH v9 02/13] um: decouple MMU specific code from the common part Hajime Tazaki
2025-06-19 1:04 ` [PATCH v9 03/13] um: nommu: memory handling Hajime Tazaki
2025-06-19 1:04 ` [PATCH v9 04/13] x86/um: nommu: syscall handling Hajime Tazaki
2025-06-19 10:31 ` Benjamin Berg
2025-06-21 12:40 ` Hajime Tazaki [this message]
2025-06-19 1:04 ` [PATCH v9 05/13] um: nommu: seccomp syscalls hook Hajime Tazaki
2025-06-19 1:04 ` [PATCH v9 06/13] x86/um: nommu: process/thread handling Hajime Tazaki
2025-06-19 10:36 ` Benjamin Berg
2025-06-19 12:22 ` Hajime Tazaki
2025-06-19 1:04 ` [PATCH v9 07/13] um: nommu: configure fs register on host syscall invocation Hajime Tazaki
2025-06-19 10:40 ` Benjamin Berg
2025-06-19 12:22 ` Hajime Tazaki
2025-06-19 12:38 ` Benjamin Berg
2025-06-19 12:57 ` Hajime Tazaki
2025-06-19 1:04 ` [PATCH v9 08/13] x86/um/vdso: nommu: vdso memory update Hajime Tazaki
2025-06-19 1:04 ` [PATCH v9 09/13] x86/um: nommu: signal handling Hajime Tazaki
2025-06-19 1:04 ` [PATCH v9 10/13] um: nommu: a work around for MMU dependency to PCI driver Hajime Tazaki
2025-06-19 1:04 ` [PATCH v9 11/13] um: change machine name for uname output Hajime Tazaki
2025-06-19 1:04 ` [PATCH v9 12/13] um: nommu: add documentation of nommu UML Hajime Tazaki
2025-06-19 1:04 ` [PATCH v9 13/13] um: nommu: plug nommu code into build system Hajime Tazaki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m24iw95kuf.wl-thehajime@gmail.com \
--to=thehajime@gmail.com \
--cc=Liam.Howlett@oracle.com \
--cc=benjamin@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-um@lists.infradead.org \
--cc=ricarkol@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.