]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
sh: rework sync_file_range ABI
authorArnd Bergmann <arnd@arndb.de>
Tue, 11 Jun 2024 20:12:43 +0000 (22:12 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Jul 2024 07:31:57 +0000 (09:31 +0200)
commit41dd6b0ec7df51089870692305e95626f9d6418c
tree58d1159b0624fbe2e53394ed88fe1aea51bff302
parentbf3c44f67cdff428ca81a4542fc7891540a3cd23
sh: rework sync_file_range ABI

commit 30766f1105d6d2459c3b9fe34a3e52b637a72950 upstream.

The unusual function calling conventions on SuperH ended up causing
sync_file_range to have the wrong argument order, with the 'flags'
argument getting sorted before 'nbytes' by the compiler.

In userspace, I found that musl, glibc, uclibc and strace all expect the
normal calling conventions with 'nbytes' last, so changing the kernel
to match them should make all of those work.

In order to be able to also fix libc implementations to work with existing
kernels, they need to be able to tell which ABI is used. An easy way
to do this is to add yet another system call using the sync_file_range2
ABI that works the same on all architectures.

Old user binaries can now work on new kernels, and new binaries can
try the new sync_file_range2() to work with new kernels or fall back
to the old sync_file_range() version if that doesn't exist.

Cc: stable@vger.kernel.org
Fixes: 75c92acdd5b1 ("sh: Wire up new syscalls.")
Acked-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/sh/kernel/sys_sh32.c
arch/sh/kernel/syscalls/syscall.tbl