sparclinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [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
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ 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] 20+ 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:09 ` [PATCH v2 2/4] copy_process: pass clone_flags as u64 across calltree Simon Schuster via B4 Relay
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 20+ 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] 20+ messages in thread

* [PATCH v2 2/4] copy_process: pass clone_flags as u64 across calltree
  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:09 ` Simon Schuster via B4 Relay
  2025-09-01 13:35   ` Arnd Bergmann
  2025-09-01 13:38   ` David Hildenbrand
  2025-09-01 13:09 ` [PATCH v2 3/4] arch: copy_thread: pass clone_flags as u64 Simon Schuster via B4 Relay
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 20+ 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

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, with a new type of u64 for the flags.
However, for most consumers of clone_flags the interface was not
changed from the previous type of unsigned long.

While this works fine as long as none of the new 64-bit flag bits
(CLONE_CLEAR_SIGHAND and CLONE_INTO_CGROUP) are evaluated, this is still
undesirable in terms of the principle of least surprise.

Thus, this commit fixes all relevant interfaces of callees to
sys_clone3/copy_process (excluding the architecture-specific
copy_thread) to consistently pass clone_flags as u64, so that
no truncation to 32-bit integers occurs on 32-bit architectures.

Signed-off-by: Simon Schuster <schuster.simon@siemens-energy.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
---
 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                  | 8 ++++----
 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 +-
 38 files changed, 59 insertions(+), 59 deletions(-)

diff --git a/block/blk-ioc.c b/block/blk-ioc.c
index 9fda3906e5f5..d15918d7fabb 100644
--- a/block/blk-ioc.c
+++ b/block/blk-ioc.c
@@ -286,7 +286,7 @@ int set_task_ioprio(struct task_struct *task, int ioprio)
 }
 EXPORT_SYMBOL_GPL(set_task_ioprio);
 
-int __copy_io(unsigned long clone_flags, struct task_struct *tsk)
+int __copy_io(u64 clone_flags, struct task_struct *tsk)
 {
 	struct io_context *ioc = current->io_context;
 
diff --git a/fs/namespace.c b/fs/namespace.c
index 4b352a44cb80..0cd875b38552 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -4202,7 +4202,7 @@ static struct mnt_namespace *alloc_mnt_ns(struct user_namespace *user_ns, bool a
 }
 
 __latent_entropy
-struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
+struct mnt_namespace *copy_mnt_ns(u64 flags, struct mnt_namespace *ns,
 		struct user_namespace *user_ns, struct fs_struct *new_fs)
 {
 	struct mnt_namespace *new_ns;
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index ae73dbb19165..15ed7a8f0abb 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -801,7 +801,7 @@ extern struct cgroup_namespace init_cgroup_ns;
 
 void free_cgroup_ns(struct cgroup_namespace *ns);
 
-struct cgroup_namespace *copy_cgroup_ns(unsigned long flags,
+struct cgroup_namespace *copy_cgroup_ns(u64 flags,
 					struct user_namespace *user_ns,
 					struct cgroup_namespace *old_ns);
 
@@ -823,7 +823,7 @@ static inline void put_cgroup_ns(struct cgroup_namespace *ns)
 
 static inline void free_cgroup_ns(struct cgroup_namespace *ns) { }
 static inline struct cgroup_namespace *
-copy_cgroup_ns(unsigned long flags, struct user_namespace *user_ns,
+copy_cgroup_ns(u64 flags, struct user_namespace *user_ns,
 	       struct cgroup_namespace *old_ns)
 {
 	return old_ns;
diff --git a/include/linux/cred.h b/include/linux/cred.h
index a102a10f833f..89ae50ad2ace 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -148,7 +148,7 @@ struct cred {
 
 extern void __put_cred(struct cred *);
 extern void exit_creds(struct task_struct *);
-extern int copy_creds(struct task_struct *, unsigned long);
+extern int copy_creds(struct task_struct *, u64);
 extern const struct cred *get_task_cred(struct task_struct *);
 extern struct cred *cred_alloc_blank(void);
 extern struct cred *prepare_creds(void);
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index 14f7eaf1b443..079d8773790c 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -118,8 +118,8 @@ struct task_struct;
 #ifdef CONFIG_BLOCK
 void put_io_context(struct io_context *ioc);
 void exit_io_context(struct task_struct *task);
-int __copy_io(unsigned long clone_flags, struct task_struct *tsk);
-static inline int copy_io(unsigned long clone_flags, struct task_struct *tsk)
+int __copy_io(u64 clone_flags, struct task_struct *tsk);
+static inline int copy_io(u64 clone_flags, struct task_struct *tsk)
 {
 	if (!current->io_context)
 		return 0;
@@ -129,7 +129,7 @@ static inline int copy_io(unsigned long clone_flags, struct task_struct *tsk)
 struct io_context;
 static inline void put_io_context(struct io_context *ioc) { }
 static inline void exit_io_context(struct task_struct *task) { }
-static inline int copy_io(unsigned long clone_flags, struct task_struct *tsk)
+static inline int copy_io(u64 clone_flags, struct task_struct *tsk)
 {
 	return 0;
 }
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index e8240cf2611a..4b399893e2b3 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -129,7 +129,7 @@ static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; }
 #endif
 
 #if defined(CONFIG_IPC_NS)
-extern struct ipc_namespace *copy_ipcs(unsigned long flags,
+extern struct ipc_namespace *copy_ipcs(u64 flags,
 	struct user_namespace *user_ns, struct ipc_namespace *ns);
 
 static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
@@ -151,7 +151,7 @@ static inline struct ipc_namespace *get_ipc_ns_not_zero(struct ipc_namespace *ns
 
 extern void put_ipc_ns(struct ipc_namespace *ns);
 #else
-static inline struct ipc_namespace *copy_ipcs(unsigned long flags,
+static inline struct ipc_namespace *copy_ipcs(u64 flags,
 	struct user_namespace *user_ns, struct ipc_namespace *ns)
 {
 	if (flags & CLONE_NEWIPC)
diff --git a/include/linux/lsm_hook_defs.h b/include/linux/lsm_hook_defs.h
index fd11fffdd3c3..adbe234a6f6c 100644
--- a/include/linux/lsm_hook_defs.h
+++ b/include/linux/lsm_hook_defs.h
@@ -211,7 +211,7 @@ LSM_HOOK(int, 0, file_open, struct file *file)
 LSM_HOOK(int, 0, file_post_open, struct file *file, int mask)
 LSM_HOOK(int, 0, file_truncate, struct file *file)
 LSM_HOOK(int, 0, task_alloc, struct task_struct *task,
-	 unsigned long clone_flags)
+	 u64 clone_flags)
 LSM_HOOK(void, LSM_RET_VOID, task_free, struct task_struct *task)
 LSM_HOOK(int, 0, cred_alloc_blank, struct cred *cred, gfp_t gfp)
 LSM_HOOK(void, LSM_RET_VOID, cred_free, struct cred *cred)
diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
index 70b366b64816..ff290c87b2e7 100644
--- a/include/linux/mnt_namespace.h
+++ b/include/linux/mnt_namespace.h
@@ -11,7 +11,7 @@ struct fs_struct;
 struct user_namespace;
 struct ns_common;
 
-extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
+extern struct mnt_namespace *copy_mnt_ns(u64, struct mnt_namespace *,
 		struct user_namespace *, struct fs_struct *);
 extern void put_mnt_ns(struct mnt_namespace *ns);
 DEFINE_FREE(put_mnt_ns, struct mnt_namespace *, if (!IS_ERR_OR_NULL(_T)) put_mnt_ns(_T))
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index dab6a1734a22..82533e899ff4 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -103,7 +103,7 @@ static inline struct cred *nsset_cred(struct nsset *set)
  *
  */
 
-int copy_namespaces(unsigned long flags, struct task_struct *tsk);
+int copy_namespaces(u64 flags, struct task_struct *tsk);
 void exit_task_namespaces(struct task_struct *tsk);
 void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new);
 int exec_task_namespaces(void);
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 7c67a5811199..0620a3e08e83 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -78,7 +78,7 @@ static inline int pidns_memfd_noexec_scope(struct pid_namespace *ns)
 }
 #endif
 
-extern struct pid_namespace *copy_pid_ns(unsigned long flags,
+extern struct pid_namespace *copy_pid_ns(u64 flags,
 	struct user_namespace *user_ns, struct pid_namespace *ns);
 extern void zap_pid_ns_processes(struct pid_namespace *pid_ns);
 extern int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd);
@@ -97,7 +97,7 @@ static inline int pidns_memfd_noexec_scope(struct pid_namespace *ns)
 	return 0;
 }
 
-static inline struct pid_namespace *copy_pid_ns(unsigned long flags,
+static inline struct pid_namespace *copy_pid_ns(u64 flags,
 	struct user_namespace *user_ns, struct pid_namespace *ns)
 {
 	if (flags & CLONE_NEWPID)
diff --git a/include/linux/rseq.h b/include/linux/rseq.h
index bc8af3eb5598..a96fd345aa38 100644
--- a/include/linux/rseq.h
+++ b/include/linux/rseq.h
@@ -65,7 +65,7 @@ static inline void rseq_migrate(struct task_struct *t)
  * If parent process has a registered restartable sequences area, the
  * child inherits. Unregister rseq for a clone with CLONE_VM set.
  */
-static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags)
+static inline void rseq_fork(struct task_struct *t, u64 clone_flags)
 {
 	if (clone_flags & CLONE_VM) {
 		t->rseq = NULL;
@@ -107,7 +107,7 @@ static inline void rseq_preempt(struct task_struct *t)
 static inline void rseq_migrate(struct task_struct *t)
 {
 }
-static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags)
+static inline void rseq_fork(struct task_struct *t, u64 clone_flags)
 {
 }
 static inline void rseq_execve(struct task_struct *t)
diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h
index ea41795a352b..34d6a0e108c3 100644
--- a/include/linux/sched/task.h
+++ b/include/linux/sched/task.h
@@ -63,7 +63,7 @@ extern int lockdep_tasklist_lock_is_held(void);
 extern asmlinkage void schedule_tail(struct task_struct *prev);
 extern void init_idle(struct task_struct *idle, int cpu);
 
-extern int sched_fork(unsigned long clone_flags, struct task_struct *p);
+extern int sched_fork(u64 clone_flags, struct task_struct *p);
 extern int sched_cgroup_fork(struct task_struct *p, struct kernel_clone_args *kargs);
 extern void sched_cancel_fork(struct task_struct *p);
 extern void sched_post_fork(struct task_struct *p);
diff --git a/include/linux/security.h b/include/linux/security.h
index 521bcb5b9717..9a1d4a6c8673 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -489,7 +489,7 @@ int security_file_receive(struct file *file);
 int security_file_open(struct file *file);
 int security_file_post_open(struct file *file, int mask);
 int security_file_truncate(struct file *file);
-int security_task_alloc(struct task_struct *task, unsigned long clone_flags);
+int security_task_alloc(struct task_struct *task, u64 clone_flags);
 void security_task_free(struct task_struct *task);
 int security_cred_alloc_blank(struct cred *cred, gfp_t gfp);
 void security_cred_free(struct cred *cred);
@@ -1215,7 +1215,7 @@ static inline int security_file_truncate(struct file *file)
 }
 
 static inline int security_task_alloc(struct task_struct *task,
-				      unsigned long clone_flags)
+				      u64 clone_flags)
 {
 	return 0;
 }
diff --git a/include/linux/sem.h b/include/linux/sem.h
index c4deefe42aeb..275269ce2ec8 100644
--- a/include/linux/sem.h
+++ b/include/linux/sem.h
@@ -9,12 +9,12 @@ struct task_struct;
 
 #ifdef CONFIG_SYSVIPC
 
-extern int copy_semundo(unsigned long clone_flags, struct task_struct *tsk);
+extern int copy_semundo(u64 clone_flags, struct task_struct *tsk);
 extern void exit_sem(struct task_struct *tsk);
 
 #else
 
-static inline int copy_semundo(unsigned long clone_flags, struct task_struct *tsk)
+static inline int copy_semundo(u64 clone_flags, struct task_struct *tsk)
 {
 	return 0;
 }
diff --git a/include/linux/time_namespace.h b/include/linux/time_namespace.h
index bb2c52f4fc94..b6e36525e0be 100644
--- a/include/linux/time_namespace.h
+++ b/include/linux/time_namespace.h
@@ -43,7 +43,7 @@ static inline struct time_namespace *get_time_ns(struct time_namespace *ns)
 	return ns;
 }
 
-struct time_namespace *copy_time_ns(unsigned long flags,
+struct time_namespace *copy_time_ns(u64 flags,
 				    struct user_namespace *user_ns,
 				    struct time_namespace *old_ns);
 void free_time_ns(struct time_namespace *ns);
@@ -129,7 +129,7 @@ static inline void put_time_ns(struct time_namespace *ns)
 }
 
 static inline
-struct time_namespace *copy_time_ns(unsigned long flags,
+struct time_namespace *copy_time_ns(u64 flags,
 				    struct user_namespace *user_ns,
 				    struct time_namespace *old_ns)
 {
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index 516217c39094..915303a82d84 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -205,7 +205,7 @@ extern void uprobe_start_dup_mmap(void);
 extern void uprobe_end_dup_mmap(void);
 extern void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm);
 extern void uprobe_free_utask(struct task_struct *t);
-extern void uprobe_copy_process(struct task_struct *t, unsigned long flags);
+extern void uprobe_copy_process(struct task_struct *t, u64 flags);
 extern int uprobe_post_sstep_notifier(struct pt_regs *regs);
 extern int uprobe_pre_sstep_notifier(struct pt_regs *regs);
 extern void uprobe_notify_resume(struct pt_regs *regs);
@@ -281,7 +281,7 @@ static inline bool uprobe_deny_signal(void)
 static inline void uprobe_free_utask(struct task_struct *t)
 {
 }
-static inline void uprobe_copy_process(struct task_struct *t, unsigned long flags)
+static inline void uprobe_copy_process(struct task_struct *t, u64 flags)
 {
 }
 static inline void uprobe_clear_state(struct mm_struct *mm)
diff --git a/include/linux/user_events.h b/include/linux/user_events.h
index 8afa8c3a0973..57d1ff006090 100644
--- a/include/linux/user_events.h
+++ b/include/linux/user_events.h
@@ -33,7 +33,7 @@ extern void user_event_mm_dup(struct task_struct *t,
 extern void user_event_mm_remove(struct task_struct *t);
 
 static inline void user_events_fork(struct task_struct *t,
-				    unsigned long clone_flags)
+				    u64 clone_flags)
 {
 	struct user_event_mm *old_mm;
 
@@ -68,7 +68,7 @@ static inline void user_events_exit(struct task_struct *t)
 }
 #else
 static inline void user_events_fork(struct task_struct *t,
-				    unsigned long clone_flags)
+				    u64 clone_flags)
 {
 }
 
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index bf7613ba412b..ba34ec0e2f95 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -35,7 +35,7 @@ static inline void get_uts_ns(struct uts_namespace *ns)
 	refcount_inc(&ns->ns.count);
 }
 
-extern struct uts_namespace *copy_utsname(unsigned long flags,
+extern struct uts_namespace *copy_utsname(u64 flags,
 	struct user_namespace *user_ns, struct uts_namespace *old_ns);
 extern void free_uts_ns(struct uts_namespace *ns);
 
@@ -55,7 +55,7 @@ static inline void put_uts_ns(struct uts_namespace *ns)
 {
 }
 
-static inline struct uts_namespace *copy_utsname(unsigned long flags,
+static inline struct uts_namespace *copy_utsname(u64 flags,
 	struct user_namespace *user_ns, struct uts_namespace *old_ns)
 {
 	if (flags & CLONE_NEWUTS)
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 025a7574b275..0e008cfe159d 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -204,7 +204,7 @@ struct net {
 extern struct net init_net;
 
 #ifdef CONFIG_NET_NS
-struct net *copy_net_ns(unsigned long flags, struct user_namespace *user_ns,
+struct net *copy_net_ns(u64 flags, struct user_namespace *user_ns,
 			struct net *old_net);
 
 void net_ns_get_ownership(const struct net *net, kuid_t *uid, kgid_t *gid);
@@ -218,7 +218,7 @@ extern struct task_struct *cleanup_net_task;
 #else /* CONFIG_NET_NS */
 #include <linux/sched.h>
 #include <linux/nsproxy.h>
-static inline struct net *copy_net_ns(unsigned long flags,
+static inline struct net *copy_net_ns(u64 flags,
 	struct user_namespace *user_ns, struct net *old_net)
 {
 	if (flags & CLONE_NEWNET)
diff --git a/include/trace/events/task.h b/include/trace/events/task.h
index af535b053033..4f0759634306 100644
--- a/include/trace/events/task.h
+++ b/include/trace/events/task.h
@@ -8,14 +8,14 @@
 
 TRACE_EVENT(task_newtask,
 
-	TP_PROTO(struct task_struct *task, unsigned long clone_flags),
+	TP_PROTO(struct task_struct *task, u64 clone_flags),
 
 	TP_ARGS(task, clone_flags),
 
 	TP_STRUCT__entry(
 		__field(	pid_t,	pid)
 		__array(	char,	comm, TASK_COMM_LEN)
-		__field( unsigned long, clone_flags)
+		__field(	u64,    clone_flags)
 		__field(	short,	oom_score_adj)
 	),
 
@@ -26,7 +26,7 @@ TRACE_EVENT(task_newtask,
 		__entry->oom_score_adj = task->signal->oom_score_adj;
 	),
 
-	TP_printk("pid=%d comm=%s clone_flags=%lx oom_score_adj=%hd",
+	TP_printk("pid=%d comm=%s clone_flags=%llx oom_score_adj=%hd",
 		__entry->pid, __entry->comm,
 		__entry->clone_flags, __entry->oom_score_adj)
 );
diff --git a/ipc/namespace.c b/ipc/namespace.c
index 4df91ceeeafe..a712ec27209c 100644
--- a/ipc/namespace.c
+++ b/ipc/namespace.c
@@ -106,7 +106,7 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns,
 	return ERR_PTR(err);
 }
 
-struct ipc_namespace *copy_ipcs(unsigned long flags,
+struct ipc_namespace *copy_ipcs(u64 flags,
 	struct user_namespace *user_ns, struct ipc_namespace *ns)
 {
 	if (!(flags & CLONE_NEWIPC))
diff --git a/ipc/sem.c b/ipc/sem.c
index a39cdc7bf88f..0f06e4bd4673 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -2303,7 +2303,7 @@ SYSCALL_DEFINE3(semop, int, semid, struct sembuf __user *, tsops,
  * parent and child tasks.
  */
 
-int copy_semundo(unsigned long clone_flags, struct task_struct *tsk)
+int copy_semundo(u64 clone_flags, struct task_struct *tsk)
 {
 	struct sem_undo_list *undo_list;
 	int error;
diff --git a/kernel/cgroup/namespace.c b/kernel/cgroup/namespace.c
index 144a464e45c6..dedadb525880 100644
--- a/kernel/cgroup/namespace.c
+++ b/kernel/cgroup/namespace.c
@@ -47,7 +47,7 @@ void free_cgroup_ns(struct cgroup_namespace *ns)
 }
 EXPORT_SYMBOL(free_cgroup_ns);
 
-struct cgroup_namespace *copy_cgroup_ns(unsigned long flags,
+struct cgroup_namespace *copy_cgroup_ns(u64 flags,
 					struct user_namespace *user_ns,
 					struct cgroup_namespace *old_ns)
 {
diff --git a/kernel/cred.c b/kernel/cred.c
index 9676965c0981..dbf6b687dc5c 100644
--- a/kernel/cred.c
+++ b/kernel/cred.c
@@ -287,7 +287,7 @@ struct cred *prepare_exec_creds(void)
  * The new process gets the current process's subjective credentials as its
  * objective and subjective credentials
  */
-int copy_creds(struct task_struct *p, unsigned long clone_flags)
+int copy_creds(struct task_struct *p, u64 clone_flags)
 {
 	struct cred *new;
 	int ret;
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 31a12b60055f..aa479d24ccaf 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -2160,7 +2160,7 @@ static void dup_xol_work(struct callback_head *work)
 /*
  * Called in context of a new clone/fork from copy_process.
  */
-void uprobe_copy_process(struct task_struct *t, unsigned long flags)
+void uprobe_copy_process(struct task_struct *t, u64 flags)
 {
 	struct uprobe_task *utask = current->utask;
 	struct mm_struct *mm = current->mm;
diff --git a/kernel/fork.c b/kernel/fork.c
index 82f5d52fecf1..0e9b2dd6c365 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1510,7 +1510,7 @@ static struct mm_struct *dup_mm(struct task_struct *tsk,
 	return NULL;
 }
 
-static int copy_mm(unsigned long clone_flags, struct task_struct *tsk)
+static int copy_mm(u64 clone_flags, struct task_struct *tsk)
 {
 	struct mm_struct *mm, *oldmm;
 
@@ -1548,7 +1548,7 @@ static int copy_mm(unsigned long clone_flags, struct task_struct *tsk)
 	return 0;
 }
 
-static int copy_fs(unsigned long clone_flags, struct task_struct *tsk)
+static int copy_fs(u64 clone_flags, struct task_struct *tsk)
 {
 	struct fs_struct *fs = current->fs;
 	if (clone_flags & CLONE_FS) {
@@ -1569,7 +1569,7 @@ static int copy_fs(unsigned long clone_flags, struct task_struct *tsk)
 	return 0;
 }
 
-static int copy_files(unsigned long clone_flags, struct task_struct *tsk,
+static int copy_files(u64 clone_flags, struct task_struct *tsk,
 		      int no_files)
 {
 	struct files_struct *oldf, *newf;
@@ -1648,7 +1648,7 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig)
 	posix_cputimers_group_init(pct, cpu_limit);
 }
 
-static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
+static int copy_signal(u64 clone_flags, struct task_struct *tsk)
 {
 	struct signal_struct *sig;
 
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c
index 5f31fdff8a38..8af3b9ec3aa8 100644
--- a/kernel/nsproxy.c
+++ b/kernel/nsproxy.c
@@ -64,7 +64,7 @@ static inline struct nsproxy *create_nsproxy(void)
  * Return the newly created nsproxy.  Do not attach this to the task,
  * leave it to the caller to do proper locking and attach it to task.
  */
-static struct nsproxy *create_new_namespaces(unsigned long flags,
+static struct nsproxy *create_new_namespaces(u64 flags,
 	struct task_struct *tsk, struct user_namespace *user_ns,
 	struct fs_struct *new_fs)
 {
@@ -144,7 +144,7 @@ static struct nsproxy *create_new_namespaces(unsigned long flags,
  * called from clone.  This now handles copy for nsproxy and all
  * namespaces therein.
  */
-int copy_namespaces(unsigned long flags, struct task_struct *tsk)
+int copy_namespaces(u64 flags, struct task_struct *tsk)
 {
 	struct nsproxy *old_ns = tsk->nsproxy;
 	struct user_namespace *user_ns = task_cred_xxx(tsk, user_ns);
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c
index 7098ed44e717..06bc7c7f78e0 100644
--- a/kernel/pid_namespace.c
+++ b/kernel/pid_namespace.c
@@ -171,7 +171,7 @@ static void destroy_pid_namespace_work(struct work_struct *work)
 	} while (ns != &init_pid_ns && refcount_dec_and_test(&ns->ns.count));
 }
 
-struct pid_namespace *copy_pid_ns(unsigned long flags,
+struct pid_namespace *copy_pid_ns(u64 flags,
 	struct user_namespace *user_ns, struct pid_namespace *old_ns)
 {
 	if (!(flags & CLONE_NEWPID))
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index be00629f0ba4..6fa85d30d965 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4472,7 +4472,7 @@ int wake_up_state(struct task_struct *p, unsigned int state)
  * __sched_fork() is basic setup which is also used by sched_init() to
  * initialize the boot CPU's idle task.
  */
-static void __sched_fork(unsigned long clone_flags, struct task_struct *p)
+static void __sched_fork(u64 clone_flags, struct task_struct *p)
 {
 	p->on_rq			= 0;
 
@@ -4707,7 +4707,7 @@ late_initcall(sched_core_sysctl_init);
 /*
  * fork()/clone()-time setup:
  */
-int sched_fork(unsigned long clone_flags, struct task_struct *p)
+int sched_fork(u64 clone_flags, struct task_struct *p)
 {
 	__sched_fork(clone_flags, p);
 	/*
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index e256793b9a08..06bcba61ca75 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3542,7 +3542,7 @@ static void task_numa_work(struct callback_head *work)
 	}
 }
 
-void init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
+void init_numa_balancing(u64 clone_flags, struct task_struct *p)
 {
 	int mm_users = 0;
 	struct mm_struct *mm = p->mm;
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index be9745d104f7..f9adfc912ddc 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1935,12 +1935,12 @@ extern void sched_setnuma(struct task_struct *p, int node);
 extern int migrate_task_to(struct task_struct *p, int cpu);
 extern int migrate_swap(struct task_struct *p, struct task_struct *t,
 			int cpu, int scpu);
-extern void init_numa_balancing(unsigned long clone_flags, struct task_struct *p);
+extern void init_numa_balancing(u64 clone_flags, struct task_struct *p);
 
 #else /* !CONFIG_NUMA_BALANCING: */
 
 static inline void
-init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
+init_numa_balancing(u64 clone_flags, struct task_struct *p)
 {
 }
 
diff --git a/kernel/time/namespace.c b/kernel/time/namespace.c
index 667452768ed3..888872bcc5bb 100644
--- a/kernel/time/namespace.c
+++ b/kernel/time/namespace.c
@@ -130,7 +130,7 @@ static struct time_namespace *clone_time_ns(struct user_namespace *user_ns,
  *
  * Return: timens_for_children namespace or ERR_PTR.
  */
-struct time_namespace *copy_time_ns(unsigned long flags,
+struct time_namespace *copy_time_ns(u64 flags,
 	struct user_namespace *user_ns, struct time_namespace *old_ns)
 {
 	if (!(flags & CLONE_NEWTIME))
diff --git a/kernel/utsname.c b/kernel/utsname.c
index b1ac3ca870f2..00d8d7922f86 100644
--- a/kernel/utsname.c
+++ b/kernel/utsname.c
@@ -86,7 +86,7 @@ static struct uts_namespace *clone_uts_ns(struct user_namespace *user_ns,
  * utsname of this process won't be seen by parent, and vice
  * versa.
  */
-struct uts_namespace *copy_utsname(unsigned long flags,
+struct uts_namespace *copy_utsname(u64 flags,
 	struct user_namespace *user_ns, struct uts_namespace *old_ns)
 {
 	struct uts_namespace *new_ns;
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 1b6f3826dd0e..8ec9d83475bf 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -539,7 +539,7 @@ void net_drop_ns(void *p)
 		net_passive_dec(net);
 }
 
-struct net *copy_net_ns(unsigned long flags,
+struct net *copy_net_ns(u64 flags,
 			struct user_namespace *user_ns, struct net *old_net)
 {
 	struct ucounts *ucounts;
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
index 8e1cc229b41b..ba39cfe0cd08 100644
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -112,7 +112,7 @@ static void apparmor_task_free(struct task_struct *task)
 }
 
 static int apparmor_task_alloc(struct task_struct *task,
-			       unsigned long clone_flags)
+			       u64 clone_flags)
 {
 	struct aa_task_ctx *new = task_ctx(task);
 
diff --git a/security/security.c b/security/security.c
index ca126b02d2fe..d5fea03a741a 100644
--- a/security/security.c
+++ b/security/security.c
@@ -3224,7 +3224,7 @@ int security_file_truncate(struct file *file)
  *
  * Return: Returns a zero on success, negative values on failure.
  */
-int security_task_alloc(struct task_struct *task, unsigned long clone_flags)
+int security_task_alloc(struct task_struct *task, u64 clone_flags)
 {
 	int rc = lsm_task_alloc(task);
 
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index f94642ca34f2..9d3b5ebd7657 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -4144,7 +4144,7 @@ static int selinux_file_open(struct file *file)
 /* task security operations */
 
 static int selinux_task_alloc(struct task_struct *task,
-			      unsigned long clone_flags)
+			      u64 clone_flags)
 {
 	u32 sid = current_sid();
 
diff --git a/security/tomoyo/tomoyo.c b/security/tomoyo/tomoyo.c
index d6ebcd9db80a..48fc59d38ab2 100644
--- a/security/tomoyo/tomoyo.c
+++ b/security/tomoyo/tomoyo.c
@@ -514,7 +514,7 @@ struct lsm_blob_sizes tomoyo_blob_sizes __ro_after_init = {
  * Returns 0.
  */
 static int tomoyo_task_alloc(struct task_struct *task,
-			     unsigned long clone_flags)
+			     u64 clone_flags)
 {
 	struct tomoyo_task *old = tomoyo_task(current);
 	struct tomoyo_task *new = tomoyo_task(task);

-- 
2.39.5



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 3/4] arch: copy_thread: pass clone_flags as 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 ` [PATCH v2 1/4] copy_sighand: Handle architectures where sizeof(unsigned long) < sizeof(u64) Simon Schuster via B4 Relay
  2025-09-01 13:09 ` [PATCH v2 2/4] copy_process: pass clone_flags as u64 across calltree Simon Schuster via B4 Relay
@ 2025-09-01 13:09 ` Simon Schuster via B4 Relay
  2025-09-01 13:30   ` Arnd Bergmann
                     ` (5 more replies)
  2025-09-01 13:09 ` [PATCH v2 4/4] nios2: implement architecture-specific portion of sys_clone3 Simon Schuster via B4 Relay
                   ` (2 subsequent siblings)
  5 siblings, 6 replies; 20+ 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

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, with a new type of u64 for the flags.
However, for most consumers of clone_flags the interface was not
changed from the previous type of unsigned long.

While this works fine as long as none of the new 64-bit flag bits
(CLONE_CLEAR_SIGHAND and CLONE_INTO_CGROUP) are evaluated, this is still
undesirable in terms of the principle of least surprise.

Thus, this commit fixes all relevant interfaces of the copy_thread
function that is called from copy_process to consistently pass
clone_flags as u64, so that no truncation to 32-bit integers occurs on
32-bit architectures.

Signed-off-by: Simon Schuster <schuster.simon@siemens-energy.com>
---
 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/kernel/process.c      | 2 +-
 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 +-
 26 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index 582d96548385..06522451f018 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -231,7 +231,7 @@ flush_thread(void)
  */
 int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 {
-	unsigned long clone_flags = args->flags;
+	u64 clone_flags = args->flags;
 	unsigned long usp = args->stack;
 	unsigned long tls = args->tls;
 	extern void ret_from_fork(void);
diff --git a/arch/arc/kernel/process.c b/arch/arc/kernel/process.c
index 186ceab661eb..8166d0908713 100644
--- a/arch/arc/kernel/process.c
+++ b/arch/arc/kernel/process.c
@@ -166,7 +166,7 @@ asmlinkage void ret_from_fork(void);
  */
 int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 {
-	unsigned long clone_flags = args->flags;
+	u64 clone_flags = args->flags;
 	unsigned long usp = args->stack;
 	unsigned long tls = args->tls;
 	struct pt_regs *c_regs;        /* child's pt_regs */
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index e16ed102960c..d7aa95225c70 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -234,7 +234,7 @@ asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
 
 int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 {
-	unsigned long clone_flags = args->flags;
+	u64 clone_flags = args->flags;
 	unsigned long stack_start = args->stack;
 	unsigned long tls = args->tls;
 	struct thread_info *thread = task_thread_info(p);
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 96482a1412c6..fba7ca102a8c 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -409,7 +409,7 @@ asmlinkage void ret_from_fork(void) asm("ret_from_fork");
 
 int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 {
-	unsigned long clone_flags = args->flags;
+	u64 clone_flags = args->flags;
 	unsigned long stack_start = args->stack;
 	unsigned long tls = args->tls;
 	struct pt_regs *childregs = task_pt_regs(p);
diff --git a/arch/csky/kernel/process.c b/arch/csky/kernel/process.c
index 0c6e4b17fe00..a7a90340042a 100644
--- a/arch/csky/kernel/process.c
+++ b/arch/csky/kernel/process.c
@@ -32,7 +32,7 @@ void flush_thread(void){}
 
 int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 {
-	unsigned long clone_flags = args->flags;
+	u64 clone_flags = args->flags;
 	unsigned long usp = args->stack;
 	unsigned long tls = args->tls;
 	struct switch_stack *childstack;
diff --git a/arch/hexagon/kernel/process.c b/arch/hexagon/kernel/process.c
index 2a77bfd75694..15b4992bfa29 100644
--- a/arch/hexagon/kernel/process.c
+++ b/arch/hexagon/kernel/process.c
@@ -52,7 +52,7 @@ void arch_cpu_idle(void)
  */
 int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 {
-	unsigned long clone_flags = args->flags;
+	u64 clone_flags = args->flags;
 	unsigned long usp = args->stack;
 	unsigned long tls = args->tls;
 	struct thread_info *ti = task_thread_info(p);
diff --git a/arch/loongarch/kernel/process.c b/arch/loongarch/kernel/process.c
index 3582f591bab2..efd9edf65603 100644
--- a/arch/loongarch/kernel/process.c
+++ b/arch/loongarch/kernel/process.c
@@ -167,7 +167,7 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 	unsigned long childksp;
 	unsigned long tls = args->tls;
 	unsigned long usp = args->stack;
-	unsigned long clone_flags = args->flags;
+	u64 clone_flags = args->flags;
 	struct pt_regs *childregs, *regs = current_pt_regs();
 
 	childksp = (unsigned long)task_stack_page(p) + THREAD_SIZE;
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index fda7eac23f87..f5a07a70e938 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -141,7 +141,7 @@ asmlinkage int m68k_clone3(struct pt_regs *regs)
 
 int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 {
-	unsigned long clone_flags = args->flags;
+	u64 clone_flags = args->flags;
 	unsigned long usp = args->stack;
 	unsigned long tls = args->tls;
 	struct fork_frame {
diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
index 56342e11442d..6cbf642d7b80 100644
--- a/arch/microblaze/kernel/process.c
+++ b/arch/microblaze/kernel/process.c
@@ -54,7 +54,7 @@ void flush_thread(void)
 
 int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 {
-	unsigned long clone_flags = args->flags;
+	u64 clone_flags = args->flags;
 	unsigned long usp = args->stack;
 	unsigned long tls = args->tls;
 	struct pt_regs *childregs = task_pt_regs(p);
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 02aa6a04a21d..29191fa1801e 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -107,7 +107,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
  */
 int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 {
-	unsigned long clone_flags = args->flags;
+	u64 clone_flags = args->flags;
 	unsigned long usp = args->stack;
 	unsigned long tls = args->tls;
 	struct thread_info *ti = task_thread_info(p);
diff --git a/arch/nios2/kernel/process.c b/arch/nios2/kernel/process.c
index f84021303f6a..151404139085 100644
--- a/arch/nios2/kernel/process.c
+++ b/arch/nios2/kernel/process.c
@@ -101,7 +101,7 @@ void flush_thread(void)
 
 int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 {
-	unsigned long clone_flags = args->flags;
+	u64 clone_flags = args->flags;
 	unsigned long usp = args->stack;
 	unsigned long tls = args->tls;
 	struct pt_regs *childregs = task_pt_regs(p);
diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c
index eef99fee2110..73ffb9fa3118 100644
--- a/arch/openrisc/kernel/process.c
+++ b/arch/openrisc/kernel/process.c
@@ -165,7 +165,7 @@ extern asmlinkage void ret_from_fork(void);
 int
 copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 {
-	unsigned long clone_flags = args->flags;
+	u64 clone_flags = args->flags;
 	unsigned long usp = args->stack;
 	unsigned long tls = args->tls;
 	struct pt_regs *userregs;
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index ed93bd8c1545..e64ab5d2a40d 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -201,7 +201,7 @@ arch_initcall(parisc_idle_init);
 int
 copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 {
-	unsigned long clone_flags = args->flags;
+	u64 clone_flags = args->flags;
 	unsigned long usp = args->stack;
 	unsigned long tls = args->tls;
 	struct pt_regs *cregs = &(p->thread.regs);
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 855e09886503..eb23966ac0a9 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1805,7 +1805,7 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 			f = ret_from_kernel_user_thread;
 		} else {
 			struct pt_regs *regs = current_pt_regs();
-			unsigned long clone_flags = args->flags;
+			u64 clone_flags = args->flags;
 			unsigned long usp = args->stack;
 
 			/* Copy registers */
diff --git a/arch/riscv/kernel/process.c b/arch/riscv/kernel/process.c
index a0a40889d79a..31a392993cb4 100644
--- a/arch/riscv/kernel/process.c
+++ b/arch/riscv/kernel/process.c
@@ -223,7 +223,7 @@ asmlinkage void ret_from_fork_user(struct pt_regs *regs)
 
 int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 {
-	unsigned long clone_flags = args->flags;
+	u64 clone_flags = args->flags;
 	unsigned long usp = args->stack;
 	unsigned long tls = args->tls;
 	struct pt_regs *childregs = task_pt_regs(p);
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index f55f09cda6f8..b107dbca4ed7 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -106,7 +106,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
 
 int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 {
-	unsigned long clone_flags = args->flags;
+	u64 clone_flags = args->flags;
 	unsigned long new_stackp = args->stack;
 	unsigned long tls = args->tls;
 	struct fake_frame
diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c
index 92b6649d4929..62f753a85b89 100644
--- a/arch/sh/kernel/process_32.c
+++ b/arch/sh/kernel/process_32.c
@@ -89,7 +89,7 @@ asmlinkage void ret_from_kernel_thread(void);
 
 int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 {
-	unsigned long clone_flags = args->flags;
+	u64 clone_flags = args->flags;
 	unsigned long usp = args->stack;
 	unsigned long tls = args->tls;
 	struct thread_info *ti = task_thread_info(p);
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index 9c7c662cb565..5a28c0e91bf1 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -260,7 +260,7 @@ extern void ret_from_kernel_thread(void);
 
 int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 {
-	unsigned long clone_flags = args->flags;
+	u64 clone_flags = args->flags;
 	unsigned long sp = args->stack;
 	unsigned long tls = args->tls;
 	struct thread_info *ti = task_thread_info(p);
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index 529adfecd58c..25781923788a 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -567,7 +567,7 @@ void fault_in_user_windows(struct pt_regs *regs)
  */
 int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 {
-	unsigned long clone_flags = args->flags;
+	u64 clone_flags = args->flags;
 	unsigned long sp = args->stack;
 	unsigned long tls = args->tls;
 	struct thread_info *t = task_thread_info(p);
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index 1be644de9e41..9c9c66dc45f0 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -143,7 +143,7 @@ static void fork_handler(void)
 
 int copy_thread(struct task_struct * p, const struct kernel_clone_args *args)
 {
-	unsigned long clone_flags = args->flags;
+	u64 clone_flags = args->flags;
 	unsigned long sp = args->stack;
 	unsigned long tls = args->tls;
 	void (*handler)(void);
diff --git a/arch/x86/include/asm/fpu/sched.h b/arch/x86/include/asm/fpu/sched.h
index c060549c6c94..89004f4ca208 100644
--- a/arch/x86/include/asm/fpu/sched.h
+++ b/arch/x86/include/asm/fpu/sched.h
@@ -11,7 +11,7 @@
 
 extern void save_fpregs_to_fpstate(struct fpu *fpu);
 extern void fpu__drop(struct task_struct *tsk);
-extern int  fpu_clone(struct task_struct *dst, unsigned long clone_flags, bool minimal,
+extern int  fpu_clone(struct task_struct *dst, u64 clone_flags, bool minimal,
 		      unsigned long shstk_addr);
 extern void fpu_flush_thread(void);
 
diff --git a/arch/x86/include/asm/shstk.h b/arch/x86/include/asm/shstk.h
index ba6f2fe43848..0f50e0125943 100644
--- a/arch/x86/include/asm/shstk.h
+++ b/arch/x86/include/asm/shstk.h
@@ -16,7 +16,7 @@ struct thread_shstk {
 
 long shstk_prctl(struct task_struct *task, int option, unsigned long arg2);
 void reset_thread_features(void);
-unsigned long shstk_alloc_thread_stack(struct task_struct *p, unsigned long clone_flags,
+unsigned long shstk_alloc_thread_stack(struct task_struct *p, u64 clone_flags,
 				       unsigned long stack_size);
 void shstk_free(struct task_struct *p);
 int setup_signal_shadow_stack(struct ksignal *ksig);
@@ -28,7 +28,7 @@ static inline long shstk_prctl(struct task_struct *task, int option,
 			       unsigned long arg2) { return -EINVAL; }
 static inline void reset_thread_features(void) {}
 static inline unsigned long shstk_alloc_thread_stack(struct task_struct *p,
-						     unsigned long clone_flags,
+						     u64 clone_flags,
 						     unsigned long stack_size) { return 0; }
 static inline void shstk_free(struct task_struct *p) {}
 static inline int setup_signal_shadow_stack(struct ksignal *ksig) { return 0; }
diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
index aefd412a23dc..1f71cc135e9a 100644
--- a/arch/x86/kernel/fpu/core.c
+++ b/arch/x86/kernel/fpu/core.c
@@ -631,7 +631,7 @@ static int update_fpu_shstk(struct task_struct *dst, unsigned long ssp)
 }
 
 /* Clone current's FPU state on fork */
-int fpu_clone(struct task_struct *dst, unsigned long clone_flags, bool minimal,
+int fpu_clone(struct task_struct *dst, u64 clone_flags, bool minimal,
 	      unsigned long ssp)
 {
 	/*
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 1b7960cf6eb0..e3a3987b0c4f 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -159,7 +159,7 @@ __visible void ret_from_fork(struct task_struct *prev, struct pt_regs *regs,
 
 int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 {
-	unsigned long clone_flags = args->flags;
+	u64 clone_flags = args->flags;
 	unsigned long sp = args->stack;
 	unsigned long tls = args->tls;
 	struct inactive_task_frame *frame;
diff --git a/arch/x86/kernel/shstk.c b/arch/x86/kernel/shstk.c
index 2ddf23387c7e..5eba6c5a6775 100644
--- a/arch/x86/kernel/shstk.c
+++ b/arch/x86/kernel/shstk.c
@@ -191,7 +191,7 @@ void reset_thread_features(void)
 	current->thread.features_locked = 0;
 }
 
-unsigned long shstk_alloc_thread_stack(struct task_struct *tsk, unsigned long clone_flags,
+unsigned long shstk_alloc_thread_stack(struct task_struct *tsk, u64 clone_flags,
 				       unsigned long stack_size)
 {
 	struct thread_shstk *shstk = &tsk->thread.shstk;
diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
index 7bd66677f7b6..94d43f44be13 100644
--- a/arch/xtensa/kernel/process.c
+++ b/arch/xtensa/kernel/process.c
@@ -267,7 +267,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
 
 int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 {
-	unsigned long clone_flags = args->flags;
+	u64 clone_flags = args->flags;
 	unsigned long usp_thread_fn = args->stack;
 	unsigned long tls = args->tls;
 	struct pt_regs *childregs = task_pt_regs(p);

-- 
2.39.5



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 4/4] nios2: implement architecture-specific portion of sys_clone3
  2025-09-01 13:09 [PATCH v2 0/4] nios2: Add architecture support for clone3 Simon Schuster via B4 Relay
                   ` (2 preceding siblings ...)
  2025-09-01 13:09 ` [PATCH v2 3/4] arch: copy_thread: pass clone_flags as u64 Simon Schuster via B4 Relay
@ 2025-09-01 13:09 ` Simon Schuster via B4 Relay
  2025-09-01 13:35   ` Arnd Bergmann
  2025-09-01 13:40 ` [PATCH v2 0/4] nios2: Add architecture support for clone3 Christian Brauner
  2025-09-01 13:41 ` Christian Brauner
  5 siblings, 1 reply; 20+ 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

From: Simon Schuster <schuster.simon@siemens-energy.com>

This commit adds the sys_clone3 entry point for nios2. An
architecture-specific wrapper (__sys_clone3) is required to save and
restore additional registers to the kernel stack via SAVE_SWITCH_STACK
and RESTORE_SWITCH_STACK.

Signed-off-by: Simon Schuster <schuster.simon@siemens-energy.com>
---
 arch/nios2/include/asm/syscalls.h | 1 +
 arch/nios2/include/asm/unistd.h   | 2 --
 arch/nios2/kernel/entry.S         | 6 ++++++
 arch/nios2/kernel/syscall_table.c | 1 +
 4 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/nios2/include/asm/syscalls.h b/arch/nios2/include/asm/syscalls.h
index b4d4ed3bf9c8..0e214b0a0ac8 100644
--- a/arch/nios2/include/asm/syscalls.h
+++ b/arch/nios2/include/asm/syscalls.h
@@ -7,6 +7,7 @@
 
 int sys_cacheflush(unsigned long addr, unsigned long len,
 				unsigned int op);
+asmlinkage long __sys_clone3(struct clone_args __user *uargs, size_t size);
 
 #include <asm-generic/syscalls.h>
 
diff --git a/arch/nios2/include/asm/unistd.h b/arch/nios2/include/asm/unistd.h
index 1146e56473c5..213f6de3cf7b 100644
--- a/arch/nios2/include/asm/unistd.h
+++ b/arch/nios2/include/asm/unistd.h
@@ -7,6 +7,4 @@
 #define __ARCH_WANT_STAT64
 #define __ARCH_WANT_SET_GET_RLIMIT
 
-#define __ARCH_BROKEN_SYS_CLONE3
-
 #endif
diff --git a/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S
index 99f0a65e6234..dd40dfd908e5 100644
--- a/arch/nios2/kernel/entry.S
+++ b/arch/nios2/kernel/entry.S
@@ -403,6 +403,12 @@ ENTRY(sys_clone)
 	addi    sp, sp, 4
 	RESTORE_SWITCH_STACK
 	ret
+/* long syscall(SYS_clone3, struct clone_args *cl_args, size_t size); */
+ENTRY(__sys_clone3)
+	SAVE_SWITCH_STACK
+	call	sys_clone3
+	RESTORE_SWITCH_STACK
+	ret
 
 ENTRY(sys_rt_sigreturn)
 	SAVE_SWITCH_STACK
diff --git a/arch/nios2/kernel/syscall_table.c b/arch/nios2/kernel/syscall_table.c
index 434694067d8f..c99818aac9e1 100644
--- a/arch/nios2/kernel/syscall_table.c
+++ b/arch/nios2/kernel/syscall_table.c
@@ -13,6 +13,7 @@
 #define __SYSCALL_WITH_COMPAT(nr, native, compat)        __SYSCALL(nr, native)
 
 #define sys_mmap2 sys_mmap_pgoff
+#define sys_clone3 __sys_clone3
 
 void *sys_call_table[__NR_syscalls] = {
 	[0 ... __NR_syscalls-1] = sys_ni_syscall,

-- 
2.39.5



^ permalink raw reply related	[flat|nested] 20+ 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; 20+ 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] 20+ 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; 20+ 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] 20+ messages in thread

* Re: [PATCH v2 3/4] arch: copy_thread: pass clone_flags as u64
  2025-09-01 13:09 ` [PATCH v2 3/4] arch: copy_thread: pass clone_flags as u64 Simon Schuster via B4 Relay
@ 2025-09-01 13:30   ` Arnd Bergmann
  2025-09-01 13:39   ` Russell King (Oracle)
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 20+ messages in thread
From: Arnd Bergmann @ 2025-09-01 13:30 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

On Mon, Sep 1, 2025, at 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, with a new type of u64 for the flags.
> However, for most consumers of clone_flags the interface was not
> changed from the previous type of unsigned long.
>
> While this works fine as long as none of the new 64-bit flag bits
> (CLONE_CLEAR_SIGHAND and CLONE_INTO_CGROUP) are evaluated, this is still
> undesirable in terms of the principle of least surprise.
>
> Thus, this commit fixes all relevant interfaces of the copy_thread
> function that is called from copy_process to consistently pass
> clone_flags as u64, so that no truncation to 32-bit integers occurs on
> 32-bit architectures.
>
> Signed-off-by: Simon Schuster <schuster.simon@siemens-energy.com>

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 2/4] copy_process: pass clone_flags as u64 across calltree
  2025-09-01 13:09 ` [PATCH v2 2/4] copy_process: pass clone_flags as u64 across calltree Simon Schuster via B4 Relay
@ 2025-09-01 13:35   ` Arnd Bergmann
  2025-09-01 13:38   ` David Hildenbrand
  1 sibling, 0 replies; 20+ messages in thread
From: Arnd Bergmann @ 2025-09-01 13:35 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

On Mon, Sep 1, 2025, at 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, with a new type of u64 for the flags.
> However, for most consumers of clone_flags the interface was not
> changed from the previous type of unsigned long.
>
> While this works fine as long as none of the new 64-bit flag bits
> (CLONE_CLEAR_SIGHAND and CLONE_INTO_CGROUP) are evaluated, this is still
> undesirable in terms of the principle of least surprise.
>
> Thus, this commit fixes all relevant interfaces of callees to
> sys_clone3/copy_process (excluding the architecture-specific
> copy_thread) to consistently pass clone_flags as u64, so that
> no truncation to 32-bit integers occurs on 32-bit architectures.
>
> 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] 20+ messages in thread

* Re: [PATCH v2 4/4] nios2: implement architecture-specific portion of sys_clone3
  2025-09-01 13:09 ` [PATCH v2 4/4] nios2: implement architecture-specific portion of sys_clone3 Simon Schuster via B4 Relay
@ 2025-09-01 13:35   ` Arnd Bergmann
  0 siblings, 0 replies; 20+ messages in thread
From: Arnd Bergmann @ 2025-09-01 13:35 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

On Mon, Sep 1, 2025, at 15:09, Simon Schuster via B4 Relay wrote:
> From: Simon Schuster <schuster.simon@siemens-energy.com>
>
> This commit adds the sys_clone3 entry point for nios2. An
> architecture-specific wrapper (__sys_clone3) is required to save and
> restore additional registers to the kernel stack via SAVE_SWITCH_STACK
> and RESTORE_SWITCH_STACK.
>
> Signed-off-by: Simon Schuster <schuster.simon@siemens-energy.com>

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 2/4] copy_process: pass clone_flags as u64 across calltree
  2025-09-01 13:09 ` [PATCH v2 2/4] copy_process: pass clone_flags as u64 across calltree Simon Schuster via B4 Relay
  2025-09-01 13:35   ` Arnd Bergmann
@ 2025-09-01 13:38   ` David Hildenbrand
  1 sibling, 0 replies; 20+ messages in thread
From: David Hildenbrand @ 2025-09-01 13:38 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

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, with a new type of u64 for the flags.
> However, for most consumers of clone_flags the interface was not
> changed from the previous type of unsigned long.
> 
> While this works fine as long as none of the new 64-bit flag bits
> (CLONE_CLEAR_SIGHAND and CLONE_INTO_CGROUP) are evaluated, this is still
> undesirable in terms of the principle of least surprise.
> 
> Thus, this commit fixes all relevant interfaces of callees to
> sys_clone3/copy_process (excluding the architecture-specific
> copy_thread) to consistently pass clone_flags as u64, so that
> no truncation to 32-bit integers occurs on 32-bit architectures.
> 
> Signed-off-by: Simon Schuster <schuster.simon@siemens-energy.com>
> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
>   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                  | 8 ++++----
>   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 +-
>   38 files changed, 59 insertions(+), 59 deletions(-)
> 
> diff --git a/block/blk-ioc.c b/block/blk-ioc.c
> index 9fda3906e5f5..d15918d7fabb 100644
> --- a/block/blk-ioc.c

(adjust To: list)

Hopefully we caught most of them. The ones not called "clone_flags" are 
a bit nasty.

We could have split of some changes (e.g., trace event), but likely not 
worth  it.

Thanks!

Acked-by: David Hildenbrand <david@redhat.com>

-- 
Cheers

David / dhildenb


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 3/4] arch: copy_thread: pass clone_flags as u64
  2025-09-01 13:09 ` [PATCH v2 3/4] arch: copy_thread: pass clone_flags as u64 Simon Schuster via B4 Relay
  2025-09-01 13:30   ` Arnd Bergmann
@ 2025-09-01 13:39   ` Russell King (Oracle)
  2025-09-01 13:39   ` David Hildenbrand
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 20+ messages in thread
From: Russell King (Oracle) @ 2025-09-01 13:39 UTC (permalink / raw)
  To: schuster.simon
  Cc: 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,
	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

On Mon, Sep 01, 2025 at 03:09:52PM +0200, Simon Schuster via B4 Relay wrote:
> diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
> index e16ed102960c..d7aa95225c70 100644
> --- a/arch/arm/kernel/process.c
> +++ b/arch/arm/kernel/process.c
> @@ -234,7 +234,7 @@ asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
>  
>  int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>  {
> -	unsigned long clone_flags = args->flags;
> +	u64 clone_flags = args->flags;
>  	unsigned long stack_start = args->stack;
>  	unsigned long tls = args->tls;
>  	struct thread_info *thread = task_thread_info(p);

We only have one user of clone_flags in this function, which is:

        if (clone_flags & CLONE_SETTLS)

I would much rather clone_flags was removed, and this changed to:

	if (args->flags & CLONE_SETTLS)

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 3/4] arch: copy_thread: pass clone_flags as u64
  2025-09-01 13:09 ` [PATCH v2 3/4] arch: copy_thread: pass clone_flags as u64 Simon Schuster via B4 Relay
  2025-09-01 13:30   ` Arnd Bergmann
  2025-09-01 13:39   ` Russell King (Oracle)
@ 2025-09-01 13:39   ` David Hildenbrand
  2025-09-01 13:51   ` Geert Uytterhoeven
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 20+ messages in thread
From: David Hildenbrand @ 2025-09-01 13:39 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

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, with a new type of u64 for the flags.
> However, for most consumers of clone_flags the interface was not
> changed from the previous type of unsigned long.
> 
> While this works fine as long as none of the new 64-bit flag bits
> (CLONE_CLEAR_SIGHAND and CLONE_INTO_CGROUP) are evaluated, this is still
> undesirable in terms of the principle of least surprise.
> 
> Thus, this commit fixes all relevant interfaces of the copy_thread
> function that is called from copy_process to consistently pass
> clone_flags as u64, so that no truncation to 32-bit integers occurs on
> 32-bit architectures.
> 
> Signed-off-by: Simon Schuster <schuster.simon@siemens-energy.com>
> ---
>   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/kernel/process.c      | 2 +-
>   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 +-
>   26 files changed, 27 insertions(+), 27 deletions(-)
> 

(Adjust To: list)

Thanks!

Acked-by: David Hildenbrand <david@redhat.com>

-- 
Cheers

David / dhildenb


^ permalink raw reply	[flat|nested] 20+ 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
                   ` (3 preceding siblings ...)
  2025-09-01 13:09 ` [PATCH v2 4/4] nios2: implement architecture-specific portion of sys_clone3 Simon Schuster via B4 Relay
@ 2025-09-01 13:40 ` Christian Brauner
  2025-09-01 13:41 ` Christian Brauner
  5 siblings, 0 replies; 20+ 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] 20+ 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
                   ` (4 preceding siblings ...)
  2025-09-01 13:40 ` [PATCH v2 0/4] nios2: Add architecture support for clone3 Christian Brauner
@ 2025-09-01 13:41 ` Christian Brauner
  5 siblings, 0 replies; 20+ 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] 20+ messages in thread

* Re: [PATCH v2 3/4] arch: copy_thread: pass clone_flags as u64
  2025-09-01 13:09 ` [PATCH v2 3/4] arch: copy_thread: pass clone_flags as u64 Simon Schuster via B4 Relay
                     ` (2 preceding siblings ...)
  2025-09-01 13:39   ` David Hildenbrand
@ 2025-09-01 13:51   ` Geert Uytterhoeven
  2025-09-02  7:02   ` Andreas Larsson
  2025-09-02  9:48   ` Guo Ren
  5 siblings, 0 replies; 20+ messages in thread
From: Geert Uytterhoeven @ 2025-09-01 13:51 UTC (permalink / raw)
  To: schuster.simon
  Cc: 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, 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

On Mon, 1 Sept 2025 at 15:10, Simon Schuster via B4 Relay
<devnull+schuster.simon.siemens-energy.com@kernel.org> 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, with a new type of u64 for the flags.
> However, for most consumers of clone_flags the interface was not
> changed from the previous type of unsigned long.
>
> While this works fine as long as none of the new 64-bit flag bits
> (CLONE_CLEAR_SIGHAND and CLONE_INTO_CGROUP) are evaluated, this is still
> undesirable in terms of the principle of least surprise.
>
> Thus, this commit fixes all relevant interfaces of the copy_thread
> function that is called from copy_process to consistently pass
> clone_flags as u64, so that no truncation to 32-bit integers occurs on
> 32-bit architectures.
>
> Signed-off-by: Simon Schuster <schuster.simon@siemens-energy.com>

Fixes: c5febea0956fd387 ("fork: Pass struct kernel_clone_args into copy_thread")

>  arch/m68k/kernel/process.c       | 2 +-

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # m68k

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 3/4] arch: copy_thread: pass clone_flags as u64
  2025-09-01 13:09 ` [PATCH v2 3/4] arch: copy_thread: pass clone_flags as u64 Simon Schuster via B4 Relay
                     ` (3 preceding siblings ...)
  2025-09-01 13:51   ` Geert Uytterhoeven
@ 2025-09-02  7:02   ` Andreas Larsson
  2025-09-02  7:15     ` John Paul Adrian Glaubitz
  2025-09-02  9:48   ` Guo Ren
  5 siblings, 1 reply; 20+ messages in thread
From: Andreas Larsson @ 2025-09-02  7:02 UTC (permalink / raw)
  To: schuster.simon, 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,
	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

On 2025-09-01 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, with a new type of u64 for the flags.
> However, for most consumers of clone_flags the interface was not
> changed from the previous type of unsigned long.
> 
> While this works fine as long as none of the new 64-bit flag bits
> (CLONE_CLEAR_SIGHAND and CLONE_INTO_CGROUP) are evaluated, this is still
> undesirable in terms of the principle of least surprise.
> 
> Thus, this commit fixes all relevant interfaces of the copy_thread
> function that is called from copy_process to consistently pass
> clone_flags as u64, so that no truncation to 32-bit integers occurs on
> 32-bit architectures.
> 
> Signed-off-by: Simon Schuster <schuster.simon@siemens-energy.com>
> ---

Thanks for this and for the whole series! Needed foundation for a
sparc32 clone3 implementation as well.

>  arch/sparc/kernel/process_32.c   | 2 +-
>  arch/sparc/kernel/process_64.c   | 2 +-

Acked-by: Andreas Larsson <andreas@gaisler.com> # sparc

Cheers,
Andreas


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 3/4] arch: copy_thread: pass clone_flags as u64
  2025-09-02  7:02   ` Andreas Larsson
@ 2025-09-02  7:15     ` John Paul Adrian Glaubitz
  2025-09-02 11:44       ` Andreas Larsson
  0 siblings, 1 reply; 20+ messages in thread
From: John Paul Adrian Glaubitz @ 2025-09-02  7:15 UTC (permalink / raw)
  To: Andreas Larsson, schuster.simon, 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, 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

Hi Andreas,

On Tue, 2025-09-02 at 09:02 +0200, Andreas Larsson wrote:
> On 2025-09-01 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, with a new type of u64 for the flags.
> > However, for most consumers of clone_flags the interface was not
> > changed from the previous type of unsigned long.
> > 
> > While this works fine as long as none of the new 64-bit flag bits
> > (CLONE_CLEAR_SIGHAND and CLONE_INTO_CGROUP) are evaluated, this is still
> > undesirable in terms of the principle of least surprise.
> > 
> > Thus, this commit fixes all relevant interfaces of the copy_thread
> > function that is called from copy_process to consistently pass
> > clone_flags as u64, so that no truncation to 32-bit integers occurs on
> > 32-bit architectures.
> > 
> > Signed-off-by: Simon Schuster <schuster.simon@siemens-energy.com>
> > ---
> 
> Thanks for this and for the whole series! Needed foundation for a
> sparc32 clone3 implementation as well.

Can you implement clone3 for sparc64 as well?

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 3/4] arch: copy_thread: pass clone_flags as u64
  2025-09-01 13:09 ` [PATCH v2 3/4] arch: copy_thread: pass clone_flags as u64 Simon Schuster via B4 Relay
                     ` (4 preceding siblings ...)
  2025-09-02  7:02   ` Andreas Larsson
@ 2025-09-02  9:48   ` Guo Ren
  5 siblings, 0 replies; 20+ messages in thread
From: Guo Ren @ 2025-09-02  9:48 UTC (permalink / raw)
  To: schuster.simon
  Cc: 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, 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

On Mon, Sep 1, 2025 at 9:10 PM Simon Schuster via B4 Relay
<devnull+schuster.simon.siemens-energy.com@kernel.org> 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, with a new type of u64 for the flags.
> However, for most consumers of clone_flags the interface was not
> changed from the previous type of unsigned long.
>
> While this works fine as long as none of the new 64-bit flag bits
> (CLONE_CLEAR_SIGHAND and CLONE_INTO_CGROUP) are evaluated, this is still
> undesirable in terms of the principle of least surprise.
>
> Thus, this commit fixes all relevant interfaces of the copy_thread
> function that is called from copy_process to consistently pass
> clone_flags as u64, so that no truncation to 32-bit integers occurs on
> 32-bit architectures.
>
> Signed-off-by: Simon Schuster <schuster.simon@siemens-energy.com>
> ---
>  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/kernel/process.c      | 2 +-
>  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 +-
>  26 files changed, 27 insertions(+), 27 deletions(-)
>
> diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
> index 582d96548385..06522451f018 100644
> --- a/arch/alpha/kernel/process.c
> +++ b/arch/alpha/kernel/process.c
> @@ -231,7 +231,7 @@ flush_thread(void)
>   */
>  int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>  {
> -       unsigned long clone_flags = args->flags;
> +       u64 clone_flags = args->flags;
>         unsigned long usp = args->stack;
>         unsigned long tls = args->tls;
>         extern void ret_from_fork(void);
> diff --git a/arch/arc/kernel/process.c b/arch/arc/kernel/process.c
> index 186ceab661eb..8166d0908713 100644
> --- a/arch/arc/kernel/process.c
> +++ b/arch/arc/kernel/process.c
> @@ -166,7 +166,7 @@ asmlinkage void ret_from_fork(void);
>   */
>  int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>  {
> -       unsigned long clone_flags = args->flags;
> +       u64 clone_flags = args->flags;
>         unsigned long usp = args->stack;
>         unsigned long tls = args->tls;
>         struct pt_regs *c_regs;        /* child's pt_regs */
> diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
> index e16ed102960c..d7aa95225c70 100644
> --- a/arch/arm/kernel/process.c
> +++ b/arch/arm/kernel/process.c
> @@ -234,7 +234,7 @@ asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
>
>  int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>  {
> -       unsigned long clone_flags = args->flags;
> +       u64 clone_flags = args->flags;
>         unsigned long stack_start = args->stack;
>         unsigned long tls = args->tls;
>         struct thread_info *thread = task_thread_info(p);
> diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
> index 96482a1412c6..fba7ca102a8c 100644
> --- a/arch/arm64/kernel/process.c
> +++ b/arch/arm64/kernel/process.c
> @@ -409,7 +409,7 @@ asmlinkage void ret_from_fork(void) asm("ret_from_fork");
>
>  int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>  {
> -       unsigned long clone_flags = args->flags;
> +       u64 clone_flags = args->flags;
>         unsigned long stack_start = args->stack;
>         unsigned long tls = args->tls;
>         struct pt_regs *childregs = task_pt_regs(p);
> diff --git a/arch/csky/kernel/process.c b/arch/csky/kernel/process.c
> index 0c6e4b17fe00..a7a90340042a 100644
> --- a/arch/csky/kernel/process.c
> +++ b/arch/csky/kernel/process.c
> @@ -32,7 +32,7 @@ void flush_thread(void){}
>
>  int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>  {
> -       unsigned long clone_flags = args->flags;
> +       u64 clone_flags = args->flags;
Acked-by: Guo Ren (Alibaba Damo Academy) <guoren@kernel.org>

>         unsigned long usp = args->stack;
>         unsigned long tls = args->tls;
>         struct switch_stack *childstack;
> diff --git a/arch/hexagon/kernel/process.c b/arch/hexagon/kernel/process.c
> index 2a77bfd75694..15b4992bfa29 100644
> --- a/arch/hexagon/kernel/process.c
> +++ b/arch/hexagon/kernel/process.c
> @@ -52,7 +52,7 @@ void arch_cpu_idle(void)
>   */
>  int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>  {
> -       unsigned long clone_flags = args->flags;
> +       u64 clone_flags = args->flags;
>         unsigned long usp = args->stack;
>         unsigned long tls = args->tls;
>         struct thread_info *ti = task_thread_info(p);
> diff --git a/arch/loongarch/kernel/process.c b/arch/loongarch/kernel/process.c
> index 3582f591bab2..efd9edf65603 100644
> --- a/arch/loongarch/kernel/process.c
> +++ b/arch/loongarch/kernel/process.c
> @@ -167,7 +167,7 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>         unsigned long childksp;
>         unsigned long tls = args->tls;
>         unsigned long usp = args->stack;
> -       unsigned long clone_flags = args->flags;
> +       u64 clone_flags = args->flags;
>         struct pt_regs *childregs, *regs = current_pt_regs();
>
>         childksp = (unsigned long)task_stack_page(p) + THREAD_SIZE;
> diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
> index fda7eac23f87..f5a07a70e938 100644
> --- a/arch/m68k/kernel/process.c
> +++ b/arch/m68k/kernel/process.c
> @@ -141,7 +141,7 @@ asmlinkage int m68k_clone3(struct pt_regs *regs)
>
>  int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>  {
> -       unsigned long clone_flags = args->flags;
> +       u64 clone_flags = args->flags;
>         unsigned long usp = args->stack;
>         unsigned long tls = args->tls;
>         struct fork_frame {
> diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
> index 56342e11442d..6cbf642d7b80 100644
> --- a/arch/microblaze/kernel/process.c
> +++ b/arch/microblaze/kernel/process.c
> @@ -54,7 +54,7 @@ void flush_thread(void)
>
>  int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>  {
> -       unsigned long clone_flags = args->flags;
> +       u64 clone_flags = args->flags;
>         unsigned long usp = args->stack;
>         unsigned long tls = args->tls;
>         struct pt_regs *childregs = task_pt_regs(p);
> diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
> index 02aa6a04a21d..29191fa1801e 100644
> --- a/arch/mips/kernel/process.c
> +++ b/arch/mips/kernel/process.c
> @@ -107,7 +107,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
>   */
>  int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>  {
> -       unsigned long clone_flags = args->flags;
> +       u64 clone_flags = args->flags;
>         unsigned long usp = args->stack;
>         unsigned long tls = args->tls;
>         struct thread_info *ti = task_thread_info(p);
> diff --git a/arch/nios2/kernel/process.c b/arch/nios2/kernel/process.c
> index f84021303f6a..151404139085 100644
> --- a/arch/nios2/kernel/process.c
> +++ b/arch/nios2/kernel/process.c
> @@ -101,7 +101,7 @@ void flush_thread(void)
>
>  int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>  {
> -       unsigned long clone_flags = args->flags;
> +       u64 clone_flags = args->flags;
>         unsigned long usp = args->stack;
>         unsigned long tls = args->tls;
>         struct pt_regs *childregs = task_pt_regs(p);
> diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c
> index eef99fee2110..73ffb9fa3118 100644
> --- a/arch/openrisc/kernel/process.c
> +++ b/arch/openrisc/kernel/process.c
> @@ -165,7 +165,7 @@ extern asmlinkage void ret_from_fork(void);
>  int
>  copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>  {
> -       unsigned long clone_flags = args->flags;
> +       u64 clone_flags = args->flags;
>         unsigned long usp = args->stack;
>         unsigned long tls = args->tls;
>         struct pt_regs *userregs;
> diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
> index ed93bd8c1545..e64ab5d2a40d 100644
> --- a/arch/parisc/kernel/process.c
> +++ b/arch/parisc/kernel/process.c
> @@ -201,7 +201,7 @@ arch_initcall(parisc_idle_init);
>  int
>  copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>  {
> -       unsigned long clone_flags = args->flags;
> +       u64 clone_flags = args->flags;
>         unsigned long usp = args->stack;
>         unsigned long tls = args->tls;
>         struct pt_regs *cregs = &(p->thread.regs);
> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> index 855e09886503..eb23966ac0a9 100644
> --- a/arch/powerpc/kernel/process.c
> +++ b/arch/powerpc/kernel/process.c
> @@ -1805,7 +1805,7 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>                         f = ret_from_kernel_user_thread;
>                 } else {
>                         struct pt_regs *regs = current_pt_regs();
> -                       unsigned long clone_flags = args->flags;
> +                       u64 clone_flags = args->flags;
>                         unsigned long usp = args->stack;
>
>                         /* Copy registers */
> diff --git a/arch/riscv/kernel/process.c b/arch/riscv/kernel/process.c
> index a0a40889d79a..31a392993cb4 100644
> --- a/arch/riscv/kernel/process.c
> +++ b/arch/riscv/kernel/process.c
> @@ -223,7 +223,7 @@ asmlinkage void ret_from_fork_user(struct pt_regs *regs)
>
>  int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>  {
> -       unsigned long clone_flags = args->flags;
> +       u64 clone_flags = args->flags;
>         unsigned long usp = args->stack;
>         unsigned long tls = args->tls;
>         struct pt_regs *childregs = task_pt_regs(p);
> diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
> index f55f09cda6f8..b107dbca4ed7 100644
> --- a/arch/s390/kernel/process.c
> +++ b/arch/s390/kernel/process.c
> @@ -106,7 +106,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
>
>  int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>  {
> -       unsigned long clone_flags = args->flags;
> +       u64 clone_flags = args->flags;
>         unsigned long new_stackp = args->stack;
>         unsigned long tls = args->tls;
>         struct fake_frame
> diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c
> index 92b6649d4929..62f753a85b89 100644
> --- a/arch/sh/kernel/process_32.c
> +++ b/arch/sh/kernel/process_32.c
> @@ -89,7 +89,7 @@ asmlinkage void ret_from_kernel_thread(void);
>
>  int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>  {
> -       unsigned long clone_flags = args->flags;
> +       u64 clone_flags = args->flags;
>         unsigned long usp = args->stack;
>         unsigned long tls = args->tls;
>         struct thread_info *ti = task_thread_info(p);
> diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
> index 9c7c662cb565..5a28c0e91bf1 100644
> --- a/arch/sparc/kernel/process_32.c
> +++ b/arch/sparc/kernel/process_32.c
> @@ -260,7 +260,7 @@ extern void ret_from_kernel_thread(void);
>
>  int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>  {
> -       unsigned long clone_flags = args->flags;
> +       u64 clone_flags = args->flags;
>         unsigned long sp = args->stack;
>         unsigned long tls = args->tls;
>         struct thread_info *ti = task_thread_info(p);
> diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
> index 529adfecd58c..25781923788a 100644
> --- a/arch/sparc/kernel/process_64.c
> +++ b/arch/sparc/kernel/process_64.c
> @@ -567,7 +567,7 @@ void fault_in_user_windows(struct pt_regs *regs)
>   */
>  int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>  {
> -       unsigned long clone_flags = args->flags;
> +       u64 clone_flags = args->flags;
>         unsigned long sp = args->stack;
>         unsigned long tls = args->tls;
>         struct thread_info *t = task_thread_info(p);
> diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
> index 1be644de9e41..9c9c66dc45f0 100644
> --- a/arch/um/kernel/process.c
> +++ b/arch/um/kernel/process.c
> @@ -143,7 +143,7 @@ static void fork_handler(void)
>
>  int copy_thread(struct task_struct * p, const struct kernel_clone_args *args)
>  {
> -       unsigned long clone_flags = args->flags;
> +       u64 clone_flags = args->flags;
>         unsigned long sp = args->stack;
>         unsigned long tls = args->tls;
>         void (*handler)(void);
> diff --git a/arch/x86/include/asm/fpu/sched.h b/arch/x86/include/asm/fpu/sched.h
> index c060549c6c94..89004f4ca208 100644
> --- a/arch/x86/include/asm/fpu/sched.h
> +++ b/arch/x86/include/asm/fpu/sched.h
> @@ -11,7 +11,7 @@
>
>  extern void save_fpregs_to_fpstate(struct fpu *fpu);
>  extern void fpu__drop(struct task_struct *tsk);
> -extern int  fpu_clone(struct task_struct *dst, unsigned long clone_flags, bool minimal,
> +extern int  fpu_clone(struct task_struct *dst, u64 clone_flags, bool minimal,
>                       unsigned long shstk_addr);
>  extern void fpu_flush_thread(void);
>
> diff --git a/arch/x86/include/asm/shstk.h b/arch/x86/include/asm/shstk.h
> index ba6f2fe43848..0f50e0125943 100644
> --- a/arch/x86/include/asm/shstk.h
> +++ b/arch/x86/include/asm/shstk.h
> @@ -16,7 +16,7 @@ struct thread_shstk {
>
>  long shstk_prctl(struct task_struct *task, int option, unsigned long arg2);
>  void reset_thread_features(void);
> -unsigned long shstk_alloc_thread_stack(struct task_struct *p, unsigned long clone_flags,
> +unsigned long shstk_alloc_thread_stack(struct task_struct *p, u64 clone_flags,
>                                        unsigned long stack_size);
>  void shstk_free(struct task_struct *p);
>  int setup_signal_shadow_stack(struct ksignal *ksig);
> @@ -28,7 +28,7 @@ static inline long shstk_prctl(struct task_struct *task, int option,
>                                unsigned long arg2) { return -EINVAL; }
>  static inline void reset_thread_features(void) {}
>  static inline unsigned long shstk_alloc_thread_stack(struct task_struct *p,
> -                                                    unsigned long clone_flags,
> +                                                    u64 clone_flags,
>                                                      unsigned long stack_size) { return 0; }
>  static inline void shstk_free(struct task_struct *p) {}
>  static inline int setup_signal_shadow_stack(struct ksignal *ksig) { return 0; }
> diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
> index aefd412a23dc..1f71cc135e9a 100644
> --- a/arch/x86/kernel/fpu/core.c
> +++ b/arch/x86/kernel/fpu/core.c
> @@ -631,7 +631,7 @@ static int update_fpu_shstk(struct task_struct *dst, unsigned long ssp)
>  }
>
>  /* Clone current's FPU state on fork */
> -int fpu_clone(struct task_struct *dst, unsigned long clone_flags, bool minimal,
> +int fpu_clone(struct task_struct *dst, u64 clone_flags, bool minimal,
>               unsigned long ssp)
>  {
>         /*
> diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
> index 1b7960cf6eb0..e3a3987b0c4f 100644
> --- a/arch/x86/kernel/process.c
> +++ b/arch/x86/kernel/process.c
> @@ -159,7 +159,7 @@ __visible void ret_from_fork(struct task_struct *prev, struct pt_regs *regs,
>
>  int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>  {
> -       unsigned long clone_flags = args->flags;
> +       u64 clone_flags = args->flags;
>         unsigned long sp = args->stack;
>         unsigned long tls = args->tls;
>         struct inactive_task_frame *frame;
> diff --git a/arch/x86/kernel/shstk.c b/arch/x86/kernel/shstk.c
> index 2ddf23387c7e..5eba6c5a6775 100644
> --- a/arch/x86/kernel/shstk.c
> +++ b/arch/x86/kernel/shstk.c
> @@ -191,7 +191,7 @@ void reset_thread_features(void)
>         current->thread.features_locked = 0;
>  }
>
> -unsigned long shstk_alloc_thread_stack(struct task_struct *tsk, unsigned long clone_flags,
> +unsigned long shstk_alloc_thread_stack(struct task_struct *tsk, u64 clone_flags,
>                                        unsigned long stack_size)
>  {
>         struct thread_shstk *shstk = &tsk->thread.shstk;
> diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
> index 7bd66677f7b6..94d43f44be13 100644
> --- a/arch/xtensa/kernel/process.c
> +++ b/arch/xtensa/kernel/process.c
> @@ -267,7 +267,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
>
>  int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
>  {
> -       unsigned long clone_flags = args->flags;
> +       u64 clone_flags = args->flags;
>         unsigned long usp_thread_fn = args->stack;
>         unsigned long tls = args->tls;
>         struct pt_regs *childregs = task_pt_regs(p);
>
> --
> 2.39.5
>
>


-- 
Best Regards
 Guo Ren

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 3/4] arch: copy_thread: pass clone_flags as u64
  2025-09-02  7:15     ` John Paul Adrian Glaubitz
@ 2025-09-02 11:44       ` Andreas Larsson
  0 siblings, 0 replies; 20+ messages in thread
From: Andreas Larsson @ 2025-09-02 11:44 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz, Arnd Bergmann
  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

On 2025-09-02 09:15, John Paul Adrian Glaubitz wrote:
>> Thanks for this and for the whole series! Needed foundation for a
>> sparc32 clone3 implementation as well.
> 
> Can you implement clone3 for sparc64 as well?

(heavily pairing down the to list)

We'll take a look at that as well.

Cheers,
Andreas


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2025-09-02 11:44 UTC | newest]

Thread overview: 20+ 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:09 ` [PATCH v2 2/4] copy_process: pass clone_flags as u64 across calltree Simon Schuster via B4 Relay
2025-09-01 13:35   ` Arnd Bergmann
2025-09-01 13:38   ` David Hildenbrand
2025-09-01 13:09 ` [PATCH v2 3/4] arch: copy_thread: pass clone_flags as u64 Simon Schuster via B4 Relay
2025-09-01 13:30   ` Arnd Bergmann
2025-09-01 13:39   ` Russell King (Oracle)
2025-09-01 13:39   ` David Hildenbrand
2025-09-01 13:51   ` Geert Uytterhoeven
2025-09-02  7:02   ` Andreas Larsson
2025-09-02  7:15     ` John Paul Adrian Glaubitz
2025-09-02 11:44       ` Andreas Larsson
2025-09-02  9:48   ` Guo Ren
2025-09-01 13:09 ` [PATCH v2 4/4] nios2: implement architecture-specific portion of sys_clone3 Simon Schuster via B4 Relay
2025-09-01 13:35   ` Arnd Bergmann
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).