summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2019-01-16 08:15:20 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2019-01-18 03:33:18 -0500
commit58fa4a410fc31afe08d0d0c6b6d8860c22ec17c2 (patch)
tree77b202fac335c9b4e142360ccab85e75fcd6f05e
parent1ecff5ef0a70e7fd32a0b9cf6ad7ac8285462697 (diff)
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>
-rw-r--r--arch/s390/kernel/compat_linux.c2
-rw-r--r--arch/s390/kernel/sys_s390.c4
-rw-r--r--include/linux/syscalls.h4
-rw-r--r--ipc/syscall.c20
-rw-r--r--kernel/sys_ni.c1
5 files changed, 25 insertions, 6 deletions
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 8ac38d51ed7d..a47f6d3c6d5b 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -296,7 +296,7 @@ COMPAT_SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, compat_ulong_t, second,
296{ 296{
297 if (call >> 16) /* hack for backward compatibility */ 297 if (call >> 16) /* hack for backward compatibility */
298 return -EINVAL; 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#endif 301#endif
302 302
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index 560bdaf8a74f..fd0cbbed4d9f 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -58,6 +58,7 @@ out:
58 return error; 58 return error;
59} 59}
60 60
61#ifdef CONFIG_SYSVIPC
61/* 62/*
62 * sys_ipc() is the de-multiplexer for the SysV IPC calls. 63 * sys_ipc() is the de-multiplexer for the SysV IPC calls.
63 */ 64 */
@@ -74,8 +75,9 @@ SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second,
74 * Therefore we can call the generic variant by simply passing the 75 * Therefore we can call the generic variant by simply passing the
75 * third parameter also as fifth parameter. 76 * third parameter also as fifth parameter.
76 */ 77 */
77 return sys_ipc(call, first, second, third, ptr, third); 78 return ksys_ipc(call, first, second, third, ptr, third);
78} 79}
80#endif /* CONFIG_SYSVIPC */
79 81
80SYSCALL_DEFINE1(s390_personality, unsigned int, personality) 82SYSCALL_DEFINE1(s390_personality, unsigned int, personality)
81{ 83{
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 257cccba3062..fb63045a0fb6 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -1185,6 +1185,10 @@ unsigned long ksys_mmap_pgoff(unsigned long addr, unsigned long len,
1185 unsigned long prot, unsigned long flags, 1185 unsigned long prot, unsigned long flags,
1186 unsigned long fd, unsigned long pgoff); 1186 unsigned long fd, unsigned long pgoff);
1187ssize_t ksys_readahead(int fd, loff_t offset, size_t count); 1187ssize_t ksys_readahead(int fd, loff_t offset, size_t count);
1188int ksys_ipc(unsigned int call, int first, unsigned long second,
1189 unsigned long third, void __user * ptr, long fifth);
1190int compat_ksys_ipc(u32 call, int first, int second,
1191 u32 third, u32 ptr, u32 fifth);
1188 1192
1189/* 1193/*
1190 * The following kernel syscall equivalents are just wrappers to fs-internal 1194 * The following kernel syscall equivalents are just wrappers to fs-internal
diff --git a/ipc/syscall.c b/ipc/syscall.c
index 1ac06e3983c0..3cf8ad703a4d 100644
--- a/ipc/syscall.c
+++ b/ipc/syscall.c
@@ -17,8 +17,8 @@
17#include <linux/shm.h> 17#include <linux/shm.h>
18#include <linux/uaccess.h> 18#include <linux/uaccess.h>
19 19
20SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second, 20int ksys_ipc(unsigned int call, int first, unsigned long second,
21 unsigned long, third, void __user *, ptr, long, fifth) 21 unsigned long third, void __user * ptr, long fifth)
22{ 22{
23 int version, ret; 23 int version, ret;
24 24
@@ -106,6 +106,12 @@ SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second,
106 return -ENOSYS; 106 return -ENOSYS;
107 } 107 }
108} 108}
109
110SYSCALL_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#endif 115#endif
110 116
111#ifdef CONFIG_COMPAT 117#ifdef CONFIG_COMPAT
@@ -121,8 +127,8 @@ struct compat_ipc_kludge {
121}; 127};
122 128
123#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC 129#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
124COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second, 130int compat_ksys_ipc(u32 call, int first, int second,
125 u32, third, compat_uptr_t, ptr, u32, fifth) 131 u32 third, compat_uptr_t ptr, u32 fifth)
126{ 132{
127 int version; 133 int version;
128 u32 pad; 134 u32 pad;
@@ -195,5 +201,11 @@ COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second,
195 201
196 return -ENOSYS; 202 return -ENOSYS;
197} 203}
204
205COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second,
206 u32, third, compat_uptr_t, ptr, u32, fifth)
207{
208 return compat_ksys_ipc(call, first, second, third, ptr, fifth);
209}
198#endif 210#endif
199#endif 211#endif
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index ab9d0e3c6d50..bc934f31ab10 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -366,6 +366,7 @@ COND_SYSCALL(kexec_file_load);
366/* s390 */ 366/* s390 */
367COND_SYSCALL(s390_pci_mmio_read); 367COND_SYSCALL(s390_pci_mmio_read);
368COND_SYSCALL(s390_pci_mmio_write); 368COND_SYSCALL(s390_pci_mmio_write);
369COND_SYSCALL(s390_ipc);
369COND_SYSCALL_COMPAT(s390_ipc); 370COND_SYSCALL_COMPAT(s390_ipc);
370 371
371/* powerpc */ 372/* powerpc */