* [PATCH 2/5] ipc: introduce ksys_ipc()/compat_ksys_ipc() for s390
[not found] <20190116131527.2071570-1-arnd@arndb.de>
@ 2019-01-16 13:15 ` Arnd Bergmann
2019-01-17 13:29 ` Heiko Carstens
0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2019-01-16 13:15 UTC (permalink / raw)
To: linux-s390, Martin Schwidefsky, Heiko Carstens
Cc: linux-kernel, y2038, Dominik Brodowski, Mark Rutland,
Arnd Bergmann, linux-api
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.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/s390/kernel/compat_linux.c | 2 +-
arch/s390/kernel/sys_s390.c | 2 +-
include/linux/syscalls.h | 4 ++++
ipc/syscall.c | 20 ++++++++++++++++----
4 files changed, 22 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,
{
if (call >> 16) /* hack for backward compatibility */
return -EINVAL;
- return compat_sys_ipc(call, first, second, third, ptr, third);
+ return compat_ksys_ipc(call, first, second, third, ptr, third);
}
#endif
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index 560bdaf8a74f..6aa8fe00b39e 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -74,7 +74,7 @@ SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second,
* Therefore we can call the generic variant by simply passing the
* third parameter also as fifth parameter.
*/
- return sys_ipc(call, first, second, third, ptr, third);
+ return ksys_ipc(call, first, second, third, ptr, third);
}
SYSCALL_DEFINE1(s390_personality, unsigned int, personality)
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,
unsigned long prot, unsigned long flags,
unsigned long fd, unsigned long pgoff);
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
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 @@
#include <linux/shm.h>
#include <linux/uaccess.h>
-SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second,
- unsigned long, third, void __user *, ptr, long, fifth)
+int ksys_ipc(unsigned int call, int first, unsigned long second,
+ unsigned long third, void __user * ptr, long fifth)
{
int version, ret;
@@ -106,6 +106,12 @@ SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second,
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
#ifdef CONFIG_COMPAT
@@ -121,8 +127,8 @@ struct compat_ipc_kludge {
};
#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
-COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second,
- u32, third, compat_uptr_t, ptr, u32, fifth)
+int compat_ksys_ipc(u32 call, int first, int second,
+ u32 third, compat_uptr_t ptr, u32 fifth)
{
int version;
u32 pad;
@@ -195,5 +201,11 @@ COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second,
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
--
2.20.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/5] ipc: introduce ksys_ipc()/compat_ksys_ipc() for s390
2019-01-16 13:15 ` [PATCH 2/5] ipc: introduce ksys_ipc()/compat_ksys_ipc() for s390 Arnd Bergmann
@ 2019-01-17 13:29 ` Heiko Carstens
2019-01-17 16:29 ` Arnd Bergmann
0 siblings, 1 reply; 4+ messages in thread
From: Heiko Carstens @ 2019-01-17 13:29 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-s390, Martin Schwidefsky, linux-kernel, y2038,
Dominik Brodowski, Mark Rutland, linux-api
On Wed, Jan 16, 2019 at 02:15:20PM +0100, Arnd Bergmann wrote:
> 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.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> arch/s390/kernel/compat_linux.c | 2 +-
> arch/s390/kernel/sys_s390.c | 2 +-
> include/linux/syscalls.h | 4 ++++
> ipc/syscall.c | 20 ++++++++++++++++----
> 4 files changed, 22 insertions(+), 6 deletions(-)
The patch below is needed as compile fix (allnoconfig).
I will add this to your patch, no resend needed.
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index 6aa8fe00b39e..fd0cbbed4d9f 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -58,6 +58,7 @@ SYSCALL_DEFINE1(mmap2, struct s390_mmap_arg_struct __user *, arg)
return error;
}
+#ifdef CONFIG_SYSVIPC
/*
* sys_ipc() is the de-multiplexer for the SysV IPC calls.
*/
@@ -76,6 +77,7 @@ SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second,
*/
return ksys_ipc(call, first, second, third, ptr, third);
}
+#endif /* CONFIG_SYSVIPC */
SYSCALL_DEFINE1(s390_personality, unsigned int, personality)
{
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index ab9d0e3c6d50..ad016a7db0ea 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -366,7 +366,7 @@ COND_SYSCALL(kexec_file_load);
/* s390 */
COND_SYSCALL(s390_pci_mmio_read);
COND_SYSCALL(s390_pci_mmio_write);
-COND_SYSCALL_COMPAT(s390_ipc);
+COND_SYSCALL(s390_ipc);
/* powerpc */
COND_SYSCALL(rtas);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/5] ipc: introduce ksys_ipc()/compat_ksys_ipc() for s390
2019-01-17 13:29 ` Heiko Carstens
@ 2019-01-17 16:29 ` Arnd Bergmann
2019-01-17 20:13 ` Heiko Carstens
0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2019-01-17 16:29 UTC (permalink / raw)
To: Heiko Carstens
Cc: linux-s390, Martin Schwidefsky, Linux Kernel Mailing List,
y2038 Mailman List, Dominik Brodowski, Mark Rutland, Linux API
On Thu, Jan 17, 2019 at 2:29 PM Heiko Carstens
<heiko.carstens@de.ibm.com> wrote:
> diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
> index 6aa8fe00b39e..fd0cbbed4d9f 100644
> --- a/arch/s390/kernel/sys_s390.c
> +++ b/arch/s390/kernel/sys_s390.c
> @@ -58,6 +58,7 @@ SYSCALL_DEFINE1(mmap2, struct s390_mmap_arg_struct __user *, arg)
> return error;
> }
>
> +#ifdef CONFIG_SYSVIPC
> /*
> * sys_ipc() is the de-multiplexer for the SysV IPC calls.
> */
> @@ -76,6 +77,7 @@ SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second,
> */
> return ksys_ipc(call, first, second, third, ptr, third);
> }
> +#endif /* CONFIG_SYSVIPC */
Ack.
> SYSCALL_DEFINE1(s390_personality, unsigned int, personality)
> {
> diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
> index ab9d0e3c6d50..ad016a7db0ea 100644
> --- a/kernel/sys_ni.c
> +++ b/kernel/sys_ni.c
> @@ -366,7 +366,7 @@ COND_SYSCALL(kexec_file_load);
> /* s390 */
> COND_SYSCALL(s390_pci_mmio_read);
> COND_SYSCALL(s390_pci_mmio_write);
> -COND_SYSCALL_COMPAT(s390_ipc);
> +COND_SYSCALL(s390_ipc);
>
> /* powerpc */
> COND_SYSCALL(rtas);
I think you need to keep the
COND_SYSCALL_COMPAT(s390_ipc);
here, otherwise it still fails with CONFIG_SYSV_IPC=n, CONFIG_COMPAT=y, right?
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/5] ipc: introduce ksys_ipc()/compat_ksys_ipc() for s390
2019-01-17 16:29 ` Arnd Bergmann
@ 2019-01-17 20:13 ` Heiko Carstens
0 siblings, 0 replies; 4+ messages in thread
From: Heiko Carstens @ 2019-01-17 20:13 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-s390, Martin Schwidefsky, Linux Kernel Mailing List,
y2038 Mailman List, Dominik Brodowski, Mark Rutland, Linux API
On Thu, Jan 17, 2019 at 05:29:55PM +0100, Arnd Bergmann wrote:
> On Thu, Jan 17, 2019 at 2:29 PM Heiko Carstens
> > SYSCALL_DEFINE1(s390_personality, unsigned int, personality)
> > {
> > diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
> > index ab9d0e3c6d50..ad016a7db0ea 100644
> > --- a/kernel/sys_ni.c
> > +++ b/kernel/sys_ni.c
> > @@ -366,7 +366,7 @@ COND_SYSCALL(kexec_file_load);
> > /* s390 */
> > COND_SYSCALL(s390_pci_mmio_read);
> > COND_SYSCALL(s390_pci_mmio_write);
> > -COND_SYSCALL_COMPAT(s390_ipc);
> > +COND_SYSCALL(s390_ipc);
> >
> > /* powerpc */
> > COND_SYSCALL(rtas);
>
> I think you need to keep the
>
> COND_SYSCALL_COMPAT(s390_ipc);
>
> here, otherwise it still fails with CONFIG_SYSV_IPC=n, CONFIG_COMPAT=y, right?
Yes, you're right.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-01-17 20:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20190116131527.2071570-1-arnd@arndb.de>
2019-01-16 13:15 ` [PATCH 2/5] ipc: introduce ksys_ipc()/compat_ksys_ipc() for s390 Arnd Bergmann
2019-01-17 13:29 ` Heiko Carstens
2019-01-17 16:29 ` Arnd Bergmann
2019-01-17 20:13 ` Heiko Carstens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).