Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipc: introduce ksys_ipc()/compat_ksys_ipc() for s390

The sys_ipc() and compat_ksys_ipc() functions are meant to only
be used from the system call table, not called by another function.

Introduce ksys_*() interfaces for this purpose, as we have done
for many other system calls.

Link: https://lore.kernel.org/lkml/20190116131527.2071570-3-arnd@arndb.de
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
[heiko.carstens@de.ibm.com: compile fix for !CONFIG_COMPAT]
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Arnd Bergmann and committed by
Martin Schwidefsky
58fa4a41 1ecff5ef

+25 -6
+1 -1
arch/s390/kernel/compat_linux.c
··· 296 296 { 297 297 if (call >> 16) /* hack for backward compatibility */ 298 298 return -EINVAL; 299 - return compat_sys_ipc(call, first, second, third, ptr, third); 299 + return compat_ksys_ipc(call, first, second, third, ptr, third); 300 300 } 301 301 #endif 302 302
+3 -1
arch/s390/kernel/sys_s390.c
··· 58 58 return error; 59 59 } 60 60 61 + #ifdef CONFIG_SYSVIPC 61 62 /* 62 63 * sys_ipc() is the de-multiplexer for the SysV IPC calls. 63 64 */ ··· 75 74 * Therefore we can call the generic variant by simply passing the 76 75 * third parameter also as fifth parameter. 77 76 */ 78 - return sys_ipc(call, first, second, third, ptr, third); 77 + return ksys_ipc(call, first, second, third, ptr, third); 79 78 } 79 + #endif /* CONFIG_SYSVIPC */ 80 80 81 81 SYSCALL_DEFINE1(s390_personality, unsigned int, personality) 82 82 {
+4
include/linux/syscalls.h
··· 1185 1185 unsigned long prot, unsigned long flags, 1186 1186 unsigned long fd, unsigned long pgoff); 1187 1187 ssize_t ksys_readahead(int fd, loff_t offset, size_t count); 1188 + int ksys_ipc(unsigned int call, int first, unsigned long second, 1189 + unsigned long third, void __user * ptr, long fifth); 1190 + int compat_ksys_ipc(u32 call, int first, int second, 1191 + u32 third, u32 ptr, u32 fifth); 1188 1192 1189 1193 /* 1190 1194 * The following kernel syscall equivalents are just wrappers to fs-internal
+16 -4
ipc/syscall.c
··· 17 17 #include <linux/shm.h> 18 18 #include <linux/uaccess.h> 19 19 20 - SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second, 21 - unsigned long, third, void __user *, ptr, long, fifth) 20 + int ksys_ipc(unsigned int call, int first, unsigned long second, 21 + unsigned long third, void __user * ptr, long fifth) 22 22 { 23 23 int version, ret; 24 24 ··· 106 106 return -ENOSYS; 107 107 } 108 108 } 109 + 110 + SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second, 111 + unsigned long, third, void __user *, ptr, long, fifth) 112 + { 113 + return ksys_ipc(call, first, second, third, ptr, fifth); 114 + } 109 115 #endif 110 116 111 117 #ifdef CONFIG_COMPAT ··· 127 121 }; 128 122 129 123 #ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC 130 - COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second, 131 - u32, third, compat_uptr_t, ptr, u32, fifth) 124 + int compat_ksys_ipc(u32 call, int first, int second, 125 + u32 third, compat_uptr_t ptr, u32 fifth) 132 126 { 133 127 int version; 134 128 u32 pad; ··· 200 194 } 201 195 202 196 return -ENOSYS; 197 + } 198 + 199 + COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second, 200 + u32, third, compat_uptr_t, ptr, u32, fifth) 201 + { 202 + return compat_ksys_ipc(call, first, second, third, ptr, fifth); 203 203 } 204 204 #endif 205 205 #endif
+1
kernel/sys_ni.c
··· 366 366 /* s390 */ 367 367 COND_SYSCALL(s390_pci_mmio_read); 368 368 COND_SYSCALL(s390_pci_mmio_write); 369 + COND_SYSCALL(s390_ipc); 369 370 COND_SYSCALL_COMPAT(s390_ipc); 370 371 371 372 /* powerpc */