Re: [PATCH 1/2] copy_process: Handle architectures where sizeof(unsigned long) < sizeof(u64)

From: David Hildenbrand
Date: Thu Aug 21 2025 - 17:15:25 EST


On 21.08.25 13:27, Simon Schuster via B4 Relay wrote:
From: Simon Schuster <schuster.simon@xxxxxxxxxxxxxxxxxx>

With the introduction of clone3 in commit 7f192e3cd316 ("fork: add
clone3") the effective bit width of clone_flags on all architectures was
increased from 32bit to 64bit. However, the signature of the copy_*
helper functions (e.g., copy_sighand) used by copy_process was not
adapted, as such, they potentially truncate the flags on architectures
such as nios2, where unsigned long is a 32bit unsigned integer type.

This can, for instance, be observed via failures of kernel selftest
clone3_clear_sighand, which attempts to trigger the conditional

if (clone_flags & CLONE_CLEAR_SIGHAND)

in function copy_sighand within fork.c that 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 via their
declared u64 type, invariant of architecture-dependent integer sizes.

Sounds reasonable.

But is this actually something that is already exposed before patch#2 on other architectures?

(I assume above output is with patch #2 but without patch #1)

If so, we need a Fixes:. If not, we're good.

--
Cheers

David / dhildenb