Skip to content

Commit 58fa4a4

Browse files
arndbMartin Schwidefsky
authored andcommitted
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>
1 parent 1ecff5e commit 58fa4a4

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

arch/s390/kernel/compat_linux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ COMPAT_SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, compat_ulong_t, second,
296296
{
297297
if (call >> 16) /* hack for backward compatibility */
298298
return -EINVAL;
299-
return compat_sys_ipc(call, first, second, third, ptr, third);
299+
return compat_ksys_ipc(call, first, second, third, ptr, third);
300300
}
301301
#endif
302302

arch/s390/kernel/sys_s390.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ SYSCALL_DEFINE1(mmap2, struct s390_mmap_arg_struct __user *, arg)
5858
return error;
5959
}
6060

61+
#ifdef CONFIG_SYSVIPC
6162
/*
6263
* sys_ipc() is the de-multiplexer for the SysV IPC calls.
6364
*/
@@ -74,8 +75,9 @@ SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second,
7475
* Therefore we can call the generic variant by simply passing the
7576
* third parameter also as fifth parameter.
7677
*/
77-
return sys_ipc(call, first, second, third, ptr, third);
78+
return ksys_ipc(call, first, second, third, ptr, third);
7879
}
80+
#endif /* CONFIG_SYSVIPC */
7981

8082
SYSCALL_DEFINE1(s390_personality, unsigned int, personality)
8183
{

include/linux/syscalls.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,10 @@ unsigned long ksys_mmap_pgoff(unsigned long addr, unsigned long len,
11851185
unsigned long prot, unsigned long flags,
11861186
unsigned long fd, unsigned long pgoff);
11871187
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);
11881192

11891193
/*
11901194
* The following kernel syscall equivalents are just wrappers to fs-internal

ipc/syscall.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
#include <linux/shm.h>
1818
#include <linux/uaccess.h>
1919

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)
2222
{
2323
int version, ret;
2424

@@ -106,6 +106,12 @@ SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second,
106106
return -ENOSYS;
107107
}
108108
}
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+
}
109115
#endif
110116

111117
#ifdef CONFIG_COMPAT
@@ -121,8 +127,8 @@ struct compat_ipc_kludge {
121127
};
122128

123129
#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
124-
COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second,
125-
u32, third, compat_uptr_t, ptr, u32, fifth)
130+
int compat_ksys_ipc(u32 call, int first, int second,
131+
u32 third, compat_uptr_t ptr, u32 fifth)
126132
{
127133
int version;
128134
u32 pad;
@@ -195,5 +201,11 @@ COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second,
195201

196202
return -ENOSYS;
197203
}
204+
205+
COMPAT_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+
}
198210
#endif
199211
#endif

kernel/sys_ni.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ COND_SYSCALL(kexec_file_load);
366366
/* s390 */
367367
COND_SYSCALL(s390_pci_mmio_read);
368368
COND_SYSCALL(s390_pci_mmio_write);
369+
COND_SYSCALL(s390_ipc);
369370
COND_SYSCALL_COMPAT(s390_ipc);
370371

371372
/* powerpc */

0 commit comments

Comments
 (0)