[PATCH] powerpc/32: fix syscall wrappers with 64-bit arguments

Arnd Bergmann arnd at arndb.de
Tue Nov 1 06:37:49 AEDT 2022


On Mon, Oct 31, 2022, at 15:47, Andreas Schwab wrote:
> With the introducion of syscall wrappers all wrappers for syscalls with
> 64-bit arguments must be handled specially, not only those that have
> unaligned 64-bit arguments.  This left out the fallocate and
> sync_file_range2 syscalls.
>
> Fixes: 7e92e01b7245 ("powerpc: Provide syscall wrapper")
> Fixes: e23750623835 ("powerpc/32: fix syscall wrappers with 64-bit 
> arguments of unaligned register-pairs")
> Signed-off-by: Andreas Schwab <schwab at linux-m68k.org>

This looks correct as a minmal bugfix to be backported.
I have cross-checked the syscalls with 64-bit arguments that
have special handlers on powerpc against the list from x86
to make sure there are no other obvious ones that need a
similar fix.

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

> +
> +#ifdef CONFIG_PPC32
> +SYSCALL_DEFINE6(ppc_fallocate,
> +		int, fd, int, mode,
> +		u32, offset1, u32, offset2, u32, len1, u32, len2)
> +{
> +	return ksys_fallocate(fd, mode,
> +			      merge_64(offset1, offset2),
> +			      merge_64(len1, len2));
> +}
> +#endif

This is identical to compat_sys_fallocate() and to
(an andian-corrected) sys_ia32_fallocate(), right?

I still think we should eventually generalize this further and
make all these handlers architecture independent to prevent the
same bug from happening on additional architectures, but that
should probably be done separately.

     Arnd


More information about the Linuxppc-dev mailing list