Skip to content

Commit ce883a2

Browse files
andreas-schwabmpe
authored andcommitted
powerpc/32: fix syscall wrappers with 64-bit arguments
With the introduction 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: 7e92e01 ("powerpc: Provide syscall wrapper") Fixes: e237506 ("powerpc/32: fix syscall wrappers with 64-bit arguments of unaligned register-pairs") Signed-off-by: Andreas Schwab <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 40ff214 commit ce883a2

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

arch/powerpc/include/asm/syscalls.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ long sys_ppc_ftruncate64(unsigned int fd, u32 reg4,
104104
unsigned long len1, unsigned long len2);
105105
long sys_ppc32_fadvise64(int fd, u32 unused, u32 offset1, u32 offset2,
106106
size_t len, int advice);
107+
long sys_ppc_sync_file_range2(int fd, unsigned int flags,
108+
unsigned int offset1,
109+
unsigned int offset2,
110+
unsigned int nbytes1,
111+
unsigned int nbytes2);
112+
long sys_ppc_fallocate(int fd, int mode, u32 offset1, u32 offset2,
113+
u32 len1, u32 len2);
107114
#endif
108115
#ifdef CONFIG_COMPAT
109116
long compat_sys_mmap2(unsigned long addr, size_t len,

arch/powerpc/kernel/sys_ppc32.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ PPC32_SYSCALL_DEFINE6(ppc32_fadvise64,
112112
advice);
113113
}
114114

115-
COMPAT_SYSCALL_DEFINE6(ppc_sync_file_range2,
115+
PPC32_SYSCALL_DEFINE6(ppc_sync_file_range2,
116116
int, fd, unsigned int, flags,
117117
unsigned int, offset1, unsigned int, offset2,
118118
unsigned int, nbytes1, unsigned int, nbytes2)
@@ -122,3 +122,14 @@ COMPAT_SYSCALL_DEFINE6(ppc_sync_file_range2,
122122

123123
return ksys_sync_file_range(fd, offset, nbytes, flags);
124124
}
125+
126+
#ifdef CONFIG_PPC32
127+
SYSCALL_DEFINE6(ppc_fallocate,
128+
int, fd, int, mode,
129+
u32, offset1, u32, offset2, u32, len1, u32, len2)
130+
{
131+
return ksys_fallocate(fd, mode,
132+
merge_64(offset1, offset2),
133+
merge_64(len1, len2));
134+
}
135+
#endif

arch/powerpc/kernel/syscalls/syscall.tbl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,11 @@
394394
305 common signalfd sys_signalfd compat_sys_signalfd
395395
306 common timerfd_create sys_timerfd_create
396396
307 common eventfd sys_eventfd
397-
308 common sync_file_range2 sys_sync_file_range2 compat_sys_ppc_sync_file_range2
398-
309 nospu fallocate sys_fallocate compat_sys_fallocate
397+
308 32 sync_file_range2 sys_ppc_sync_file_range2 compat_sys_ppc_sync_file_range2
398+
308 64 sync_file_range2 sys_sync_file_range2
399+
308 spu sync_file_range2 sys_sync_file_range2
400+
309 32 fallocate sys_ppc_fallocate compat_sys_fallocate
401+
309 64 fallocate sys_fallocate
399402
310 nospu subpage_prot sys_subpage_prot
400403
311 32 timerfd_settime sys_timerfd_settime32
401404
311 64 timerfd_settime sys_timerfd_settime

0 commit comments

Comments
 (0)