]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
arch: copy_thread: pass clone_flags as u64
authorSimon Schuster <schuster.simon@siemens-energy.com>
Mon, 1 Sep 2025 13:09:52 +0000 (15:09 +0200)
committerChristian Brauner <brauner@kernel.org>
Mon, 1 Sep 2025 13:31:34 +0000 (15:31 +0200)
commitbbc46b23af5bb934cd1cf066ef4342cee457a24e
treee32067d43d6a379e255e8be5e31587bdf16a10f3
parentedd3cb05c00a040dc72bed20b14b5ba865188bce
arch: copy_thread: pass clone_flags as u64

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>
Link: https://lore.kernel.org/20250901-nios2-implement-clone3-v2-3-53fcf5577d57@siemens-energy.com
Fixes: c5febea0956fd387 ("fork: Pass struct kernel_clone_args into copy_thread")
Acked-by: Guo Ren (Alibaba Damo Academy) <guoren@kernel.org>
Acked-by: Andreas Larsson <andreas@gaisler.com> # sparc
Acked-by: David Hildenbrand <david@redhat.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # m68k
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Christian Brauner <brauner@kernel.org>
26 files changed:
arch/alpha/kernel/process.c
arch/arc/kernel/process.c
arch/arm/kernel/process.c
arch/arm64/kernel/process.c
arch/csky/kernel/process.c
arch/hexagon/kernel/process.c
arch/loongarch/kernel/process.c
arch/m68k/kernel/process.c
arch/microblaze/kernel/process.c
arch/mips/kernel/process.c
arch/nios2/kernel/process.c
arch/openrisc/kernel/process.c
arch/parisc/kernel/process.c
arch/powerpc/kernel/process.c
arch/riscv/kernel/process.c
arch/s390/kernel/process.c
arch/sh/kernel/process_32.c
arch/sparc/kernel/process_32.c
arch/sparc/kernel/process_64.c
arch/um/kernel/process.c
arch/x86/include/asm/fpu/sched.h
arch/x86/include/asm/shstk.h
arch/x86/kernel/fpu/core.c
arch/x86/kernel/process.c
arch/x86/kernel/shstk.c
arch/xtensa/kernel/process.c