Re: [PATCH 1/2] copy_process: Handle architectures where sizeof(unsigned long) < sizeof(u64)
From: Arnd Bergmann
Date: Fri Aug 22 2025 - 07:04:47 EST
On Fri, Aug 22, 2025, at 10:52, schuster.simon@xxxxxxxxxxxxxxxxxx wrote:
> On Thu, Aug 21, 2025 at 11:14:00PM +0200, David Hildenbrand wrote:
>> Sounds reasonable.
>>
>> But is this actually something that is already exposed before patch#2
>> on other architectures?
>
> I'm not sure, but I would assume so, as e.g., arch/arm seems to have
> support for clone3, but also seems to use 32bit unsigned longs as far as
> I can tell and, thus, should also be affected:
Correct. 'unsigned long' is always the native word size for an ISA
on architectures that Linux runs on, and the same size as a pointer,
so the bug affects all 32-bit architectures that have clone3:
arc, arm, csky, m68k, microblaze, mips32, openrisc, parisc32,
powerpc32, riscv32, x86-32 and xtensa.
However, since the ABI itself is fine and 64-bit kernels pass the
value as native words internally, the 'compat' mode support on
arm/mips/ parisc/powerpc/riscv/s390/x86 does not have the same
problem, and running the same 32-bit executable on a 64-bit kernel
should work fine. This may explain why nobody caught this so far,
even when they were testing the new flags with x86-32 or arm32
userland, but using 64-bit machines.
>> (I assume above output is with patch #2 but without patch #1)
>
> Yes, sorry, that one is on me; I've naturally first implemented support
> for clone3 on nios2 and then investigated the test failures, but somehow
> deemed it wise for whatever reason to switch the commit order in the
> patch submission...
The order you picked is fine: we generally want bug fixes before
new features to allow backporting them more easily. Please add
Fixes: b612e5df4587 ("clone3: add CLONE_CLEAR_SIGHAND")
Cc: stable@xxxxxxxxxxxxxxx # linux-5.5+
above your Signed-off-by for this patch, to ensure the fix gets
picked up. I would also suggest changing the text to not mention
nios2 specifically but just say that it affects "all 32-bit kernels".
Arnd