]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
powerpc: Fix fallocate and fadvise64_64 compat parameter combination
authorRohan McLure <rmclure@linux.ibm.com>
Wed, 21 Sep 2022 06:55:48 +0000 (16:55 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Oct 2022 07:58:03 +0000 (09:58 +0200)
commitfd4b22c4b1f07ccb57727b244fc5c0b61de9677e
treea1118bd9b810725b7a74a3980902bf02b087fd54
parent4140fd90c93e99577b5bc17293c0c5c5f108aee8
powerpc: Fix fallocate and fadvise64_64 compat parameter combination

[ Upstream commit 016ff72bd2090903715c0f9422a44afbb966f4ee ]

As reported[1] by Arnd, the arch-specific fadvise64_64 and fallocate
compatibility handlers assume parameters are passed with 32-bit
big-endian ABI. This affects the assignment of odd-even parameter pairs
to the high or low words of a 64-bit syscall parameter.

Fix fadvise64_64 fallocate compat handlers to correctly swap upper/lower
32 bits conditioned on endianness.

A future patch will replace the arch-specific compat fallocate with an
asm-generic implementation. This patch is intended for ease of
back-port.

[1]: https://lore.kernel.org/all/be29926f-226e-48dc-871a-e29a54e80583@www.fastmail.com/

Fixes: 57f48b4b74e7 ("powerpc/compat_sys: swap hi/lo parts of 64-bit syscall args in LE mode")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rohan McLure <rmclure@linux.ibm.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220921065605.1051927-9-rmclure@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/powerpc/include/asm/syscalls.h
arch/powerpc/kernel/sys_ppc32.c
arch/powerpc/kernel/syscalls.c