* [PATCH v2 0/4] nios2: Add architecture support for clone3
@ 2025-09-01 13:09 Simon Schuster via B4 Relay
2025-09-01 13:09 ` [PATCH v2 1/4] copy_sighand: Handle architectures where sizeof(unsigned long) < sizeof(u64) Simon Schuster via B4 Relay
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Simon Schuster via B4 Relay @ 2025-09-01 13:09 UTC (permalink / raw)
To: Dinh Nguyen, Christian Brauner, Arnd Bergmann, Andrew Morton,
David Hildenbrand, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, Kees Cook, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Alexandre Ghiti, Guo Ren, Oleg Nesterov, Jens Axboe,
Alexander Viro, Jan Kara, Tejun Heo, Johannes Weiner,
Michal Koutný, Paul Moore, Serge Hallyn, James Morris,
Serge E. Hallyn, Anna-Maria Behnsen, Frederic Weisbecker,
Thomas Gleixner, Masami Hiramatsu, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Mathieu Desnoyers,
Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
John Johansen, Stephen Smalley, Ondrej Mosnacek, Kentaro Takeda,
Tetsuo Handa, Richard Henderson, Matt Turner, Vineet Gupta,
Russell King, Catalin Marinas, Will Deacon, Brian Cain,
Huacai Chen, WANG Xuerui, Geert Uytterhoeven, Michal Simek,
Thomas Bogendoerfer, Jonas Bonn, Stefan Kristiansson,
Stafford Horne, James E.J. Bottomley, Helge Deller,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz,
Andreas Larsson, Richard Weinberger, Anton Ivanov, Johannes Berg,
Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Chris Zankel,
Max Filippov
Cc: linux-mm, linux-kernel, linux-riscv, linux-csky, linux-block,
linux-fsdevel, cgroups, linux-security-module, linux-trace-kernel,
netdev, linux-perf-users, apparmor, selinux, linux-alpha,
linux-snps-arc, linux-arm-kernel, linux-hexagon, loongarch,
linux-m68k, linux-mips, linux-openrisc, linux-parisc,
linuxppc-dev, linux-s390, linux-sh, sparclinux, linux-um,
Simon Schuster, stable
This series adds support for the clone3 system call to the nios2
architecture. This addresses the build-time warning "warning: clone3()
entry point is missing, please fix" introduced in 505d66d1abfb9
("clone3: drop __ARCH_WANT_SYS_CLONE3 macro"). The implementation passes
the relevant clone3 tests of kselftest when applied on top of
next-20250815:
./run_kselftest.sh
TAP version 13
1..4
# selftests: clone3: clone3
ok 1 selftests: clone3: clone3
# selftests: clone3: clone3_clear_sighand
ok 2 selftests: clone3: clone3_clear_sighand
# selftests: clone3: clone3_set_tid
ok 3 selftests: clone3: clone3_set_tid
# selftests: clone3: clone3_cap_checkpoint_restore
ok 4 selftests: clone3: clone3_cap_checkpoint_restore
The series also includes a small patch to kernel/fork.c that ensures
that clone_flags are passed correctly on architectures where unsigned
long is insufficient to store the u64 clone_flags. It is marked as a fix
for stable backporting.
As requested, in v2, this series now further tries to correct this type
error throughout the whole code base. Thus, it now touches a larger
number of subsystems and all architectures.
Therefore, another test was performed for ARCH=x86_64 (as a
representative for 64-bit architectures). Here, the series builds cleanly
without warnings on defconfig with CONFIG_SECURITY_APPARMOR=y and
CONFIG_SECURITY_TOMOYO=y (to compile-check the LSM-related changes).
The build further successfully passes testing/selftests/clone3 (with the
patch from 20241105062948.1037011-1-zhouyuhang1010@163.com to prepare
clone3_cap_checkpoint_restore for compatibility with the newer libcap
version on my system).
Is there any option to further preflight check this patch series via
lkp/KernelCI/etc. for a broader test across architectures, or is this
degree of testing sufficient to eventually get the series merged?
N.B.: The series is not checkpatch clean right now:
- include/linux/cred.h, include/linux/mnt_namespace.h:
function definition arguments without identifier name
- include/trace/events/task.h:
space prohibited after that open parenthesis
I did not fix these warnings to keep my changes minimal and reviewable,
as the issues persist throughout the files and they were not introduced
by me; I only followed the existing code style and just replaced the
types. If desired, I'd be happy to make the changes in a potential v3,
though.
Signed-off-by: Simon Schuster <schuster.simon@siemens-energy.com>
---
Changes in v2:
- Introduce "Fixes:" and "Cc: stable@vger.kernel.org" where necessary
- Factor out "Fixes:" when adapting the datatype of clone_flags for
easier backports
- Fix additional instances where `unsigned long` clone_flags is used
- Reword commit message to make it clearer that any 32-bit arch is
affected by this bug
- Link to v1: https://lore.kernel.org/r/20250821-nios2-implement-clone3-v1-0-1bb24017376a@siemens-energy.com
---
Simon Schuster (4):
copy_sighand: Handle architectures where sizeof(unsigned long) < sizeof(u64)
copy_process: pass clone_flags as u64 across calltree
arch: copy_thread: pass clone_flags as u64
nios2: implement architecture-specific portion of sys_clone3
arch/alpha/kernel/process.c | 2 +-
arch/arc/kernel/process.c | 2 +-
arch/arm/kernel/process.c | 2 +-
arch/arm64/kernel/process.c | 2 +-
arch/csky/kernel/process.c | 2 +-
arch/hexagon/kernel/process.c | 2 +-
arch/loongarch/kernel/process.c | 2 +-
arch/m68k/kernel/process.c | 2 +-
arch/microblaze/kernel/process.c | 2 +-
arch/mips/kernel/process.c | 2 +-
arch/nios2/include/asm/syscalls.h | 1 +
arch/nios2/include/asm/unistd.h | 2 --
arch/nios2/kernel/entry.S | 6 ++++++
arch/nios2/kernel/process.c | 2 +-
arch/nios2/kernel/syscall_table.c | 1 +
arch/openrisc/kernel/process.c | 2 +-
arch/parisc/kernel/process.c | 2 +-
arch/powerpc/kernel/process.c | 2 +-
arch/riscv/kernel/process.c | 2 +-
arch/s390/kernel/process.c | 2 +-
arch/sh/kernel/process_32.c | 2 +-
arch/sparc/kernel/process_32.c | 2 +-
arch/sparc/kernel/process_64.c | 2 +-
arch/um/kernel/process.c | 2 +-
arch/x86/include/asm/fpu/sched.h | 2 +-
arch/x86/include/asm/shstk.h | 4 ++--
arch/x86/kernel/fpu/core.c | 2 +-
arch/x86/kernel/process.c | 2 +-
arch/x86/kernel/shstk.c | 2 +-
arch/xtensa/kernel/process.c | 2 +-
block/blk-ioc.c | 2 +-
fs/namespace.c | 2 +-
include/linux/cgroup.h | 4 ++--
include/linux/cred.h | 2 +-
include/linux/iocontext.h | 6 +++---
include/linux/ipc_namespace.h | 4 ++--
include/linux/lsm_hook_defs.h | 2 +-
include/linux/mnt_namespace.h | 2 +-
include/linux/nsproxy.h | 2 +-
include/linux/pid_namespace.h | 4 ++--
include/linux/rseq.h | 4 ++--
include/linux/sched/task.h | 2 +-
include/linux/security.h | 4 ++--
include/linux/sem.h | 4 ++--
include/linux/time_namespace.h | 4 ++--
include/linux/uprobes.h | 4 ++--
include/linux/user_events.h | 4 ++--
include/linux/utsname.h | 4 ++--
include/net/net_namespace.h | 4 ++--
include/trace/events/task.h | 6 +++---
ipc/namespace.c | 2 +-
ipc/sem.c | 2 +-
kernel/cgroup/namespace.c | 2 +-
kernel/cred.c | 2 +-
kernel/events/uprobes.c | 2 +-
kernel/fork.c | 10 +++++-----
kernel/nsproxy.c | 4 ++--
kernel/pid_namespace.c | 2 +-
kernel/sched/core.c | 4 ++--
kernel/sched/fair.c | 2 +-
kernel/sched/sched.h | 4 ++--
kernel/time/namespace.c | 2 +-
kernel/utsname.c | 2 +-
net/core/net_namespace.c | 2 +-
security/apparmor/lsm.c | 2 +-
security/security.c | 2 +-
security/selinux/hooks.c | 2 +-
security/tomoyo/tomoyo.c | 2 +-
68 files changed, 95 insertions(+), 89 deletions(-)
---
base-commit: 1357b2649c026b51353c84ddd32bc963e8999603
change-id: 20250818-nios2-implement-clone3-7f252c20860b
Best regards,
--
Simon Schuster <schuster.simon@siemens-energy.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/4] copy_sighand: Handle architectures where sizeof(unsigned long) < sizeof(u64)
2025-09-01 13:09 [PATCH v2 0/4] nios2: Add architecture support for clone3 Simon Schuster via B4 Relay
@ 2025-09-01 13:09 ` Simon Schuster via B4 Relay
2025-09-01 13:19 ` Arnd Bergmann
2025-09-01 13:24 ` David Hildenbrand
2025-09-01 13:40 ` [PATCH v2 0/4] nios2: Add architecture support for clone3 Christian Brauner
2025-09-01 13:41 ` Christian Brauner
2 siblings, 2 replies; 6+ messages in thread
From: Simon Schuster via B4 Relay @ 2025-09-01 13:09 UTC (permalink / raw)
To: Dinh Nguyen, Christian Brauner, Arnd Bergmann, Andrew Morton,
David Hildenbrand, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, Kees Cook, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Alexandre Ghiti, Guo Ren, Oleg Nesterov, Jens Axboe,
Alexander Viro, Jan Kara, Tejun Heo, Johannes Weiner,
Michal Koutný, Paul Moore, Serge Hallyn, James Morris,
Serge E. Hallyn, Anna-Maria Behnsen, Frederic Weisbecker,
Thomas Gleixner, Masami Hiramatsu, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Mathieu Desnoyers,
Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
John Johansen, Stephen Smalley, Ondrej Mosnacek, Kentaro Takeda,
Tetsuo Handa, Richard Henderson, Matt Turner, Vineet Gupta,
Russell King, Catalin Marinas, Will Deacon, Brian Cain,
Huacai Chen, WANG Xuerui, Geert Uytterhoeven, Michal Simek,
Thomas Bogendoerfer, Jonas Bonn, Stefan Kristiansson,
Stafford Horne, James E.J. Bottomley, Helge Deller,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz,
Andreas Larsson, Richard Weinberger, Anton Ivanov, Johannes Berg,
Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Chris Zankel,
Max Filippov
Cc: linux-mm, linux-kernel, linux-riscv, linux-csky, linux-block,
linux-fsdevel, cgroups, linux-security-module, linux-trace-kernel,
netdev, linux-perf-users, apparmor, selinux, linux-alpha,
linux-snps-arc, linux-arm-kernel, linux-hexagon, loongarch,
linux-m68k, linux-mips, linux-openrisc, linux-parisc,
linuxppc-dev, linux-s390, linux-sh, sparclinux, linux-um,
Simon Schuster, stable
From: Simon Schuster <schuster.simon@siemens-energy.com>
With the introduction of clone3 in commit 7f192e3cd316 ("fork: add
clone3") the effective bit width of clone_flags on all architectures was
increased from 32-bit to 64-bit. However, the signature of the copy_*
helper functions (e.g., copy_sighand) used by copy_process was not
adapted.
As such, they truncate the flags on any 32-bit architectures that
supports clone3 (arc, arm, csky, m68k, microblaze, mips32, openrisc,
parisc32, powerpc32, riscv32, x86-32 and xtensa).
For copy_sighand with CLONE_CLEAR_SIGHAND being an actual u64
constant, this triggers an observable bug in kernel selftest
clone3_clear_sighand:
if (clone_flags & CLONE_CLEAR_SIGHAND)
in function copy_sighand within fork.c will always fail given:
unsigned long /* == uint32_t */ clone_flags
#define CLONE_CLEAR_SIGHAND 0x100000000ULL
This commit fixes the bug by always passing clone_flags to copy_sighand
via their declared u64 type, invariant of architecture-dependent integer
sizes.
Fixes: b612e5df4587 ("clone3: add CLONE_CLEAR_SIGHAND")
Cc: stable@vger.kernel.org # linux-5.5+
Signed-off-by: Simon Schuster <schuster.simon@siemens-energy.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
---
kernel/fork.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/fork.c b/kernel/fork.c
index 5115be549234..82f5d52fecf1 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1599,7 +1599,7 @@ static int copy_files(unsigned long clone_flags, struct task_struct *tsk,
return 0;
}
-static int copy_sighand(unsigned long clone_flags, struct task_struct *tsk)
+static int copy_sighand(u64 clone_flags, struct task_struct *tsk)
{
struct sighand_struct *sig;
--
2.39.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/4] copy_sighand: Handle architectures where sizeof(unsigned long) < sizeof(u64)
2025-09-01 13:09 ` [PATCH v2 1/4] copy_sighand: Handle architectures where sizeof(unsigned long) < sizeof(u64) Simon Schuster via B4 Relay
@ 2025-09-01 13:19 ` Arnd Bergmann
2025-09-01 13:24 ` David Hildenbrand
1 sibling, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2025-09-01 13:19 UTC (permalink / raw)
To: schuster.simon@siemens-energy.com, Dinh Nguyen, Christian Brauner,
Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Ingo Molnar, Peter Zijlstra,
Juri Lelli, Vincent Guittot, Dietmar Eggemann, Steven Rostedt,
Benjamin Segall, Mel Gorman, Valentin Schneider, Kees Cook,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti, guoren,
Oleg Nesterov, Jens Axboe, Alexander Viro, Jan Kara, Tejun Heo,
Johannes Weiner, Michal Koutný, Paul Moore, Serge Hallyn,
James Morris, Serge E. Hallyn, Anna-Maria Gleixner,
Frederic Weisbecker, Thomas Gleixner, Masami Hiramatsu,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Mathieu Desnoyers, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, John Johansen, Stephen Smalley,
Ondrej Mosnacek, Kentaro Takeda, Tetsuo Handa, Richard Henderson,
Matt Turner, Vineet Gupta, Russell King, Catalin Marinas,
Will Deacon, Brian Cain, Huacai Chen, WANG Xuerui,
Geert Uytterhoeven, Michal Simek, Thomas Bogendoerfer, Jonas Bonn,
Stefan Kristiansson, Stafford Horne, James E . J . Bottomley,
Helge Deller, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz,
Andreas Larsson, Richard Weinberger, Anton Ivanov, Johannes Berg,
Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Chris Zankel,
Max Filippov
Cc: linux-mm, linux-kernel, linux-riscv, linux-csky@vger.kernel.org,
linux-block, linux-fsdevel, cgroups, linux-security-module,
linux-trace-kernel, Netdev, linux-perf-users, apparmor, selinux,
linux-alpha, linux-snps-arc, linux-arm-kernel, linux-hexagon,
loongarch, linux-m68k, linux-mips, linux-openrisc@vger.kernel.org,
linux-parisc, linuxppc-dev, linux-s390, linux-sh, sparclinux,
linux-um, stable
On Mon, Sep 1, 2025, at 15:09, Simon Schuster via B4 Relay wrote:
> This commit fixes the bug by always passing clone_flags to copy_sighand
> via their declared u64 type, invariant of architecture-dependent integer
> sizes.
>
> Fixes: b612e5df4587 ("clone3: add CLONE_CLEAR_SIGHAND")
> Cc: stable@vger.kernel.org # linux-5.5+
> Signed-off-by: Simon Schuster <schuster.simon@siemens-energy.com>
> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/4] copy_sighand: Handle architectures where sizeof(unsigned long) < sizeof(u64)
2025-09-01 13:09 ` [PATCH v2 1/4] copy_sighand: Handle architectures where sizeof(unsigned long) < sizeof(u64) Simon Schuster via B4 Relay
2025-09-01 13:19 ` Arnd Bergmann
@ 2025-09-01 13:24 ` David Hildenbrand
1 sibling, 0 replies; 6+ messages in thread
From: David Hildenbrand @ 2025-09-01 13:24 UTC (permalink / raw)
To: schuster.simon, Dinh Nguyen, Christian Brauner, Arnd Bergmann,
Andrew Morton, Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport
Cc: linux-mm, linux-kernel, linux-riscv, linux-csky, linux-block,
linux-fsdevel, cgroups, linux-security-module, linux-trace-kernel,
netdev, linux-perf-users, apparmor, selinux, linux-alpha,
linux-snps-arc, linux-arm-kernel, linux-hexagon, loongarch,
linux-m68k, linux-mips, linux-openrisc, linux-parisc,
linuxppc-dev, linux-s390, linux-sh, sparclinux, linux-um, stable
On 01.09.25 15:09, Simon Schuster via B4 Relay wrote:
> From: Simon Schuster <schuster.simon@siemens-energy.com>
>
> With the introduction of clone3 in commit 7f192e3cd316 ("fork: add
> clone3") the effective bit width of clone_flags on all architectures was
> increased from 32-bit to 64-bit. However, the signature of the copy_*
> helper functions (e.g., copy_sighand) used by copy_process was not
> adapted.
>
> As such, they truncate the flags on any 32-bit architectures that
> supports clone3 (arc, arm, csky, m68k, microblaze, mips32, openrisc,
> parisc32, powerpc32, riscv32, x86-32 and xtensa).
>
> For copy_sighand with CLONE_CLEAR_SIGHAND being an actual u64
> constant, this triggers an observable bug in kernel selftest
> clone3_clear_sighand:
>
> if (clone_flags & CLONE_CLEAR_SIGHAND)
>
> in function copy_sighand within fork.c will always fail given:
>
> unsigned long /* == uint32_t */ clone_flags
> #define CLONE_CLEAR_SIGHAND 0x100000000ULL
>
> This commit fixes the bug by always passing clone_flags to copy_sighand
> via their declared u64 type, invariant of architecture-dependent integer
> sizes.
>
> Fixes: b612e5df4587 ("clone3: add CLONE_CLEAR_SIGHAND")
> Cc: stable@vger.kernel.org # linux-5.5+
> Signed-off-by: Simon Schuster <schuster.simon@siemens-energy.com>
> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
(stripping To list)
Acked-by: David Hildenbrand <david@redhat.com>
--
Cheers
David / dhildenb
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/4] nios2: Add architecture support for clone3
2025-09-01 13:09 [PATCH v2 0/4] nios2: Add architecture support for clone3 Simon Schuster via B4 Relay
2025-09-01 13:09 ` [PATCH v2 1/4] copy_sighand: Handle architectures where sizeof(unsigned long) < sizeof(u64) Simon Schuster via B4 Relay
@ 2025-09-01 13:40 ` Christian Brauner
2025-09-01 13:41 ` Christian Brauner
2 siblings, 0 replies; 6+ messages in thread
From: Christian Brauner @ 2025-09-01 13:40 UTC (permalink / raw)
To: schuster.simon
Cc: Dinh Nguyen, Arnd Bergmann, Andrew Morton, David Hildenbrand,
Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Ingo Molnar, Peter Zijlstra,
Juri Lelli, Vincent Guittot, Dietmar Eggemann, Steven Rostedt,
Ben Segall, Mel Gorman, Valentin Schneider, Kees Cook,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Guo Ren, Oleg Nesterov, Jens Axboe, Alexander Viro, Jan Kara,
Tejun Heo, Johannes Weiner, Michal Koutný, Paul Moore,
Serge Hallyn, James Morris, Serge E. Hallyn, Anna-Maria Behnsen,
Frederic Weisbecker, Thomas Gleixner, Masami Hiramatsu,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Mathieu Desnoyers, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, John Johansen, Stephen Smalley,
Ondrej Mosnacek, Kentaro Takeda, Tetsuo Handa, Richard Henderson,
Matt Turner, Vineet Gupta, Russell King, Catalin Marinas,
Will Deacon, Brian Cain, Huacai Chen, WANG Xuerui,
Geert Uytterhoeven, Michal Simek, Thomas Bogendoerfer, Jonas Bonn,
Stefan Kristiansson, Stafford Horne, James E.J. Bottomley,
Helge Deller, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz,
Andreas Larsson, Richard Weinberger, Anton Ivanov, Johannes Berg,
Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Chris Zankel,
Max Filippov, linux-mm, linux-kernel, linux-riscv, linux-csky,
linux-block, linux-fsdevel, cgroups, linux-security-module,
linux-trace-kernel, netdev, linux-perf-users, apparmor, selinux,
linux-alpha, linux-snps-arc, linux-arm-kernel, linux-hexagon,
loongarch, linux-m68k, linux-mips, linux-openrisc, linux-parisc,
linuxppc-dev, linux-s390, linux-sh, sparclinux, linux-um, stable
On Mon, Sep 01, 2025 at 03:09:49PM +0200, Simon Schuster via B4 Relay wrote:
> This series adds support for the clone3 system call to the nios2
> architecture. This addresses the build-time warning "warning: clone3()
I did not expect that to happen or matter but fine.
> entry point is missing, please fix" introduced in 505d66d1abfb9
> ("clone3: drop __ARCH_WANT_SYS_CLONE3 macro"). The implementation passes
> the relevant clone3 tests of kselftest when applied on top of
> next-20250815:
>
> ./run_kselftest.sh
> TAP version 13
> 1..4
> # selftests: clone3: clone3
> ok 1 selftests: clone3: clone3
> # selftests: clone3: clone3_clear_sighand
> ok 2 selftests: clone3: clone3_clear_sighand
> # selftests: clone3: clone3_set_tid
> ok 3 selftests: clone3: clone3_set_tid
> # selftests: clone3: clone3_cap_checkpoint_restore
> ok 4 selftests: clone3: clone3_cap_checkpoint_restore
>
> The series also includes a small patch to kernel/fork.c that ensures
> that clone_flags are passed correctly on architectures where unsigned
> long is insufficient to store the u64 clone_flags. It is marked as a fix
> for stable backporting.
>
> As requested, in v2, this series now further tries to correct this type
> error throughout the whole code base. Thus, it now touches a larger
> number of subsystems and all architectures.
I've reworked copy_thread()/copy_thread_tls() a few years ago but I
don't remember why I didn't switch to a u64 for them. Probably because
only CLONE_VM and CLONE_SETTLS mattered. Thanks for doing that.
> Therefore, another test was performed for ARCH=x86_64 (as a
> representative for 64-bit architectures). Here, the series builds cleanly
> without warnings on defconfig with CONFIG_SECURITY_APPARMOR=y and
> CONFIG_SECURITY_TOMOYO=y (to compile-check the LSM-related changes).
> The build further successfully passes testing/selftests/clone3 (with the
> patch from 20241105062948.1037011-1-zhouyuhang1010@163.com to prepare
> clone3_cap_checkpoint_restore for compatibility with the newer libcap
> version on my system).
>
> Is there any option to further preflight check this patch series via
> lkp/KernelCI/etc. for a broader test across architectures, or is this
> degree of testing sufficient to eventually get the series merged?
>
> N.B.: The series is not checkpatch clean right now:
> - include/linux/cred.h, include/linux/mnt_namespace.h:
> function definition arguments without identifier name
> - include/trace/events/task.h:
> space prohibited after that open parenthesis
>
> I did not fix these warnings to keep my changes minimal and reviewable,
> as the issues persist throughout the files and they were not introduced
> by me; I only followed the existing code style and just replaced the
> types. If desired, I'd be happy to make the changes in a potential v3,
> though.
>
> Signed-off-by: Simon Schuster <schuster.simon@siemens-energy.com>
> ---
> Changes in v2:
> - Introduce "Fixes:" and "Cc: stable@vger.kernel.org" where necessary
> - Factor out "Fixes:" when adapting the datatype of clone_flags for
> easier backports
> - Fix additional instances where `unsigned long` clone_flags is used
> - Reword commit message to make it clearer that any 32-bit arch is
> affected by this bug
> - Link to v1: https://lore.kernel.org/r/20250821-nios2-implement-clone3-v1-0-1bb24017376a@siemens-energy.com
>
> ---
> Simon Schuster (4):
> copy_sighand: Handle architectures where sizeof(unsigned long) < sizeof(u64)
> copy_process: pass clone_flags as u64 across calltree
> arch: copy_thread: pass clone_flags as u64
> nios2: implement architecture-specific portion of sys_clone3
>
> arch/alpha/kernel/process.c | 2 +-
> arch/arc/kernel/process.c | 2 +-
> arch/arm/kernel/process.c | 2 +-
> arch/arm64/kernel/process.c | 2 +-
> arch/csky/kernel/process.c | 2 +-
> arch/hexagon/kernel/process.c | 2 +-
> arch/loongarch/kernel/process.c | 2 +-
> arch/m68k/kernel/process.c | 2 +-
> arch/microblaze/kernel/process.c | 2 +-
> arch/mips/kernel/process.c | 2 +-
> arch/nios2/include/asm/syscalls.h | 1 +
> arch/nios2/include/asm/unistd.h | 2 --
> arch/nios2/kernel/entry.S | 6 ++++++
> arch/nios2/kernel/process.c | 2 +-
> arch/nios2/kernel/syscall_table.c | 1 +
> arch/openrisc/kernel/process.c | 2 +-
> arch/parisc/kernel/process.c | 2 +-
> arch/powerpc/kernel/process.c | 2 +-
> arch/riscv/kernel/process.c | 2 +-
> arch/s390/kernel/process.c | 2 +-
> arch/sh/kernel/process_32.c | 2 +-
> arch/sparc/kernel/process_32.c | 2 +-
> arch/sparc/kernel/process_64.c | 2 +-
> arch/um/kernel/process.c | 2 +-
> arch/x86/include/asm/fpu/sched.h | 2 +-
> arch/x86/include/asm/shstk.h | 4 ++--
> arch/x86/kernel/fpu/core.c | 2 +-
> arch/x86/kernel/process.c | 2 +-
> arch/x86/kernel/shstk.c | 2 +-
> arch/xtensa/kernel/process.c | 2 +-
> block/blk-ioc.c | 2 +-
> fs/namespace.c | 2 +-
> include/linux/cgroup.h | 4 ++--
> include/linux/cred.h | 2 +-
> include/linux/iocontext.h | 6 +++---
> include/linux/ipc_namespace.h | 4 ++--
> include/linux/lsm_hook_defs.h | 2 +-
> include/linux/mnt_namespace.h | 2 +-
> include/linux/nsproxy.h | 2 +-
> include/linux/pid_namespace.h | 4 ++--
> include/linux/rseq.h | 4 ++--
> include/linux/sched/task.h | 2 +-
> include/linux/security.h | 4 ++--
> include/linux/sem.h | 4 ++--
> include/linux/time_namespace.h | 4 ++--
> include/linux/uprobes.h | 4 ++--
> include/linux/user_events.h | 4 ++--
> include/linux/utsname.h | 4 ++--
> include/net/net_namespace.h | 4 ++--
> include/trace/events/task.h | 6 +++---
> ipc/namespace.c | 2 +-
> ipc/sem.c | 2 +-
> kernel/cgroup/namespace.c | 2 +-
> kernel/cred.c | 2 +-
> kernel/events/uprobes.c | 2 +-
> kernel/fork.c | 10 +++++-----
> kernel/nsproxy.c | 4 ++--
> kernel/pid_namespace.c | 2 +-
> kernel/sched/core.c | 4 ++--
> kernel/sched/fair.c | 2 +-
> kernel/sched/sched.h | 4 ++--
> kernel/time/namespace.c | 2 +-
> kernel/utsname.c | 2 +-
> net/core/net_namespace.c | 2 +-
> security/apparmor/lsm.c | 2 +-
> security/security.c | 2 +-
> security/selinux/hooks.c | 2 +-
> security/tomoyo/tomoyo.c | 2 +-
> 68 files changed, 95 insertions(+), 89 deletions(-)
> ---
> base-commit: 1357b2649c026b51353c84ddd32bc963e8999603
> change-id: 20250818-nios2-implement-clone3-7f252c20860b
>
> Best regards,
> --
> Simon Schuster <schuster.simon@siemens-energy.com>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/4] nios2: Add architecture support for clone3
2025-09-01 13:09 [PATCH v2 0/4] nios2: Add architecture support for clone3 Simon Schuster via B4 Relay
2025-09-01 13:09 ` [PATCH v2 1/4] copy_sighand: Handle architectures where sizeof(unsigned long) < sizeof(u64) Simon Schuster via B4 Relay
2025-09-01 13:40 ` [PATCH v2 0/4] nios2: Add architecture support for clone3 Christian Brauner
@ 2025-09-01 13:41 ` Christian Brauner
2 siblings, 0 replies; 6+ messages in thread
From: Christian Brauner @ 2025-09-01 13:41 UTC (permalink / raw)
To: Simon Schuster
Cc: Christian Brauner, linux-mm, linux-kernel, linux-riscv,
linux-csky, linux-block, linux-fsdevel, cgroups,
linux-security-module, linux-trace-kernel, netdev,
linux-perf-users, apparmor, selinux, linux-alpha, linux-snps-arc,
linux-arm-kernel, linux-hexagon, loongarch, linux-m68k,
linux-mips, linux-openrisc, linux-parisc, linuxppc-dev,
linux-s390, linux-sh, sparclinux, linux-um, stable, Dinh Nguyen,
Arnd Bergmann, Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Ingo Molnar, Peter Zijlstra,
Juri Lelli, Vincent Guittot, Dietmar Eggemann, Steven Rostedt,
Ben Segall, Mel Gorman, Valentin Schneider, Kees Cook,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Guo Ren, Oleg Nesterov, Jens Axboe, Alexander Viro, Jan Kara,
Tejun Heo, Johannes Weiner, Michal Koutný, Paul Moore,
Serge Hallyn, James Morris, Serge E. Hallyn, Anna-Maria Behnsen,
Frederic Weisbecker, Thomas Gleixner, Masami Hiramatsu,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Mathieu Desnoyers, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, John Johansen, Stephen Smalley,
Ondrej Mosnacek, Kentaro Takeda, Tetsuo Handa, Richard Henderson,
Matt Turner, Vineet Gupta, Russell King, Catalin Marinas,
Will Deacon, Brian Cain, Huacai Chen, WANG Xuerui,
Geert Uytterhoeven, Michal Simek, Thomas Bogendoerfer, Jonas Bonn,
Stefan Kristiansson, Stafford Horne, James E.J. Bottomley,
Helge Deller, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz,
Andreas Larsson, Richard Weinberger, Anton Ivanov, Johannes Berg,
Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Chris Zankel,
Max Filippov
On Mon, 01 Sep 2025 15:09:49 +0200, Simon Schuster wrote:
> This series adds support for the clone3 system call to the nios2
> architecture. This addresses the build-time warning "warning: clone3()
> entry point is missing, please fix" introduced in 505d66d1abfb9
> ("clone3: drop __ARCH_WANT_SYS_CLONE3 macro"). The implementation passes
> the relevant clone3 tests of kselftest when applied on top of
> next-20250815:
>
> [...]
Seems fine to me. Thanks for fixing this.
---
Applied to the kernel-6.18.clone3 branch of the vfs/vfs.git tree.
Patches in the kernel-6.18.clone3 branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: kernel-6.18.clone3
[1/4] copy_sighand: Handle architectures where sizeof(unsigned long) < sizeof(u64)
https://git.kernel.org/vfs/vfs/c/04ff48239f46
[2/4] copy_process: pass clone_flags as u64 across calltree
https://git.kernel.org/vfs/vfs/c/5b38576cb8d3
[3/4] arch: copy_thread: pass clone_flags as u64
https://git.kernel.org/vfs/vfs/c/04e760acd97f
[4/4] nios2: implement architecture-specific portion of sys_clone3
https://git.kernel.org/vfs/vfs/c/d7109d2a2358
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-09-01 13:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-01 13:09 [PATCH v2 0/4] nios2: Add architecture support for clone3 Simon Schuster via B4 Relay
2025-09-01 13:09 ` [PATCH v2 1/4] copy_sighand: Handle architectures where sizeof(unsigned long) < sizeof(u64) Simon Schuster via B4 Relay
2025-09-01 13:19 ` Arnd Bergmann
2025-09-01 13:24 ` David Hildenbrand
2025-09-01 13:40 ` [PATCH v2 0/4] nios2: Add architecture support for clone3 Christian Brauner
2025-09-01 13:41 ` Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).