lkml.org 
[lkml]   [2021]   [Oct]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] RISC-V: Include clone3() on rv32
On Sun, Oct 03, 2021 at 05:30:24PM +0200, Arnd Bergmann wrote:
> On Sun, Oct 3, 2021 at 2:58 AM Palmer Dabbelt <palmer@dabbelt.com> wrote:
> >
> > From: Palmer Dabbelt <palmerdabbelt@google.com>
> >
> > As far as I can tell this should be enabled on rv32 as well, I'm not
> > sure why it's rv64-only. checksyscalls is complaining about our lack of
> > clone3() on rv32.
> >
> > Fixes: 56ac5e213933 ("riscv: enable sys_clone3 syscall for rv64")
> > Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
>
> We should probably reverse the polarity of this symbol and force
> architectures that don't implement it properly to say they don't
> have it, but for now, it definitely makes sense to treat this the same
> way on 32-bit and 64-bit risc-v.

I think we had that discussion back when I added it and I think I even
proposed that or you did but then we settled on __ARCH_WANT_SYS_CLONE3.
Most likely because it fell in line with the other
__ARCH_WANT_SYS_{CLONE,FORK}.

I think at this point its alpha, ia64, nios, sparc, and sh that don't
implement it. For some it looks trivial at first glance at least (Fwiw,
nios implements sys_clone() but doesn't select __ARCH_WANT_SYS_CLONE3):

diff --git a/arch/nios2/include/uapi/asm/unistd.h b/arch/nios2/include/uapi/asm/unistd.h
index 0b4bb1d41b28..6c4f45abd3ab 100644
--- a/arch/nios2/include/uapi/asm/unistd.h
+++ b/arch/nios2/include/uapi/asm/unistd.h
@@ -18,6 +18,7 @@

#define sys_mmap2 sys_mmap_pgoff

+#define __ARCH_WANT_SYS_CLONE3
#define __ARCH_WANT_RENAMEAT
#define __ARCH_WANT_STAT64
#define __ARCH_WANT_SET_GET_RLIMIT
diff --git a/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S
index 0794cd7803df..c1804bda8259 100644
--- a/arch/nios2/kernel/entry.S
+++ b/arch/nios2/kernel/entry.S
@@ -396,6 +396,15 @@ ENTRY(sys_clone)
RESTORE_SWITCH_STACK
ret

+/*
+ * int clone3(struct clone_args __user *, uargs, size_t, size)
+ */
+ENTRY(sys_clone3)
+ SAVE_SWITCH_STACK
+ call sys_clone3
+ RESTORE_SWITCH_STACK
+ ret
+
ENTRY(sys_rt_sigreturn)
SAVE_SWITCH_STACK
mov r4, sp
\
 
 \ /
  Last update: 2021-10-04 13:18    [W:0.313 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site