From: Hajime Tazaki<thehajime@gmail.com>
To: benjamin@sipsolutions.net
Cc: linux-um@lists.infradead.org, jdike@addtoit.com, richard@nod.at,
anton.ivanov@cambridgegreys.com, johannes@sipsolutions.net,
ricarkol@google.com
Subject: Re: [RFC PATCH 00/13] nommu UML
Date: Wed, 30 Oct 2024 18:25:18 +0900 [thread overview]
Message-ID: <m2plnigcxt.wl-thehajime@gmail.com> (raw)
In-Reply-To: <1246523a29aeca3d727a359ebf8ccd931631e1ef.camel@sipsolutions.net>
Hello,
On Mon, 28 Oct 2024 22:32:43 +0900,
Benjamin Berg wrote:
> > > > - a crash on userspace programs crashes a UML kernel, not signaling
> > > > with SIGSEGV to the program.
> > > > - commit c27e618 (during v6.12-rc1 merge) introduces invalid access to
> > > > a vma structure for our case, which updates the internal procedure
> > > > of maple_tree subsystem. We're trying to fix issue but still a
> > > > random process on exit(2) crashes.
> > >
> > > Btw. are you handling FP register save/restore? If it is not there, it
> > > probably would not be too hard to add (XSAVE, etc.), though it might
> > > add a bit of additional overhead. Especially as UML always saves the FP
> > > state rather than optimizing it like the x86 architectures.
> >
> > The patch handles fp register on entry/leave at syscall; [07/13] patch
> > contains this part.
>
> That looks like FS/GS registers which are for thread-local storage. I
> was talking about floating point registers. Maybe you meant another
> patch?
oh, this is my terrible mistake...
no, the patch doesn't handle fp resister at all.
> > I'm not familiar with that but what kind of optimizations does x86
> > architecture do for fp register handling ?
>
> The kernel does not usually need the FP registers. So it optimizes the
> pretty common case of a userspace -> kernel -> userspace switch that
> happens for a syscall by simply not saving/restoring these registers at
> all.
>
> Obviously, it then still needs to do the work when the task is switched
> or in the rare case that the kernel wants to use floating point itself.
thanks for the information.
> > > I am a bit confused overall. I mean, zpoline seems kind of neat, but a
> > > requirement on patching userspace code also seems like a lot.
> > >
> > > To me, it seems much more natural to catch the userspace syscalls using
> > > a SECCOMP filter[1]. While quite a lot slower, that should be much more
> > > portable across architectures. For improved speed one could still do
> > > architecture specific things inside the vDSO or by using zpoline. But
> > > those would then "just" be optimizations and unpatched code would still
> > > work correctly (e.g. JIT).
> >
> > I'm not proposing this patch to replace existing UML implementations;
> > for instance, the patchset cannot run CONFIG_MMU code in the whole
> > kernel tree so, existing ptrace-based implementation still has real
> > usecase. and ptrace based syscall hook is not indeed fast and the
> > improvements with seccomp filter instead clearly has benefits. I
> > think it's independent to this patchset.
>
> Of course. nommu mode is a completely independent feature.
>
> I am still wondering a bit about the users for such a mode. It is not
> interesting for us as we use it for testing. Of course, speed is nice
> but it is not the primary objective.
>
> I understand that it can be an approach for a small "container", but
> then you would need a very strict SECCOMP filter for the kernel itself.
I didn't specifically describe the usecase for this at the v1 patch;
but at least here is the list in my mind.
1) container-like usecase can be one of them (the original work proposed
toward this),
2) testing nommu code in kernel might be another use,
3) faster I/O workload which involves bunch of syscalls over UML can
be also interesting.
I think this list covers pretty much to have !MMU mode in current
MMU-full UML.
speed might not be indeed the primary objective but if you'll see the
dozen of test cases which issues bunch of syscalls (which I think
possible case), this might be helpful.
(snip)
> > > For me, a big argument in favour of such an approach is its simplicity.
> > > I am mostly basing that on the fact that this patchset should properly
> > > handle other signals like SIGFPE and SIGSEGV. And, once it does that,
> > > you will already have all the infrastructure to do the correct register
> > > save/restore using the host mcontex, which is what is needed in the
> > > SIGSYS handler when using SECCOMP. The filter itself should be simple
> > > as it just needs to catch all syscalls within valid userspace
> > > executable memory[2] ranges.
> >
> > I agree with your observation that the approach is simple.
> > I don't have a good idea on how to handle SIGSEGV, but will try to see
> > with your inputs.
>
> You can probably use "[RFC PATCH v2 5/9] um: Add helper functions to
> get/set state for SECCOMP" for getting the registers and also writing
> them back if you want to restore using rt_sigreturn.
thanks,
I'm still testing with various attempts to deliver SEGV to userspace,
but yet no luck so far... I will get you back once I come up with a
nice form.
(snip)
> > > [2] I am assuming that userspace executable code is already confined to
> > > a certain address space within the UML process. Obviously, the kernel
> > > itself and loaded modules need to be free to do host syscalls and
> > > should not be affected by the SECCOMP filter.
> >
> > I think our !MMU UML doesn't break this assumption. But did you see
> > something to our patchset ?
>
> I also assume that is fine. One just needs to understand this when
> writing a SECCOMP filter for syscall emulation in nommu mode.
okay, thanks for the clarification.
-- Hajime
next prev parent reply other threads:[~2024-10-30 9:28 UTC|newest]
Thread overview: 131+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-24 12:09 [RFC PATCH 00/13] nommu UML Hajime Tazaki
2024-10-24 12:09 ` [RFC PATCH 01/13] fs: binfmt_elf_efpic: add architecture hook elf_arch_finalize_exec Hajime Tazaki
2024-10-24 12:09 ` [RFC PATCH 02/13] x86/um: nommu: elf loader for fdpic Hajime Tazaki
2024-10-25 8:56 ` Johannes Berg
2024-10-25 12:54 ` Hajime Tazaki
2024-10-24 12:09 ` [RFC PATCH 03/13] um: nommu: memory handling Hajime Tazaki
2024-10-25 9:11 ` Johannes Berg
2024-10-25 12:55 ` Hajime Tazaki
2024-10-25 15:15 ` Johannes Berg
2024-10-26 7:24 ` Hajime Tazaki
2024-10-24 12:09 ` [RFC PATCH 04/13] x86/um: nommu: syscall handling Hajime Tazaki
2024-10-25 9:14 ` Johannes Berg
2024-10-25 12:55 ` Hajime Tazaki
2024-10-24 12:09 ` [RFC PATCH 05/13] x86/um: nommu: syscall translation by zpoline Hajime Tazaki
2024-10-25 9:19 ` Johannes Berg
2024-10-25 12:58 ` Hajime Tazaki
2024-10-25 15:20 ` Johannes Berg
2024-10-26 7:36 ` Hajime Tazaki
2024-10-27 9:45 ` Johannes Berg
2024-10-28 7:47 ` Hajime Tazaki
2024-10-24 12:09 ` [RFC PATCH 06/13] x86/um: nommu: process/thread handling Hajime Tazaki
2024-10-25 9:22 ` Johannes Berg
2024-10-25 12:58 ` Hajime Tazaki
2024-10-24 12:09 ` [RFC PATCH 07/13] um: nommu: configure fs register on host syscall invocation Hajime Tazaki
2024-10-25 9:28 ` Johannes Berg
2024-10-25 13:27 ` Hajime Tazaki
2024-10-25 15:22 ` Johannes Berg
2024-10-26 7:34 ` Hajime Tazaki
2024-10-24 12:09 ` [RFC PATCH 08/13] x86/um/vdso: nommu: vdso memory update Hajime Tazaki
2024-10-25 9:29 ` Johannes Berg
2024-10-25 13:28 ` Hajime Tazaki
2024-10-24 12:09 ` [RFC PATCH 09/13] x86/um: nommu: signal handling Hajime Tazaki
2024-10-25 9:30 ` Johannes Berg
2024-10-25 13:04 ` Hajime Tazaki
2024-10-24 12:09 ` [RFC PATCH 10/13] x86/um: nommu: stack save/restore on vfork Hajime Tazaki
2024-10-24 12:09 ` [RFC PATCH 11/13] um: change machine name for uname output Hajime Tazaki
2024-10-24 12:09 ` [RFC PATCH 12/13] um: nommu: add documentation of nommu UML Hajime Tazaki
2024-10-24 12:09 ` [RFC PATCH 13/13] um: nommu: plug nommu code into build system Hajime Tazaki
2024-10-25 9:33 ` Johannes Berg
2024-10-25 13:05 ` Hajime Tazaki
2024-10-25 15:27 ` Johannes Berg
2024-10-26 7:36 ` Hajime Tazaki
2024-10-26 10:19 ` [RFC PATCH 00/13] nommu UML Benjamin Berg
2024-10-27 9:10 ` Hajime Tazaki
2024-10-28 13:32 ` Benjamin Berg
2024-10-30 9:25 ` Hajime Tazaki [this message]
2024-11-09 0:52 ` Hajime Tazaki
2024-11-11 6:27 ` [RFC PATCH v2 " Hajime Tazaki
2024-11-11 6:27 ` [RFC PATCH v2 01/13] fs: binfmt_elf_efpic: add architecture hook elf_arch_finalize_exec Hajime Tazaki
2024-11-11 22:32 ` kernel test robot
2024-11-11 6:27 ` [RFC PATCH v2 02/13] x86/um: nommu: elf loader for fdpic Hajime Tazaki
2024-11-12 12:48 ` Geert Uytterhoeven
2024-11-12 22:07 ` Hajime Tazaki
2024-11-13 8:19 ` Geert Uytterhoeven
2024-11-13 8:36 ` Johannes Berg
2024-11-13 8:36 ` Johannes Berg
2024-11-13 10:27 ` Geert Uytterhoeven
2024-11-13 13:17 ` Hajime Tazaki
2024-11-13 13:55 ` Geert Uytterhoeven
2024-11-13 23:32 ` Hajime Tazaki
2024-11-14 1:40 ` Greg Ungerer
2024-11-14 10:41 ` Hajime Tazaki
2024-11-11 6:27 ` [RFC PATCH v2 03/13] um: nommu: memory handling Hajime Tazaki
2024-11-11 6:27 ` [RFC PATCH v2 04/13] x86/um: nommu: syscall handling Hajime Tazaki
2024-11-11 6:27 ` [RFC PATCH v2 05/13] x86/um: nommu: syscall translation by zpoline Hajime Tazaki
2024-11-11 6:27 ` [RFC PATCH v2 06/13] um: nommu: prevent host syscalls from userspace by seccomp filter Hajime Tazaki
2024-11-11 6:27 ` [RFC PATCH v2 07/13] x86/um: nommu: process/thread handling Hajime Tazaki
2024-11-11 6:27 ` [RFC PATCH v2 08/13] um: nommu: configure fs register on host syscall invocation Hajime Tazaki
2024-11-12 9:36 ` kernel test robot
2024-11-27 10:00 ` Benjamin Berg
2024-11-27 10:26 ` Hajime Tazaki
2024-11-11 6:27 ` [RFC PATCH v2 09/13] x86/um/vdso: nommu: vdso memory update Hajime Tazaki
2024-11-27 10:36 ` Benjamin Berg
2024-11-27 23:23 ` Hajime Tazaki
2024-11-11 6:27 ` [RFC PATCH v2 10/13] x86/um: nommu: signal handling Hajime Tazaki
2024-11-12 11:00 ` kernel test robot
2024-11-28 10:37 ` Benjamin Berg
2024-12-01 1:38 ` Hajime Tazaki
2024-11-11 6:27 ` [RFC PATCH v2 11/13] um: change machine name for uname output Hajime Tazaki
2024-11-11 6:27 ` [RFC PATCH v2 12/13] um: nommu: add documentation of nommu UML Hajime Tazaki
2024-11-11 6:27 ` [RFC PATCH v2 13/13] um: nommu: plug nommu code into build system Hajime Tazaki
2024-11-15 10:12 ` [RFC PATCH v2 00/13] nommu UML Johannes Berg
2024-11-15 10:26 ` Anton Ivanov
2024-11-15 14:54 ` Hajime Tazaki
2024-11-15 14:48 ` Hajime Tazaki
2024-11-22 9:33 ` Lorenzo Stoakes
2024-11-22 9:53 ` Johannes Berg
2024-11-22 10:29 ` Lorenzo Stoakes
2024-11-22 12:18 ` Christoph Hellwig
2024-11-22 12:25 ` Lorenzo Stoakes
2024-11-22 12:38 ` Christoph Hellwig
2024-11-22 12:49 ` Damien Le Moal
2024-11-22 12:52 ` Lorenzo Stoakes
2024-11-23 7:27 ` David Gow
2024-11-24 1:25 ` Hajime Tazaki
2024-12-03 4:22 ` [PATCH v3 " Hajime Tazaki
2024-12-03 4:23 ` [PATCH v3 01/13] fs: binfmt_elf_efpic: add architecture hook elf_arch_finalize_exec Hajime Tazaki
2024-12-03 4:23 ` [PATCH v3 02/13] x86/um: nommu: elf loader for fdpic Hajime Tazaki
2024-12-04 16:20 ` Johannes Berg
2024-12-05 13:41 ` Hajime Tazaki
2024-12-03 4:23 ` [PATCH v3 03/13] um: nommu: memory handling Hajime Tazaki
2024-12-04 16:34 ` Johannes Berg
2024-12-05 13:46 ` Hajime Tazaki
2024-12-03 4:23 ` [PATCH v3 04/13] x86/um: nommu: syscall handling Hajime Tazaki
2024-12-04 16:37 ` Johannes Berg
2024-12-05 13:47 ` Hajime Tazaki
2024-12-03 4:23 ` [PATCH v3 05/13] x86/um: nommu: syscall translation by zpoline Hajime Tazaki
2024-12-04 16:37 ` Johannes Berg
2024-12-05 13:48 ` Hajime Tazaki
2024-12-03 4:23 ` [PATCH v3 06/13] um: nommu: syscalls handler from userspace by seccomp filter Hajime Tazaki
2024-12-04 16:42 ` Johannes Berg
2024-12-05 13:51 ` Hajime Tazaki
2024-12-05 13:54 ` Johannes Berg
2024-12-06 2:51 ` Hajime Tazaki
2024-12-04 17:54 ` kernel test robot
2024-12-03 4:23 ` [PATCH v3 07/13] x86/um: nommu: process/thread handling Hajime Tazaki
2024-12-04 16:50 ` Johannes Berg
2024-12-05 13:56 ` Hajime Tazaki
2024-12-05 13:58 ` Johannes Berg
2024-12-06 2:49 ` Hajime Tazaki
2024-12-03 4:23 ` [PATCH v3 08/13] um: nommu: configure fs register on host syscall invocation Hajime Tazaki
2024-12-04 16:52 ` Johannes Berg
2024-12-04 19:31 ` Geert Uytterhoeven
2024-12-05 13:58 ` Hajime Tazaki
2024-12-03 4:23 ` [PATCH v3 09/13] x86/um/vdso: nommu: vdso memory update Hajime Tazaki
2024-12-03 4:23 ` [PATCH v3 10/13] x86/um: nommu: signal handling Hajime Tazaki
2024-12-03 4:23 ` [PATCH v3 11/13] um: change machine name for uname output Hajime Tazaki
2024-12-03 4:23 ` [PATCH v3 12/13] um: nommu: add documentation of nommu UML Hajime Tazaki
2024-12-03 4:23 ` [PATCH v3 13/13] um: nommu: plug nommu code into build system Hajime Tazaki
2024-12-04 16:20 ` [PATCH v3 00/13] nommu UML Johannes Berg
2024-12-05 13:41 ` 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=m2plnigcxt.wl-thehajime@gmail.com \
--to=thehajime@gmail.com \
--cc=anton.ivanov@cambridgegreys.com \
--cc=benjamin@sipsolutions.net \
--cc=jdike@addtoit.com \
--cc=johannes@sipsolutions.net \
--cc=linux-um@lists.infradead.org \
--cc=ricarkol@google.com \
--cc=richard@nod.at \
/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.