[RFC PATCH 00/13] nommu UML

2024-10-25 Thread Hajime Tazaki
da: KVM: selftests: Fix build on on non-x86 architectures (2024-10-21 15:49:33 -0700) are available in the Git repository at: https://github.com/thehajime/linux 82a7ee8b31c51edb47e144922581824a3b5e371d https://github.com/thehajime/linux/tree/um-nommu-v6.12-rc4-rfc Hajime Tazaki (13): fs:

[RFC PATCH 05/13] x86/um: nommu: syscall translation by zpoline

2024-10-25 Thread Hajime Tazaki
(2) used by MMU-full UML. Signed-off-by: Hajime Tazaki --- arch/x86/um/asm/elf.h | 3 + arch/x86/um/zpoline.c | 228 ++ 2 files changed, 231 insertions(+) create mode 100644 arch/x86/um/zpoline.c diff --git a/arch/x86/um/asm/elf.h b/arch/x86/um/asm/elf.h

[RFC PATCH 04/13] x86/um: nommu: syscall handling

2024-10-25 Thread Hajime Tazaki
cture. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/x86/um/do_syscall_64.c | 42 arch/x86/um/entry_64.S | 88 + arch/x86/um/shared/sysdep/syscalls_64.h | 4 ++ 3 files changed, 134 insertions(+) create mode 1

[RFC PATCH 12/13] um: nommu: add documentation of nommu UML

2024-10-24 Thread Hajime Tazaki
This commit adds an initial documentation for !MMU mode of UML. Signed-off-by: Hajime Tazaki --- Documentation/virt/uml/nommu-uml.rst | 219 +++ 1 file changed, 219 insertions(+) create mode 100644 Documentation/virt/uml/nommu-uml.rst diff --git a/Documentation/virt

[RFC PATCH 11/13] um: change machine name for uname output

2024-10-24 Thread Hajime Tazaki
This commit tries to display MMU/!MMU mode from the output of uname(2) so that users can distinguish which mode of UML is running right now. Signed-off-by: Hajime Tazaki --- arch/um/Makefile| 6 ++ arch/um/os-Linux/util.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion

[RFC PATCH 13/13] um: nommu: plug nommu code into build system

2024-10-24 Thread Hajime Tazaki
Add nommu kernel for um build. defconfig is also provided. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/Kconfig | 13 - arch/um/configs/x86_64_nommu_defconfig | 64 + arch/um/include/shared/common-offsets.h | 3

[RFC PATCH 08/13] x86/um/vdso: nommu: vdso memory update

2024-10-24 Thread Hajime Tazaki
On !MMU mode, the address of vdso is accessible from userspace. This commit implements the entry point by pointing a block of page address. This commit also add memory permission configuration of vdso page to be executable. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch

[RFC PATCH 10/13] x86/um: nommu: stack save/restore on vfork

2024-10-24 Thread Hajime Tazaki
contents should be restored before vfork/parent returns. this is done in do_syscall_64(). Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/kernel/process.c| 22 +- arch/x86/um/do_syscall_64.c | 36 2 files changed, 5

[RFC PATCH 02/13] x86/um: nommu: elf loader for fdpic

2024-10-24 Thread Hajime Tazaki
Cc: Alexander Viro Cc: Christian Brauner Cc: Jan Kara Cc: linux...@kvack.org Cc: linux-fsde...@vger.kernel.org Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/include/asm/mmu.h| 5 + arch/um/include/asm/ptrace-generic.h | 17 + arch/x86

[RFC PATCH 07/13] um: nommu: configure fs register on host syscall invocation

2024-10-24 Thread Hajime Tazaki
-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/include/shared/os.h | 3 ++ arch/um/os-Linux/main.c | 5 arch/um/os-Linux/process.c | 11 arch/um/os-Linux/start_up.c | 47 +++ arch/um/os-Linux/time.c | 3 +- arch/x86/um

[RFC PATCH 03/13] um: nommu: memory handling

2024-10-24 Thread Hajime Tazaki
the address space in !CONFIG_MMU mode. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/include/asm/futex.h | 4 arch/um/include/asm/mmu.h | 3 +++ arch/um/include/asm/mmu_context.h | 14 -- arch/um/include/asm/tlbflush.h| 23

[RFC PATCH 06/13] x86/um: nommu: process/thread handling

2024-10-24 Thread Hajime Tazaki
me of registers (fs segment register for TLS, etc) on every contex switch, etc. Signals aren't delivered in non-ptrace syscall entry/leave so, we also need to handle pending signal by ourselves. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/kernel/exec.c

[RFC PATCH 09/13] x86/um: nommu: signal handling

2024-10-24 Thread Hajime Tazaki
This commit updates the behavior of signal handling under !MMU environment. 1) the stack preparation for the signal handlers and 2) retoration of stack after rt_sigreturn(2) syscall. Those are needed as the stack usage on vfork(2) syscall is different. Signed-off-by: Hajime Tazaki --- arch/x86

[RFC PATCH 01/13] fs: binfmt_elf_efpic: add architecture hook elf_arch_finalize_exec

2024-10-24 Thread Hajime Tazaki
Kara Cc: Eric Biederman Cc: Kees Cook Cc: linux-fsde...@vger.kernel.org Cc: linux...@kvack.org Signed-off-by: Hajime Tazaki --- fs/binfmt_elf_fdpic.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index 4fe5bb9f1b1f..ab16fdf475b0

Re: [RFC PATCH 00/13] nommu UML

2024-10-30 Thread Hajime Tazaki
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 cas

Re: [PATCH] um: move thread info into task

2024-11-04 Thread Hajime Tazaki
Hello, this is a great clean up I think. I've also applied my tentative nommu patch and works fine with minor modifications. On Mon, 04 Nov 2024 00:05:34 +0900, Benjamin Berg wrote: > diff --git a/arch/um/include/asm/current.h b/arch/um/include/asm/current.h > new file mode 100644 > index 000

Re: [PATCH] um: move thread info into task

2024-11-04 Thread Hajime Tazaki
On Mon, 04 Nov 2024 17:17:05 +0900, Berg, Benjamin wrote: > > with this include, I guess is now in a > > circular dependency. > > > > after only applying this patch onto uml/next, and make mrproper > > ARCH=um, I cannot build UML kernel with defconfig. > > Oh. Probably the easiest is to just

Re: [RFC PATCH 05/13] x86/um: nommu: syscall translation by zpoline

2024-10-28 Thread Hajime Tazaki
Hello, On Sun, 27 Oct 2024 18:45:39 +0900, Johannes Berg wrote: > > On Sat, 2024-10-26 at 16:36 +0900, Hajime Tazaki wrote: > > > > Originally our patchset had a whitelist-based seccomp filter (w/ > > SCMP_ACT_ALLOW), but dropped from this RFC as I found that 1)

Re: [RFC PATCH 05/13] x86/um: nommu: syscall translation by zpoline

2024-10-25 Thread Hajime Tazaki
On Fri, 25 Oct 2024 18:19:25 +0900, Johannes Berg wrote: > > On Thu, 2024-10-24 at 21:09 +0900, Hajime Tazaki wrote: > > This commit adds a mechanism to hook syscalls for unmodified userspace > > programs used under UML in !MMU mode. The mechanism, called zpoline, >

Re: [RFC PATCH 04/13] x86/um: nommu: syscall handling

2024-10-25 Thread Hajime Tazaki
On Fri, 25 Oct 2024 18:14:19 +0900, Johannes Berg wrote: > > On Thu, 2024-10-24 at 21:09 +0900, Hajime Tazaki wrote: > > > > +++ b/arch/x86/um/do_syscall_64.c > > @@ -0,0 +1,42 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > + > > +#include &

Re: [RFC PATCH 08/13] x86/um/vdso: nommu: vdso memory update

2024-10-25 Thread Hajime Tazaki
On Fri, 25 Oct 2024 18:29:07 +0900, Johannes Berg wrote: > > > > oom: > > - printk(KERN_ERR "Cannot allocate vdso\n"); > > + pr_err("Cannot allocate vdso"); > > kind of unrelated change thanks, will fix it. -- Hajime

Re: [RFC PATCH 07/13] um: nommu: configure fs register on host syscall invocation

2024-10-25 Thread Hajime Tazaki
On Fri, 25 Oct 2024 18:28:01 +0900, Johannes Berg wrote: > > On Thu, 2024-10-24 at 21:09 +0900, Hajime Tazaki wrote: > > > > +static void sigill(int sig, siginfo_t *si, void *ctx_void) > > +{ > > + longjmp(jmpbuf, 1); > > +} > > Should this c

Re: [RFC PATCH 02/13] x86/um: nommu: elf loader for fdpic

2024-10-25 Thread Hajime Tazaki
Hello Johannes, On Fri, 25 Oct 2024 17:56:51 +0900, Johannes Berg wrote: > > On Thu, 2024-10-24 at 21:09 +0900, Hajime Tazaki wrote: > > > > +#ifndef CONFIG_MMU > > +#include > > Not sure that makes so much sense in the middle of the file, no harm > alway

Re: [RFC PATCH 13/13] um: nommu: plug nommu code into build system

2024-10-25 Thread Hajime Tazaki
On Fri, 25 Oct 2024 18:33:06 +0900, Johannes Berg wrote: > > On Thu, 2024-10-24 at 21:09 +0900, Hajime Tazaki wrote: > > > > config MMU > > - bool > > + bool "MMU-based Paged Memory Management Support" > > default y > > "if !64

Re: [RFC PATCH 00/13] nommu UML

2024-10-27 Thread Hajime Tazaki
Hello Benjamin, thank you for your time looking at this. On Sat, 26 Oct 2024 19:19:08 +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 t

[RFC PATCH v2 13/13] um: nommu: plug nommu code into build system

2024-11-10 Thread Hajime Tazaki
Add nommu kernel for um build. defconfig is also provided. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/Kconfig| 14 +- arch/um/configs/x86_64_nommu_defconfig | 64 ++ arch/x86/um/Makefile | 18

[RFC PATCH v2 10/13] x86/um: nommu: signal handling

2024-11-10 Thread Hajime Tazaki
SIGSEGV as a signal delivery runs in the same stack frame while we have to avoid endless SIGSEGV. Signed-off-by: Hajime Tazaki --- arch/um/include/shared/kern_util.h | 3 +++ arch/um/kernel/trap.c | 10 arch/um/os-Linux/signal.c | 18 ++- arch/x86/um

[RFC PATCH v2 12/13] um: nommu: add documentation of nommu UML

2024-11-10 Thread Hajime Tazaki
This commit adds an initial documentation for !MMU mode of UML. Signed-off-by: Hajime Tazaki --- Documentation/virt/uml/nommu-uml.rst | 221 +++ 1 file changed, 221 insertions(+) create mode 100644 Documentation/virt/uml/nommu-uml.rst diff --git a/Documentation/virt

[RFC PATCH v2 02/13] x86/um: nommu: elf loader for fdpic

2024-11-10 Thread Hajime Tazaki
Cc: Alexander Viro Cc: Christian Brauner Cc: Jan Kara Cc: linux...@kvack.org Cc: linux-fsde...@vger.kernel.org Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/include/asm/Kbuild | 1 + arch/um/include/asm/mmu.h| 5 + arch/um/include/asm

[RFC PATCH v2 00/13] nommu UML

2024-11-10 Thread Hajime Tazaki
/linux-um/cover.1729770373.git.thehaj...@gmail.com/ Hajime Tazaki (13): fs: binfmt_elf_efpic: add architecture hook elf_arch_finalize_exec x86/um: nommu: elf loader for fdpic um: nommu: memory handling x86/um: nommu: syscall handling x86/um: nommu: syscall translation by zpoline um

[RFC PATCH v2 01/13] fs: binfmt_elf_efpic: add architecture hook elf_arch_finalize_exec

2024-11-10 Thread Hajime Tazaki
Kara Cc: Eric Biederman Cc: Kees Cook Cc: linux-fsde...@vger.kernel.org Cc: linux...@kvack.org Signed-off-by: Hajime Tazaki --- fs/binfmt_elf_fdpic.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index 4fe5bb9f1b1f..ab16fdf475b0

[RFC PATCH v2 08/13] um: nommu: configure fs register on host syscall invocation

2024-11-10 Thread Hajime Tazaki
-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/include/shared/os.h | 5 arch/um/os-Linux/Makefile | 4 +-- arch/um/os-Linux/cpu.c | 50 arch/um/os-Linux/internal.h | 5 arch/um/os-Linux/main.c | 5 arch/um/os-Linux

[RFC PATCH v2 07/13] x86/um: nommu: process/thread handling

2024-11-10 Thread Hajime Tazaki
me of registers (fs segment register for TLS, etc) on every context switch, etc. Signals aren't delivered in non-ptrace syscall entry/leave so, we also need to handle pending signal by ourselves. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/kernel/process.c

[RFC PATCH v2 03/13] um: nommu: memory handling

2024-11-10 Thread Hajime Tazaki
the address space in !CONFIG_MMU mode. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/include/asm/futex.h | 4 arch/um/include/asm/mmu.h | 3 +++ arch/um/include/asm/mmu_context.h | 13 +++-- arch/um/include/asm/tlbflush.h| 22

[RFC PATCH v2 04/13] x86/um: nommu: syscall handling

2024-11-10 Thread Hajime Tazaki
cture. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/x86/um/do_syscall_64.c | 37 +++ arch/x86/um/entry_64.S | 87 + arch/x86/um/shared/sysdep/syscalls_64.h | 6 ++ 3 files changed, 130 insertions(+) create mode 1

[RFC PATCH v2 06/13] um: nommu: prevent host syscalls from userspace by seccomp filter

2024-11-10 Thread Hajime Tazaki
code. Signed-off-by: Hajime Tazaki --- arch/um/include/shared/os.h | 3 ++ arch/um/kernel/um_arch.c| 4 ++ arch/um/os-Linux/process.c | 76 + 3 files changed, 83 insertions(+) diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h index

[RFC PATCH v2 09/13] x86/um/vdso: nommu: vdso memory update

2024-11-10 Thread Hajime Tazaki
On !MMU mode, the address of vdso is accessible from userspace. This commit implements the entry point by pointing a block of page address. This commit also add memory permission configuration of vdso page to be executable. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch

[RFC PATCH v2 05/13] x86/um: nommu: syscall translation by zpoline

2024-11-10 Thread Hajime Tazaki
) used by MMU-full UML. Signed-off-by: Hajime Tazaki --- arch/x86/um/asm/elf.h | 3 + arch/x86/um/zpoline.c | 223 ++ 2 files changed, 226 insertions(+) create mode 100644 arch/x86/um/zpoline.c diff --git a/arch/x86/um/asm/elf.h b/arch/x86/um/asm/elf.h

[RFC PATCH v2 11/13] um: change machine name for uname output

2024-11-10 Thread Hajime Tazaki
This commit tries to display MMU/!MMU mode from the output of uname(2) so that users can distinguish which mode of UML is running right now. Signed-off-by: Hajime Tazaki --- arch/um/Makefile| 6 ++ arch/um/os-Linux/util.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion

Re: [RFC PATCH 03/13] um: nommu: memory handling

2024-10-25 Thread Hajime Tazaki
On Fri, 25 Oct 2024 18:11:01 +0900, Johannes Berg wrote: > > (I should say, I'm still reading through this, and haven't formed an > overall opinion. Just nitpicking on the details as I see them for now) thanks anyway. looking forward to any opinions. > > +#endif > > + > > > > #include >

Re: [RFC PATCH 06/13] x86/um: nommu: process/thread handling

2024-10-25 Thread Hajime Tazaki
On Fri, 25 Oct 2024 18:22:29 +0900, Johannes Berg wrote: > > On Thu, 2024-10-24 at 21:09 +0900, Hajime Tazaki wrote: > > Since ptrace facility isn't used under !MMU of UML, there is different > > code path to invoke proceeses/threads; on an entry to the syscall > >

Re: [RFC PATCH 09/13] x86/um: nommu: signal handling

2024-10-25 Thread Hajime Tazaki
On Fri, 25 Oct 2024 18:30:41 +0900, Johannes Berg wrote: > > On Thu, 2024-10-24 at 21:09 +0900, Hajime Tazaki wrote: > > This commit updates the behavior of signal handling under !MMU > > environment. 1) the stack preparation for the signal handlers and > > 2) r

Re: [RFC PATCH 03/13] um: nommu: memory handling

2024-10-26 Thread Hajime Tazaki
On Sat, 26 Oct 2024 00:15:06 +0900, Johannes Berg wrote: > > On Fri, 2024-10-25 at 21:55 +0900, Hajime Tazaki wrote: > > > > > > Should that really do _nothing_? Perhaps it's not called at all in no- > > > MMU, but then you don't need it, but othe

Re: [RFC PATCH 13/13] um: nommu: plug nommu code into build system

2024-10-26 Thread Hajime Tazaki
On Sat, 26 Oct 2024 00:27:08 +0900, Johannes Berg wrote: > > On Fri, 2024-10-25 at 22:05 +0900, Hajime Tazaki wrote: > > On Fri, 25 Oct 2024 18:33:06 +0900, > > Johannes Berg wrote: > > > > > > On Thu, 2024-10-24 at 21:09 +0900, Hajime Tazaki

Re: [RFC PATCH 05/13] x86/um: nommu: syscall translation by zpoline

2024-10-26 Thread Hajime Tazaki
On Sat, 26 Oct 2024 00:20:49 +0900, Johannes Berg wrote: > > On Fri, 2024-10-25 at 21:58 +0900, Hajime Tazaki wrote: > > > > > > + if (down_write_killable(&mm->mmap_lock)) { > > > > + err = -EINTR; > > > > +

Re: [RFC PATCH 07/13] um: nommu: configure fs register on host syscall invocation

2024-10-26 Thread Hajime Tazaki
On Sat, 26 Oct 2024 00:22:48 +0900, Johannes Berg wrote: > > On Fri, 2024-10-25 at 22:27 +0900, Hajime Tazaki wrote: > > > > On Fri, 25 Oct 2024 18:28:01 +0900, > > Johannes Berg wrote: > > > > > > On Thu, 2024-10-24 at 21:09 +0900, Hajime Tazaki w

Re: [RFC PATCH v2 02/13] x86/um: nommu: elf loader for fdpic

2024-11-13 Thread Hajime Tazaki
Hello, thanks for the inputs Geert, Johannes, On Wed, 13 Nov 2024 19:27:08 +0900, Geert Uytterhoeven wrote: > > Hi Johannes, > > On Wed, Nov 13, 2024 at 9:37 AM Johannes Berg > wrote: > > On Wed, 2024-11-13 at 09:36 +0100, Johannes Berg wrote: > > > On Wed, 2024-11-13 at 09:19 +0100, Geert

Re: [RFC PATCH v2 02/13] x86/um: nommu: elf loader for fdpic

2024-11-12 Thread Hajime Tazaki
Hello Geert, thank you for the message. On Tue, 12 Nov 2024 21:48:28 +0900, Geert Uytterhoeven wrote: > > On Mon, Nov 11, 2024 at 7:28 AM Hajime Tazaki wrote: > > As UML supports CONFIG_MMU=n case, it has to use an alternate ELF > > loader, FDPIC ELF loader. In thi

Re: [RFC PATCH v2 09/13] x86/um/vdso: nommu: vdso memory update

2024-11-27 Thread Hajime Tazaki
Thanks Benjamin, On Wed, 27 Nov 2024 19:36:44 +0900, Benjamin Berg wrote: > > @@ -51,9 +65,15 @@ __kernel_old_time_t > > __vdso_time(__kernel_old_time_t *t) > >  { > >   long secs; > >   > > +#ifdef CONFIG_MMU > >   asm volatile("syscall" > >   : "=a" (secs) > >   : "0"

Re: [RFC PATCH 00/13] nommu UML

2024-11-08 Thread Hajime Tazaki
On Wed, 30 Oct 2024 18:25:18 +0900, Hajime Tazaki wrote: > > > > > > - a crash on userspace programs crashes a UML kernel, not signaling > > > > >   with SIGSEGV to the program. after investigation with trying to save/restore FP registers, I found the register

Re: [PATCH] um: move thread info into task

2024-11-08 Thread Hajime Tazaki
> --- a/arch/um/kernel/process.c > +++ b/arch/um/kernel/process.c > @@ -43,7 +43,8 @@ > * cares about its entry, so it's OK if another processor is modifying its > * entry. > */ > -struct cpu_task cpu_tasks[NR_CPUS] = { [0 ... NR_CPUS - 1] = { NULL } }; > +struct task_struct * cpu_tasks[NR_CPUS]; ditto. The other part is looking good to me. Reviewed-by: Hajime Tazaki -- Hajime

Re: [RFC PATCH v2 00/13] nommu UML

2024-11-15 Thread Hajime Tazaki
-11 at 15:27 +0900, Hajime Tazaki wrote: > > This is a series of patches of nommu arch addition to UML. It would > > be nice to ask comments/opinions on this. > > So I've been thinking about this for a while now... thank you for your time ! > To be clear, I'm not

Re: [RFC PATCH v2 00/13] nommu UML

2024-11-15 Thread Hajime Tazaki
Hello Anton, thanks for the comment. On Fri, 15 Nov 2024 19:26:07 +0900, Anton Ivanov wrote: > > What do others think? Would you use it? What for? > > I always thought of it as "another LKL". In that case, it can be compared > to LKL on merit and if it is equivalent or better - go into kernel

Re: [RFC PATCH v2 02/13] x86/um: nommu: elf loader for fdpic

2024-11-13 Thread Hajime Tazaki
On Wed, 13 Nov 2024 22:55:02 +0900, Geert Uytterhoeven wrote: > On Wed, Nov 13, 2024 at 2:17 PM Hajime Tazaki wrote: > > On Wed, 13 Nov 2024 19:27:08 +0900, > > Geert Uytterhoeven wrote: > > > On Wed, Nov 13, 2024 at 9:37 AM Johannes Berg > > > wrote: > >

Re: [RFC PATCH v2 00/13] nommu UML

2024-11-23 Thread Hajime Tazaki
Hello David, On Sat, 23 Nov 2024 16:27:27 +0900, David Gow wrote: > I had a chance to give this a proper try with KUnit, and think it'd be > a great options to have available: it's certainly nice to have a fast, > easy nommu architecture for testing. thanks for the test. > I'd echo the commen

Re: [RFC PATCH v2 08/13] um: nommu: configure fs register on host syscall invocation

2024-11-27 Thread Hajime Tazaki
On Wed, 27 Nov 2024 19:00:11 +0900, Benjamin Berg wrote: > > + > > + os_info("Checking FSGSBASE instructions..."); > > + if (sigsetjmp(jmpbuf, 0) == 0) { > > + asm volatile("rdfsbase %0" : "=r" (fsbase) :: "memory"); > > + host_has_fsgsbase = 1; > > + os_info("O

Re: [RFC PATCH v2 02/13] x86/um: nommu: elf loader for fdpic

2024-11-14 Thread Hajime Tazaki
Hello Greg, On Thu, 14 Nov 2024 10:40:03 +0900, Greg Ungerer wrote: > I was only interested in the ability to run ELF based static/PIE binaries > when I did 782f4c5c44e7d99d ("m68knommu: allow elf_fdpic loader to be > selected"). > I did the same thing for RISC-V in commit 9549fb354ef1 ("riscv

Re: [RFC PATCH v2 10/13] x86/um: nommu: signal handling

2024-11-30 Thread Hajime Tazaki
Hello, On Thu, 28 Nov 2024 19:37:21 +0900, Benjamin Berg wrote: > > +#ifndef CONFIG_MMU > > + memset(&r, 0, sizeof(r)); > > + /* mark is_user=1 when the IP is from userspace code. */ > > + if (mc && (REGS_IP(mc->gregs) > uml_reserved > > +    && REGS_IP(mc->gregs) < high_physmem)) > > + r.is_us

[PATCH v3 06/13] um: nommu: syscalls handler from userspace by seccomp filter

2024-12-02 Thread Hajime Tazaki
2) JIT-generated code. The SIGSYS signal is raised upon the execution from uml_reserved and high_physmem, which locates userspace memory. Signed-off-by: Hajime Tazaki Signed-off-by: Kenichi Yasukata --- arch/um/include/shared/kern_util.h | 2 + arch/um/include/shared/os.h | 6

[PATCH v3 07/13] x86/um: nommu: process/thread handling

2024-12-02 Thread Hajime Tazaki
me of registers (fs segment register for TLS, etc) on every context switch, etc. Signals aren't delivered in non-ptrace syscall entry/leave so, we also need to handle pending signal by ourselves. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/kernel/process.c

[PATCH v3 09/13] x86/um/vdso: nommu: vdso memory update

2024-12-02 Thread Hajime Tazaki
On !MMU mode, the address of vdso is accessible from userspace. This commit implements the entry point by pointing a block of page address. This commit also add memory permission configuration of vdso page to be executable. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch

[PATCH v3 08/13] um: nommu: configure fs register on host syscall invocation

2024-12-02 Thread Hajime Tazaki
-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/include/shared/os.h | 3 ++ arch/um/os-Linux/main.c | 5 arch/um/os-Linux/process.c | 8 ++ arch/um/os-Linux/start_up.c | 20 + arch/x86/um/do_syscall_64.c | 36 +++ arch/x86/um

[PATCH v3 10/13] x86/um: nommu: signal handling

2024-12-02 Thread Hajime Tazaki
SIGSEGV as a signal delivery runs in the same stack frame while we have to avoid endless SIGSEGV. Signed-off-by: Hajime Tazaki --- arch/um/os-Linux/signal.c | 16 +++- arch/x86/um/signal.c | 37 - 2 files changed, 51 insertions(+), 2 deletions

[PATCH v3 04/13] x86/um: nommu: syscall handling

2024-12-02 Thread Hajime Tazaki
cture. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/x86/um/do_syscall_64.c | 37 +++ arch/x86/um/entry_64.S | 87 + arch/x86/um/shared/sysdep/syscalls_64.h | 6 ++ 3 files changed, 130 insertions(+) create mode 1

[PATCH v3 05/13] x86/um: nommu: syscall translation by zpoline

2024-12-02 Thread Hajime Tazaki
) used by MMU-full UML. Signed-off-by: Hajime Tazaki --- arch/x86/um/asm/elf.h | 3 + arch/x86/um/zpoline.c | 223 ++ 2 files changed, 226 insertions(+) create mode 100644 arch/x86/um/zpoline.c diff --git a/arch/x86/um/asm/elf.h b/arch/x86/um/asm/elf.h

[PATCH v3 03/13] um: nommu: memory handling

2024-12-02 Thread Hajime Tazaki
the address space in !CONFIG_MMU mode. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/include/asm/futex.h | 4 arch/um/include/asm/mmu.h | 3 +++ arch/um/include/asm/mmu_context.h | 13 +++-- arch/um/include/asm/tlbflush.h| 22

[PATCH v3 00/13] nommu UML

2024-12-02 Thread Hajime Tazaki
limitation in RFC v1) https://lore.kernel.org/linux-mm/20241108222834.3625217-1-thehaj...@gmail.com/ RFC: - https://lore.kernel.org/linux-um/cover.1729770373.git.thehaj...@gmail.com/ Hajime Tazaki (13): fs: binfmt_elf_efpic: add architecture hook elf_arch_finalize_exec x86/um: nommu: elf loader for

[PATCH v3 01/13] fs: binfmt_elf_efpic: add architecture hook elf_arch_finalize_exec

2024-12-02 Thread Hajime Tazaki
Kara Cc: Eric Biederman Cc: Kees Cook Cc: linux-fsde...@vger.kernel.org Cc: linux...@kvack.org Signed-off-by: Hajime Tazaki --- fs/binfmt_elf_fdpic.c | 10 ++ include/linux/elf-fdpic.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/fs/binfmt_elf_fdpic.c b/fs

[PATCH v3 02/13] x86/um: nommu: elf loader for fdpic

2024-12-02 Thread Hajime Tazaki
Cc: Alexander Viro Cc: Christian Brauner Cc: Jan Kara Cc: linux...@kvack.org Cc: linux-fsde...@vger.kernel.org Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/include/asm/Kbuild | 1 + arch/um/include/asm/mmu.h| 5 + arch/um/include/asm

[PATCH v3 11/13] um: change machine name for uname output

2024-12-02 Thread Hajime Tazaki
This commit tries to display MMU/!MMU mode from the output of uname(2) so that users can distinguish which mode of UML is running right now. Signed-off-by: Hajime Tazaki --- arch/um/Makefile| 6 ++ arch/um/os-Linux/util.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion

[PATCH v3 12/13] um: nommu: add documentation of nommu UML

2024-12-02 Thread Hajime Tazaki
This commit adds an initial documentation for !MMU mode of UML. Signed-off-by: Hajime Tazaki --- Documentation/virt/uml/nommu-uml.rst | 230 +++ MAINTAINERS | 1 + 2 files changed, 231 insertions(+) create mode 100644 Documentation/virt/uml

[PATCH v3 13/13] um: nommu: plug nommu code into build system

2024-12-02 Thread Hajime Tazaki
Add nommu kernel for um build. defconfig is also provided. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/Kconfig| 14 +- arch/um/configs/x86_64_nommu_defconfig | 64 ++ arch/x86/um/Makefile | 18

Re: [PATCH v3 07/13] x86/um: nommu: process/thread handling

2024-12-05 Thread Hajime Tazaki
On Thu, 05 Dec 2024 01:50:07 +0900, Johannes Berg wrote: > > On Tue, 2024-12-03 at 13:23 +0900, Hajime Tazaki wrote: > > > > +++ b/arch/um/kernel/process.c > > @@ -117,13 +117,17 @@ void new_thread_handler(void) > > * callback returns only if the

Re: [PATCH v3 08/13] um: nommu: configure fs register on host syscall invocation

2024-12-05 Thread Hajime Tazaki
On Thu, 05 Dec 2024 04:31:11 +0900, Geert Uytterhoeven wrote: > > On Wed, Dec 4, 2024 at 5:53 PM Johannes Berg > wrote: > > On Tue, 2024-12-03 at 13:23 +0900, Hajime Tazaki wrote: > > > > > > +static int os_x86_arch_prctl(int pid, int option, unsigned lo

[PATCH v3 00/13] nommu UML

2024-12-08 Thread Hajime Tazaki
...@gmail.com/ RFC: - https://lore.kernel.org/linux-um/cover.1729770373.git.thehaj...@gmail.com/ Hajime Tazaki (13): x86/um: clean up elf specific definitions x86/um: nommu: elf loader for fdpic um: decouple MMU specific code from the common part um: nommu: memory handling x86/um: nommu

[PATCH v4 03/13] um: decouple MMU specific code from the common part

2024-12-08 Thread Hajime Tazaki
This splits the memory, process related code with common and MMU specific parts in order to avoid ifdefs in .c file and duplication between MMU and !MMU. Signed-off-by: Hajime Tazaki --- arch/um/include/shared/mem.h| 8 ++ arch/um/kernel/Makefile | 5 +- arch/um/kernel/mem

[PATCH v4 04/13] um: nommu: memory handling

2024-12-08 Thread Hajime Tazaki
the address space in !CONFIG_MMU mode. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/Makefile | 4 arch/um/include/asm/futex.h | 4 arch/um/include/asm/mmu.h | 3 +++ arch/um/include/asm/mmu_context.h | 2 ++ arch/um/include/asm

[PATCH v4 07/13] x86/um: nommu: process/thread handling

2024-12-08 Thread Hajime Tazaki
me of registers (fs segment register for TLS, etc) on every context switch, etc. Signals aren't delivered in non-ptrace syscall entry/leave so, we also need to handle pending signal by ourselves. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/os-Linux/process.c

[PATCH v4 09/13] x86/um/vdso: nommu: vdso memory update

2024-12-08 Thread Hajime Tazaki
On !MMU mode, the address of vdso is accessible from userspace. This commit implements the entry point by pointing a block of page address. This commit also add memory permission configuration of vdso page to be executable. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch

[PATCH v4 08/13] um: nommu: configure fs register on host syscall invocation

2024-12-08 Thread Hajime Tazaki
-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/include/shared/os.h | 6 +++ arch/um/os-Linux/process.c| 6 +++ arch/um/os-Linux/start_up.c | 20 + arch/x86/um/nommu/do_syscall_64.c | 37 arch/x86/um/nommu/syscalls_64.c | 71

[PATCH v4 10/13] x86/um: nommu: signal handling

2024-12-08 Thread Hajime Tazaki
SIGSEGV as a signal delivery runs in the same stack frame while we have to avoid endless SIGSEGV. Signed-off-by: Hajime Tazaki --- arch/um/nommu/Makefile| 2 +- arch/um/nommu/trap.c | 188 ++ arch/um/os-Linux/signal.c | 6

[PATCH v4 11/13] um: change machine name for uname output

2024-12-08 Thread Hajime Tazaki
This commit tries to display MMU/!MMU mode from the output of uname(2) so that users can distinguish which mode of UML is running right now. Signed-off-by: Hajime Tazaki --- arch/um/Makefile| 6 ++ arch/um/os-Linux/util.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion

[PATCH v4 12/13] um: nommu: add documentation of nommu UML

2024-12-08 Thread Hajime Tazaki
This commit adds an initial documentation for !MMU mode of UML. Signed-off-by: Hajime Tazaki --- Documentation/virt/uml/nommu-uml.rst | 177 +++ MAINTAINERS | 1 + 2 files changed, 178 insertions(+) create mode 100644 Documentation/virt/uml

[PATCH v4 06/13] um: nommu: seccomp syscalls hook

2024-12-08 Thread Hajime Tazaki
high_physmem, which locates userspace memory. Signed-off-by: Hajime Tazaki Signed-off-by: Kenichi Yasukata --- arch/um/include/shared/kern_util.h| 8 +++ arch/um/include/shared/os.h | 10 +++ arch/um/kernel/um_arch.c | 3 + arch/um/nommu/Makefile| 3

[PATCH v4 05/13] x86/um: nommu: syscall handling

2024-12-08 Thread Hajime Tazaki
cture. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/x86/um/Makefile| 4 ++ arch/x86/um/nommu/Makefile | 8 +++ arch/x86/um/nommu/do_syscall_64.c | 37 +++ arch/x86/um/nommu/entry_64.S| 87 +

[PATCH v4 13/13] um: nommu: plug nommu code into build system

2024-12-08 Thread Hajime Tazaki
Add nommu kernel for um build. defconfig is also provided. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/Kconfig| 14 +- arch/um/configs/x86_64_nommu_defconfig | 64 ++ 2 files changed, 76 insertions(+), 2 deletions

[PATCH v4 00/13] nommu UML

2024-12-08 Thread Hajime Tazaki
...@gmail.com/ RFC: - https://lore.kernel.org/linux-um/cover.1729770373.git.thehaj...@gmail.com/ Hajime Tazaki (13): x86/um: clean up elf specific definitions x86/um: nommu: elf loader for fdpic um: decouple MMU specific code from the common part um: nommu: memory handling x86/um: nommu

[PATCH v4 02/13] x86/um: nommu: elf loader for fdpic

2024-12-08 Thread Hajime Tazaki
Cc: Alexander Viro Cc: Christian Brauner Cc: Jan Kara Cc: linux...@kvack.org Cc: linux-fsde...@vger.kernel.org Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/include/asm/mmu.h| 5 + arch/um/include/asm/ptrace-generic.h | 6 ++ arch/x86/um/asm/elf.h

Re: [PATCH v3 00/13] nommu UML

2024-12-08 Thread Hajime Tazaki
On Sun, 08 Dec 2024 19:13:11 +0900, Hajime Tazaki wrote: > > This is a series of patches of nommu arch addition to UML. It would > be nice to ask comments/opinions on this. sorry for the noise. this is my mistake for resending patch. please ignore this. -- Hajime

[PATCH v4 01/13] x86/um: clean up elf specific definitions

2024-12-08 Thread Hajime Tazaki
The file arch/x86/um/asm/module.h is equivalent to the definition of asm-generic. Thus this commit cleans up to use it. Signed-off-by: Hajime Tazaki --- arch/um/include/asm/Kbuild | 1 + arch/x86/um/asm/module.h | 24 2 files changed, 1 insertion(+), 24 deletions

Re: [PATCH v3 07/13] x86/um: nommu: process/thread handling

2024-12-05 Thread Hajime Tazaki
On Thu, 05 Dec 2024 22:58:52 +0900, Johannes Berg wrote: > > On Thu, 2024-12-05 at 22:56 +0900, Hajime Tazaki wrote: > > > > > > +++ b/arch/x86/um/asm/processor.h > > > > @@ -38,6 +38,18 @@ static __always_inline void cpu_relax(void) > > &

Re: [PATCH v3 06/13] um: nommu: syscalls handler from userspace by seccomp filter

2024-12-05 Thread Hajime Tazaki
On Thu, 05 Dec 2024 22:54:21 +0900, Johannes Berg wrote: > > On Thu, 2024-12-05 at 22:51 +0900, Hajime Tazaki wrote: > > > > > > I don't understand why this behaves differently with and without > > > zpoline, it seems it shouldn't need to. Anywa

Re: [PATCH v7 00/13] nommu UML

2025-02-04 Thread Hajime Tazaki
Hello Richard, Anton, Cc: Johannes, On Mon, 20 Jan 2025 15:00:02 +0900, Hajime Tazaki wrote: > > This patchset is another spin of nommu mode addition to UML. It doesn't > change a lot since the last version (v5), but contain clean ups. It would > be nice to hear about your

Re: [PATCH v4 10/13] x86/um: nommu: signal handling

2024-12-11 Thread Hajime Tazaki
On Sun, 08 Dec 2024 19:15:37 +0900, Hajime Tazaki wrote: > > This commit updates the behavior of signal handling under !MMU > environment. 1) the stack preparation for the signal handlers and > 2) restoration of stack after rt_sigreturn(2) syscall. Those are needed > as the

[PATCH v5 02/13] x86/um: nommu: elf loader for fdpic

2024-12-12 Thread Hajime Tazaki
Cc: Alexander Viro Cc: Christian Brauner Cc: Jan Kara Cc: linux...@kvack.org Cc: linux-fsde...@vger.kernel.org Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/include/asm/mmu.h| 5 + arch/um/include/asm/ptrace-generic.h | 6 ++ arch/x86/um/asm/elf.h

[PATCH v5 09/13] x86/um/vdso: nommu: vdso memory update

2024-12-12 Thread Hajime Tazaki
On !MMU mode, the address of vdso is accessible from userspace. This commit implements the entry point by pointing a block of page address. This commit also add memory permission configuration of vdso page to be executable. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch

[PATCH v5 07/13] x86/um: nommu: process/thread handling

2024-12-12 Thread Hajime Tazaki
red in non-ptrace syscall entry/leave so, we also need to handle pending signal by ourselves. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/os-Linux/process.c | 6 + arch/x86/um/Makefile| 3 ++- arch/x86/um/nommu/Makefile | 2 +- arch/x86/um/nommu/

[PATCH v5 00/13] nommu UML

2024-12-12 Thread Hajime Tazaki
- proposed a patch of maple-tree issue (resolving a limitation in RFC v1) https://lore.kernel.org/linux-mm/20241108222834.3625217-1-thehaj...@gmail.com/ RFC: - https://lore.kernel.org/linux-um/cover.1729770373.git.thehaj...@gmail.com/ Hajime Tazaki (13): x86/um: clean up elf specific definitions x86

[PATCH v5 12/13] um: nommu: add documentation of nommu UML

2024-12-12 Thread Hajime Tazaki
This commit adds an initial documentation for !MMU mode of UML. Signed-off-by: Hajime Tazaki --- Documentation/virt/uml/nommu-uml.rst | 177 +++ MAINTAINERS | 1 + 2 files changed, 178 insertions(+) create mode 100644 Documentation/virt/uml

[PATCH v5 13/13] um: nommu: plug nommu code into build system

2024-12-12 Thread Hajime Tazaki
Add nommu kernel for um build. defconfig is also provided. Signed-off-by: Hajime Tazaki Signed-off-by: Ricardo Koller --- arch/um/Kconfig| 14 +- arch/um/configs/x86_64_nommu_defconfig | 64 ++ 2 files changed, 76 insertions(+), 2 deletions

  1   2   3   >