mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
s390: enable HAVE_FUNCTION_ERROR_INJECTION
This kernel feature is required for enabling BPF_KPROBE_OVERRIDE. Define override_function_with_return() and regs_set_return_value() functions, and fix compile errors in syscall_wrapper.h. Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
parent
4631f3ca49
commit
73d6eb48d2
@ -145,6 +145,7 @@ config S390
|
||||
select HAVE_EFFICIENT_UNALIGNED_ACCESS
|
||||
select HAVE_FENTRY
|
||||
select HAVE_FTRACE_MCOUNT_RECORD
|
||||
select HAVE_FUNCTION_ERROR_INJECTION
|
||||
select HAVE_FUNCTION_GRAPH_TRACER
|
||||
select HAVE_FUNCTION_TRACER
|
||||
select HAVE_FUTEX_CMPXCHG if FUTEX
|
||||
|
@ -184,5 +184,10 @@ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
|
||||
return regs->gprs[15];
|
||||
}
|
||||
|
||||
static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc)
|
||||
{
|
||||
regs->gprs[2] = rc;
|
||||
}
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* _S390_PTRACE_H */
|
||||
|
@ -30,7 +30,7 @@
|
||||
})
|
||||
|
||||
#define __S390_SYS_STUBx(x, name, ...) \
|
||||
asmlinkage long __s390_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__))\
|
||||
asmlinkage long __s390_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__));\
|
||||
ALLOW_ERROR_INJECTION(__s390_sys##name, ERRNO); \
|
||||
asmlinkage long __s390_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__))\
|
||||
{ \
|
||||
@ -46,7 +46,7 @@
|
||||
#define COMPAT_SYSCALL_DEFINE0(sname) \
|
||||
SYSCALL_METADATA(_##sname, 0); \
|
||||
asmlinkage long __s390_compat_sys_##sname(void); \
|
||||
ALLOW_ERROR_INJECTION(__s390_compat__sys_##sname, ERRNO); \
|
||||
ALLOW_ERROR_INJECTION(__s390_compat_sys_##sname, ERRNO); \
|
||||
asmlinkage long __s390_compat_sys_##sname(void)
|
||||
|
||||
#define SYSCALL_DEFINE0(sname) \
|
||||
@ -72,7 +72,7 @@
|
||||
asmlinkage long __s390_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
|
||||
asmlinkage long __s390_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
|
||||
__attribute__((alias(__stringify(__se_compat_sys##name)))); \
|
||||
ALLOW_ERROR_INJECTION(compat_sys##name, ERRNO); \
|
||||
ALLOW_ERROR_INJECTION(__s390_compat_sys##name, ERRNO); \
|
||||
static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
|
||||
asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
|
||||
asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
|
||||
|
@ -14,3 +14,5 @@ KASAN_SANITIZE_uaccess.o := n
|
||||
|
||||
obj-$(CONFIG_S390_UNWIND_SELFTEST) += test_unwind.o
|
||||
CFLAGS_test_unwind.o += -fno-optimize-sibling-calls
|
||||
|
||||
lib-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o
|
||||
|
14
arch/s390/lib/error-inject.c
Normal file
14
arch/s390/lib/error-inject.c
Normal file
@ -0,0 +1,14 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
#include <asm/ptrace.h>
|
||||
#include <linux/error-injection.h>
|
||||
#include <linux/kprobes.h>
|
||||
|
||||
void override_function_with_return(struct pt_regs *regs)
|
||||
{
|
||||
/*
|
||||
* Emulate 'br 14'. 'regs' is captured by kprobes on entry to some
|
||||
* kernel function.
|
||||
*/
|
||||
regs->psw.addr = regs->gprs[14];
|
||||
}
|
||||
NOKPROBE_SYMBOL(override_function_with_return);
|
Loading…
Reference in New Issue
Block a user