s390: autogenerate compat syscall wrappers
Any system call that takes a pointer argument on s390 requires
a wrapper function to do a 31-to-64 zero-extension, these are
currently generated in arch/s390/kernel/compat_wrapper.c.
On arm64 and x86, we already generate similar wrappers for all
system calls in the place of their definition, just for a different
purpose (they load the arguments from pt_regs).
We can do the same thing here, by adding an asm/syscall_wrapper.h
file with a copy of all the relevant macros to override the generic
version. Besides the addition of the compat entry point, these also
rename the entry points with a __s390_ or __s390x_ prefix, similar
to what we do on arm64 and x86. This in turn requires renaming
a few things, and adding a proper ni_syscall() entry point.
In order to still compile system call definitions that pass an
loff_t argument, the __SC_COMPAT_CAST() macro checks for that
and forces an -ENOSYS error, which was the best I could come up
with. Those functions must obviously not get called from user
space, but instead require hand-written compat_sys_*() handlers,
which fortunately already exist.
Link: https://lore.kernel.org/lkml/20190116131527.2071570-5-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>
2019-01-16 13:15:22 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/*
|
|
|
|
* syscall_wrapper.h - s390 specific wrappers to syscall definitions
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ASM_S390_SYSCALL_WRAPPER_H
|
|
|
|
#define _ASM_S390_SYSCALL_WRAPPER_H
|
|
|
|
|
2023-01-23 13:30:46 +00:00
|
|
|
/* Mapping of registers to parameters for syscalls */
|
|
|
|
#define SC_S390_REGS_TO_ARGS(x, ...) \
|
|
|
|
__MAP(x, __SC_ARGS \
|
|
|
|
,, regs->orig_gpr2,, regs->gprs[3],, regs->gprs[4] \
|
|
|
|
,, regs->gprs[5],, regs->gprs[6],, regs->gprs[7])
|
2021-01-18 08:35:38 +00:00
|
|
|
|
s390: autogenerate compat syscall wrappers
Any system call that takes a pointer argument on s390 requires
a wrapper function to do a 31-to-64 zero-extension, these are
currently generated in arch/s390/kernel/compat_wrapper.c.
On arm64 and x86, we already generate similar wrappers for all
system calls in the place of their definition, just for a different
purpose (they load the arguments from pt_regs).
We can do the same thing here, by adding an asm/syscall_wrapper.h
file with a copy of all the relevant macros to override the generic
version. Besides the addition of the compat entry point, these also
rename the entry points with a __s390_ or __s390x_ prefix, similar
to what we do on arm64 and x86. This in turn requires renaming
a few things, and adding a proper ni_syscall() entry point.
In order to still compile system call definitions that pass an
loff_t argument, the __SC_COMPAT_CAST() macro checks for that
and forces an -ENOSYS error, which was the best I could come up
with. Those functions must obviously not get called from user
space, but instead require hand-written compat_sys_*() handlers,
which fortunately already exist.
Link: https://lore.kernel.org/lkml/20190116131527.2071570-5-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>
2019-01-16 13:15:22 +00:00
|
|
|
#ifdef CONFIG_COMPAT
|
|
|
|
|
|
|
|
#define __SC_COMPAT_CAST(t, a) \
|
|
|
|
({ \
|
|
|
|
long __ReS = a; \
|
|
|
|
\
|
|
|
|
BUILD_BUG_ON((sizeof(t) > 4) && !__TYPE_IS_L(t) && \
|
|
|
|
!__TYPE_IS_UL(t) && !__TYPE_IS_PTR(t) && \
|
|
|
|
!__TYPE_IS_LL(t)); \
|
|
|
|
if (__TYPE_IS_L(t)) \
|
|
|
|
__ReS = (s32)a; \
|
|
|
|
if (__TYPE_IS_UL(t)) \
|
|
|
|
__ReS = (u32)a; \
|
|
|
|
if (__TYPE_IS_PTR(t)) \
|
|
|
|
__ReS = a & 0x7fffffff; \
|
|
|
|
if (__TYPE_IS_LL(t)) \
|
|
|
|
return -ENOSYS; \
|
|
|
|
(t)__ReS; \
|
|
|
|
})
|
|
|
|
|
|
|
|
/*
|
|
|
|
* To keep the naming coherent, re-define SYSCALL_DEFINE0 to create an alias
|
|
|
|
* named __s390x_sys_*()
|
|
|
|
*/
|
|
|
|
#define COMPAT_SYSCALL_DEFINE0(sname) \
|
2021-01-18 08:00:58 +00:00
|
|
|
long __s390_compat_sys_##sname(void); \
|
2020-07-22 21:58:54 +00:00
|
|
|
ALLOW_ERROR_INJECTION(__s390_compat_sys_##sname, ERRNO); \
|
2021-01-18 08:00:58 +00:00
|
|
|
long __s390_compat_sys_##sname(void)
|
s390: autogenerate compat syscall wrappers
Any system call that takes a pointer argument on s390 requires
a wrapper function to do a 31-to-64 zero-extension, these are
currently generated in arch/s390/kernel/compat_wrapper.c.
On arm64 and x86, we already generate similar wrappers for all
system calls in the place of their definition, just for a different
purpose (they load the arguments from pt_regs).
We can do the same thing here, by adding an asm/syscall_wrapper.h
file with a copy of all the relevant macros to override the generic
version. Besides the addition of the compat entry point, these also
rename the entry points with a __s390_ or __s390x_ prefix, similar
to what we do on arm64 and x86. This in turn requires renaming
a few things, and adding a proper ni_syscall() entry point.
In order to still compile system call definitions that pass an
loff_t argument, the __SC_COMPAT_CAST() macro checks for that
and forces an -ENOSYS error, which was the best I could come up
with. Those functions must obviously not get called from user
space, but instead require hand-written compat_sys_*() handlers,
which fortunately already exist.
Link: https://lore.kernel.org/lkml/20190116131527.2071570-5-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>
2019-01-16 13:15:22 +00:00
|
|
|
|
|
|
|
#define SYSCALL_DEFINE0(sname) \
|
|
|
|
SYSCALL_METADATA(_##sname, 0); \
|
2023-01-23 13:30:46 +00:00
|
|
|
long __s390_sys_##sname(void); \
|
|
|
|
ALLOW_ERROR_INJECTION(__s390_sys_##sname, ERRNO); \
|
2021-01-18 08:00:58 +00:00
|
|
|
long __s390x_sys_##sname(void); \
|
s390: autogenerate compat syscall wrappers
Any system call that takes a pointer argument on s390 requires
a wrapper function to do a 31-to-64 zero-extension, these are
currently generated in arch/s390/kernel/compat_wrapper.c.
On arm64 and x86, we already generate similar wrappers for all
system calls in the place of their definition, just for a different
purpose (they load the arguments from pt_regs).
We can do the same thing here, by adding an asm/syscall_wrapper.h
file with a copy of all the relevant macros to override the generic
version. Besides the addition of the compat entry point, these also
rename the entry points with a __s390_ or __s390x_ prefix, similar
to what we do on arm64 and x86. This in turn requires renaming
a few things, and adding a proper ni_syscall() entry point.
In order to still compile system call definitions that pass an
loff_t argument, the __SC_COMPAT_CAST() macro checks for that
and forces an -ENOSYS error, which was the best I could come up
with. Those functions must obviously not get called from user
space, but instead require hand-written compat_sys_*() handlers,
which fortunately already exist.
Link: https://lore.kernel.org/lkml/20190116131527.2071570-5-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>
2019-01-16 13:15:22 +00:00
|
|
|
ALLOW_ERROR_INJECTION(__s390x_sys_##sname, ERRNO); \
|
2023-01-23 13:30:46 +00:00
|
|
|
static inline long __do_sys_##sname(void); \
|
2021-01-18 08:00:58 +00:00
|
|
|
long __s390_sys_##sname(void) \
|
2023-01-23 13:30:46 +00:00
|
|
|
{ \
|
|
|
|
return __do_sys_##sname(); \
|
|
|
|
} \
|
|
|
|
long __s390x_sys_##sname(void) \
|
|
|
|
{ \
|
|
|
|
return __do_sys_##sname(); \
|
|
|
|
} \
|
|
|
|
static inline long __do_sys_##sname(void)
|
s390: autogenerate compat syscall wrappers
Any system call that takes a pointer argument on s390 requires
a wrapper function to do a 31-to-64 zero-extension, these are
currently generated in arch/s390/kernel/compat_wrapper.c.
On arm64 and x86, we already generate similar wrappers for all
system calls in the place of their definition, just for a different
purpose (they load the arguments from pt_regs).
We can do the same thing here, by adding an asm/syscall_wrapper.h
file with a copy of all the relevant macros to override the generic
version. Besides the addition of the compat entry point, these also
rename the entry points with a __s390_ or __s390x_ prefix, similar
to what we do on arm64 and x86. This in turn requires renaming
a few things, and adding a proper ni_syscall() entry point.
In order to still compile system call definitions that pass an
loff_t argument, the __SC_COMPAT_CAST() macro checks for that
and forces an -ENOSYS error, which was the best I could come up
with. Those functions must obviously not get called from user
space, but instead require hand-written compat_sys_*() handlers,
which fortunately already exist.
Link: https://lore.kernel.org/lkml/20190116131527.2071570-5-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>
2019-01-16 13:15:22 +00:00
|
|
|
|
|
|
|
#define COND_SYSCALL(name) \
|
|
|
|
cond_syscall(__s390x_sys_##name); \
|
|
|
|
cond_syscall(__s390_sys_##name)
|
|
|
|
|
|
|
|
#define SYS_NI(name) \
|
|
|
|
SYSCALL_ALIAS(__s390x_sys_##name, sys_ni_posix_timers); \
|
|
|
|
SYSCALL_ALIAS(__s390_sys_##name, sys_ni_posix_timers)
|
|
|
|
|
2021-01-18 08:35:38 +00:00
|
|
|
#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
|
|
|
|
long __s390_compat_sys##name(struct pt_regs *regs); \
|
|
|
|
ALLOW_ERROR_INJECTION(__s390_compat_sys##name, ERRNO); \
|
2023-01-23 13:30:46 +00:00
|
|
|
static inline long __se_compat_sys##name(__MAP(x, __SC_LONG, __VA_ARGS__)); \
|
|
|
|
static inline long __do_compat_sys##name(__MAP(x, __SC_DECL, __VA_ARGS__)); \
|
|
|
|
long __s390_compat_sys##name(struct pt_regs *regs) \
|
|
|
|
{ \
|
|
|
|
return __se_compat_sys##name(SC_S390_REGS_TO_ARGS(x, __VA_ARGS__)); \
|
|
|
|
} \
|
|
|
|
static inline long __se_compat_sys##name(__MAP(x, __SC_LONG, __VA_ARGS__)) \
|
2021-01-18 08:35:38 +00:00
|
|
|
{ \
|
2023-01-23 13:30:46 +00:00
|
|
|
__MAP(x, __SC_TEST, __VA_ARGS__); \
|
|
|
|
return __do_compat_sys##name(__MAP(x, __SC_DELOUSE, __VA_ARGS__)); \
|
2021-01-18 08:35:38 +00:00
|
|
|
} \
|
2023-01-23 13:30:46 +00:00
|
|
|
static inline long __do_compat_sys##name(__MAP(x, __SC_DECL, __VA_ARGS__))
|
s390: autogenerate compat syscall wrappers
Any system call that takes a pointer argument on s390 requires
a wrapper function to do a 31-to-64 zero-extension, these are
currently generated in arch/s390/kernel/compat_wrapper.c.
On arm64 and x86, we already generate similar wrappers for all
system calls in the place of their definition, just for a different
purpose (they load the arguments from pt_regs).
We can do the same thing here, by adding an asm/syscall_wrapper.h
file with a copy of all the relevant macros to override the generic
version. Besides the addition of the compat entry point, these also
rename the entry points with a __s390_ or __s390x_ prefix, similar
to what we do on arm64 and x86. This in turn requires renaming
a few things, and adding a proper ni_syscall() entry point.
In order to still compile system call definitions that pass an
loff_t argument, the __SC_COMPAT_CAST() macro checks for that
and forces an -ENOSYS error, which was the best I could come up
with. Those functions must obviously not get called from user
space, but instead require hand-written compat_sys_*() handlers,
which fortunately already exist.
Link: https://lore.kernel.org/lkml/20190116131527.2071570-5-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>
2019-01-16 13:15:22 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* As some compat syscalls may not be implemented, we need to expand
|
|
|
|
* COND_SYSCALL_COMPAT in kernel/sys_ni.c and COMPAT_SYS_NI in
|
|
|
|
* kernel/time/posix-stubs.c to cover this case as well.
|
|
|
|
*/
|
|
|
|
#define COND_SYSCALL_COMPAT(name) \
|
|
|
|
cond_syscall(__s390_compat_sys_##name)
|
|
|
|
|
|
|
|
#define COMPAT_SYS_NI(name) \
|
|
|
|
SYSCALL_ALIAS(__s390_compat_sys_##name, sys_ni_posix_timers)
|
|
|
|
|
2023-01-23 13:30:44 +00:00
|
|
|
#define __S390_SYS_STUBx(x, name, ...) \
|
|
|
|
long __s390_sys##name(struct pt_regs *regs); \
|
|
|
|
ALLOW_ERROR_INJECTION(__s390_sys##name, ERRNO); \
|
2023-01-23 13:30:46 +00:00
|
|
|
static inline long ___se_sys##name(__MAP(x, __SC_LONG, __VA_ARGS__)); \
|
2023-01-23 13:30:44 +00:00
|
|
|
long __s390_sys##name(struct pt_regs *regs) \
|
|
|
|
{ \
|
2023-01-23 13:30:46 +00:00
|
|
|
return ___se_sys##name(SC_S390_REGS_TO_ARGS(x, __VA_ARGS__)); \
|
|
|
|
} \
|
|
|
|
static inline long ___se_sys##name(__MAP(x, __SC_LONG, __VA_ARGS__)) \
|
|
|
|
{ \
|
|
|
|
__MAP(x, __SC_TEST, __VA_ARGS__); \
|
|
|
|
return __do_sys##name(__MAP(x, __SC_COMPAT_CAST, __VA_ARGS__)); \
|
2023-01-23 13:30:44 +00:00
|
|
|
}
|
s390: autogenerate compat syscall wrappers
Any system call that takes a pointer argument on s390 requires
a wrapper function to do a 31-to-64 zero-extension, these are
currently generated in arch/s390/kernel/compat_wrapper.c.
On arm64 and x86, we already generate similar wrappers for all
system calls in the place of their definition, just for a different
purpose (they load the arguments from pt_regs).
We can do the same thing here, by adding an asm/syscall_wrapper.h
file with a copy of all the relevant macros to override the generic
version. Besides the addition of the compat entry point, these also
rename the entry points with a __s390_ or __s390x_ prefix, similar
to what we do on arm64 and x86. This in turn requires renaming
a few things, and adding a proper ni_syscall() entry point.
In order to still compile system call definitions that pass an
loff_t argument, the __SC_COMPAT_CAST() macro checks for that
and forces an -ENOSYS error, which was the best I could come up
with. Those functions must obviously not get called from user
space, but instead require hand-written compat_sys_*() handlers,
which fortunately already exist.
Link: https://lore.kernel.org/lkml/20190116131527.2071570-5-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>
2019-01-16 13:15:22 +00:00
|
|
|
|
2023-01-23 13:30:44 +00:00
|
|
|
#else /* CONFIG_COMPAT */
|
s390: autogenerate compat syscall wrappers
Any system call that takes a pointer argument on s390 requires
a wrapper function to do a 31-to-64 zero-extension, these are
currently generated in arch/s390/kernel/compat_wrapper.c.
On arm64 and x86, we already generate similar wrappers for all
system calls in the place of their definition, just for a different
purpose (they load the arguments from pt_regs).
We can do the same thing here, by adding an asm/syscall_wrapper.h
file with a copy of all the relevant macros to override the generic
version. Besides the addition of the compat entry point, these also
rename the entry points with a __s390_ or __s390x_ prefix, similar
to what we do on arm64 and x86. This in turn requires renaming
a few things, and adding a proper ni_syscall() entry point.
In order to still compile system call definitions that pass an
loff_t argument, the __SC_COMPAT_CAST() macro checks for that
and forces an -ENOSYS error, which was the best I could come up
with. Those functions must obviously not get called from user
space, but instead require hand-written compat_sys_*() handlers,
which fortunately already exist.
Link: https://lore.kernel.org/lkml/20190116131527.2071570-5-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>
2019-01-16 13:15:22 +00:00
|
|
|
|
|
|
|
#define SYSCALL_DEFINE0(sname) \
|
|
|
|
SYSCALL_METADATA(_##sname, 0); \
|
2021-01-18 08:00:58 +00:00
|
|
|
long __s390x_sys_##sname(void); \
|
s390: autogenerate compat syscall wrappers
Any system call that takes a pointer argument on s390 requires
a wrapper function to do a 31-to-64 zero-extension, these are
currently generated in arch/s390/kernel/compat_wrapper.c.
On arm64 and x86, we already generate similar wrappers for all
system calls in the place of their definition, just for a different
purpose (they load the arguments from pt_regs).
We can do the same thing here, by adding an asm/syscall_wrapper.h
file with a copy of all the relevant macros to override the generic
version. Besides the addition of the compat entry point, these also
rename the entry points with a __s390_ or __s390x_ prefix, similar
to what we do on arm64 and x86. This in turn requires renaming
a few things, and adding a proper ni_syscall() entry point.
In order to still compile system call definitions that pass an
loff_t argument, the __SC_COMPAT_CAST() macro checks for that
and forces an -ENOSYS error, which was the best I could come up
with. Those functions must obviously not get called from user
space, but instead require hand-written compat_sys_*() handlers,
which fortunately already exist.
Link: https://lore.kernel.org/lkml/20190116131527.2071570-5-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>
2019-01-16 13:15:22 +00:00
|
|
|
ALLOW_ERROR_INJECTION(__s390x_sys_##sname, ERRNO); \
|
2023-01-23 13:30:46 +00:00
|
|
|
static inline long __do_sys_##sname(void); \
|
|
|
|
long __s390x_sys_##sname(void) \
|
|
|
|
{ \
|
|
|
|
return __do_sys_##sname(); \
|
|
|
|
} \
|
|
|
|
static inline long __do_sys_##sname(void)
|
s390: autogenerate compat syscall wrappers
Any system call that takes a pointer argument on s390 requires
a wrapper function to do a 31-to-64 zero-extension, these are
currently generated in arch/s390/kernel/compat_wrapper.c.
On arm64 and x86, we already generate similar wrappers for all
system calls in the place of their definition, just for a different
purpose (they load the arguments from pt_regs).
We can do the same thing here, by adding an asm/syscall_wrapper.h
file with a copy of all the relevant macros to override the generic
version. Besides the addition of the compat entry point, these also
rename the entry points with a __s390_ or __s390x_ prefix, similar
to what we do on arm64 and x86. This in turn requires renaming
a few things, and adding a proper ni_syscall() entry point.
In order to still compile system call definitions that pass an
loff_t argument, the __SC_COMPAT_CAST() macro checks for that
and forces an -ENOSYS error, which was the best I could come up
with. Those functions must obviously not get called from user
space, but instead require hand-written compat_sys_*() handlers,
which fortunately already exist.
Link: https://lore.kernel.org/lkml/20190116131527.2071570-5-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>
2019-01-16 13:15:22 +00:00
|
|
|
|
|
|
|
#define COND_SYSCALL(name) \
|
|
|
|
cond_syscall(__s390x_sys_##name)
|
|
|
|
|
|
|
|
#define SYS_NI(name) \
|
2023-01-23 13:30:45 +00:00
|
|
|
SYSCALL_ALIAS(__s390x_sys_##name, sys_ni_posix_timers)
|
s390: autogenerate compat syscall wrappers
Any system call that takes a pointer argument on s390 requires
a wrapper function to do a 31-to-64 zero-extension, these are
currently generated in arch/s390/kernel/compat_wrapper.c.
On arm64 and x86, we already generate similar wrappers for all
system calls in the place of their definition, just for a different
purpose (they load the arguments from pt_regs).
We can do the same thing here, by adding an asm/syscall_wrapper.h
file with a copy of all the relevant macros to override the generic
version. Besides the addition of the compat entry point, these also
rename the entry points with a __s390_ or __s390x_ prefix, similar
to what we do on arm64 and x86. This in turn requires renaming
a few things, and adding a proper ni_syscall() entry point.
In order to still compile system call definitions that pass an
loff_t argument, the __SC_COMPAT_CAST() macro checks for that
and forces an -ENOSYS error, which was the best I could come up
with. Those functions must obviously not get called from user
space, but instead require hand-written compat_sys_*() handlers,
which fortunately already exist.
Link: https://lore.kernel.org/lkml/20190116131527.2071570-5-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>
2019-01-16 13:15:22 +00:00
|
|
|
|
2023-01-23 13:30:44 +00:00
|
|
|
#define __S390_SYS_STUBx(x, fullname, name, ...)
|
|
|
|
|
s390: autogenerate compat syscall wrappers
Any system call that takes a pointer argument on s390 requires
a wrapper function to do a 31-to-64 zero-extension, these are
currently generated in arch/s390/kernel/compat_wrapper.c.
On arm64 and x86, we already generate similar wrappers for all
system calls in the place of their definition, just for a different
purpose (they load the arguments from pt_regs).
We can do the same thing here, by adding an asm/syscall_wrapper.h
file with a copy of all the relevant macros to override the generic
version. Besides the addition of the compat entry point, these also
rename the entry points with a __s390_ or __s390x_ prefix, similar
to what we do on arm64 and x86. This in turn requires renaming
a few things, and adding a proper ni_syscall() entry point.
In order to still compile system call definitions that pass an
loff_t argument, the __SC_COMPAT_CAST() macro checks for that
and forces an -ENOSYS error, which was the best I could come up
with. Those functions must obviously not get called from user
space, but instead require hand-written compat_sys_*() handlers,
which fortunately already exist.
Link: https://lore.kernel.org/lkml/20190116131527.2071570-5-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>
2019-01-16 13:15:22 +00:00
|
|
|
#endif /* CONFIG_COMPAT */
|
|
|
|
|
2023-01-23 13:30:46 +00:00
|
|
|
#define __SYSCALL_DEFINEx(x, name, ...) \
|
|
|
|
long __s390x_sys##name(struct pt_regs *regs); \
|
|
|
|
ALLOW_ERROR_INJECTION(__s390x_sys##name, ERRNO); \
|
|
|
|
static inline long __se_sys##name(__MAP(x, __SC_LONG, __VA_ARGS__)); \
|
|
|
|
static inline long __do_sys##name(__MAP(x, __SC_DECL, __VA_ARGS__)); \
|
|
|
|
__S390_SYS_STUBx(x, name, __VA_ARGS__); \
|
|
|
|
long __s390x_sys##name(struct pt_regs *regs) \
|
|
|
|
{ \
|
|
|
|
return __se_sys##name(SC_S390_REGS_TO_ARGS(x, __VA_ARGS__)); \
|
|
|
|
} \
|
|
|
|
static inline long __se_sys##name(__MAP(x, __SC_LONG, __VA_ARGS__)) \
|
|
|
|
{ \
|
|
|
|
__MAP(x, __SC_TEST, __VA_ARGS__); \
|
|
|
|
return __do_sys##name(__MAP(x, __SC_CAST, __VA_ARGS__)); \
|
|
|
|
} \
|
|
|
|
static inline long __do_sys##name(__MAP(x, __SC_DECL, __VA_ARGS__))
|
s390: autogenerate compat syscall wrappers
Any system call that takes a pointer argument on s390 requires
a wrapper function to do a 31-to-64 zero-extension, these are
currently generated in arch/s390/kernel/compat_wrapper.c.
On arm64 and x86, we already generate similar wrappers for all
system calls in the place of their definition, just for a different
purpose (they load the arguments from pt_regs).
We can do the same thing here, by adding an asm/syscall_wrapper.h
file with a copy of all the relevant macros to override the generic
version. Besides the addition of the compat entry point, these also
rename the entry points with a __s390_ or __s390x_ prefix, similar
to what we do on arm64 and x86. This in turn requires renaming
a few things, and adding a proper ni_syscall() entry point.
In order to still compile system call definitions that pass an
loff_t argument, the __SC_COMPAT_CAST() macro checks for that
and forces an -ENOSYS error, which was the best I could come up
with. Those functions must obviously not get called from user
space, but instead require hand-written compat_sys_*() handlers,
which fortunately already exist.
Link: https://lore.kernel.org/lkml/20190116131527.2071570-5-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>
2019-01-16 13:15:22 +00:00
|
|
|
|
2022-03-04 09:01:09 +00:00
|
|
|
#endif /* _ASM_S390_SYSCALL_WRAPPER_H */
|