Commit 58fa4a41 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Martin Schwidefsky

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.deSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Reviewed-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
[heiko.carstens@de.ibm.com: compile fix for !CONFIG_COMPAT]
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 1ecff5ef
...@@ -296,7 +296,7 @@ COMPAT_SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, compat_ulong_t, second, ...@@ -296,7 +296,7 @@ COMPAT_SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, compat_ulong_t, second,
{ {
if (call >> 16) /* hack for backward compatibility */ if (call >> 16) /* hack for backward compatibility */
return -EINVAL; return -EINVAL;
return compat_sys_ipc(call, first, second, third, ptr, third); return compat_ksys_ipc(call, first, second, third, ptr, third);
} }
#endif #endif
......
...@@ -58,6 +58,7 @@ SYSCALL_DEFINE1(mmap2, struct s390_mmap_arg_struct __user *, arg) ...@@ -58,6 +58,7 @@ SYSCALL_DEFINE1(mmap2, struct s390_mmap_arg_struct __user *, arg)
return error; return error;
} }
#ifdef CONFIG_SYSVIPC
/* /*
* sys_ipc() is the de-multiplexer for the SysV IPC calls. * sys_ipc() is the de-multiplexer for the SysV IPC calls.
*/ */
...@@ -74,8 +75,9 @@ SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second, ...@@ -74,8 +75,9 @@ SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second,
* Therefore we can call the generic variant by simply passing the * Therefore we can call the generic variant by simply passing the
* third parameter also as fifth parameter. * third parameter also as fifth parameter.
*/ */
return sys_ipc(call, first, second, third, ptr, third); return ksys_ipc(call, first, second, third, ptr, third);
} }
#endif /* CONFIG_SYSVIPC */
SYSCALL_DEFINE1(s390_personality, unsigned int, personality) SYSCALL_DEFINE1(s390_personality, unsigned int, personality)
{ {
......
...@@ -1185,6 +1185,10 @@ unsigned long ksys_mmap_pgoff(unsigned long addr, unsigned long len, ...@@ -1185,6 +1185,10 @@ unsigned long ksys_mmap_pgoff(unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags, unsigned long prot, unsigned long flags,
unsigned long fd, unsigned long pgoff); unsigned long fd, unsigned long pgoff);
ssize_t ksys_readahead(int fd, loff_t offset, size_t count); ssize_t ksys_readahead(int fd, loff_t offset, size_t count);
int ksys_ipc(unsigned int call, int first, unsigned long second,
unsigned long third, void __user * ptr, long fifth);
int compat_ksys_ipc(u32 call, int first, int second,
u32 third, u32 ptr, u32 fifth);
/* /*
* The following kernel syscall equivalents are just wrappers to fs-internal * The following kernel syscall equivalents are just wrappers to fs-internal
......
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
#include <linux/shm.h> #include <linux/shm.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second, int ksys_ipc(unsigned int call, int first, unsigned long second,
unsigned long, third, void __user *, ptr, long, fifth) unsigned long third, void __user * ptr, long fifth)
{ {
int version, ret; int version, ret;
...@@ -106,6 +106,12 @@ SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second, ...@@ -106,6 +106,12 @@ SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second,
return -ENOSYS; return -ENOSYS;
} }
} }
SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second,
unsigned long, third, void __user *, ptr, long, fifth)
{
return ksys_ipc(call, first, second, third, ptr, fifth);
}
#endif #endif
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
...@@ -121,8 +127,8 @@ struct compat_ipc_kludge { ...@@ -121,8 +127,8 @@ struct compat_ipc_kludge {
}; };
#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC #ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second, int compat_ksys_ipc(u32 call, int first, int second,
u32, third, compat_uptr_t, ptr, u32, fifth) u32 third, compat_uptr_t ptr, u32 fifth)
{ {
int version; int version;
u32 pad; u32 pad;
...@@ -195,5 +201,11 @@ COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second, ...@@ -195,5 +201,11 @@ COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second,
return -ENOSYS; return -ENOSYS;
} }
COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second,
u32, third, compat_uptr_t, ptr, u32, fifth)
{
return compat_ksys_ipc(call, first, second, third, ptr, fifth);
}
#endif #endif
#endif #endif
...@@ -366,6 +366,7 @@ COND_SYSCALL(kexec_file_load); ...@@ -366,6 +366,7 @@ COND_SYSCALL(kexec_file_load);
/* s390 */ /* s390 */
COND_SYSCALL(s390_pci_mmio_read); COND_SYSCALL(s390_pci_mmio_read);
COND_SYSCALL(s390_pci_mmio_write); COND_SYSCALL(s390_pci_mmio_write);
COND_SYSCALL(s390_ipc);
COND_SYSCALL_COMPAT(s390_ipc); COND_SYSCALL_COMPAT(s390_ipc);
/* powerpc */ /* powerpc */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment