提交 c63cb468 编写于 作者: H Heiko Carstens 提交者: Martin Schwidefsky

s390/seccomp: add support for system call filtering using BPF

Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
上级 e206d3da
...@@ -124,6 +124,7 @@ config S390 ...@@ -124,6 +124,7 @@ config S390
select GENERIC_TIME_VSYSCALL select GENERIC_TIME_VSYSCALL
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select KTIME_SCALAR if 32BIT select KTIME_SCALAR if 32BIT
select HAVE_ARCH_SECCOMP_FILTER
config SCHED_OMIT_FRAME_POINTER config SCHED_OMIT_FRAME_POINTER
def_bool y def_bool y
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#ifndef _ASM_SYSCALL_H #ifndef _ASM_SYSCALL_H
#define _ASM_SYSCALL_H 1 #define _ASM_SYSCALL_H 1
#include <linux/audit.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/err.h> #include <linux/err.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
...@@ -87,4 +88,13 @@ static inline void syscall_set_arguments(struct task_struct *task, ...@@ -87,4 +88,13 @@ static inline void syscall_set_arguments(struct task_struct *task,
regs->orig_gpr2 = args[0]; regs->orig_gpr2 = args[0];
} }
static inline int syscall_get_arch(struct task_struct *task,
struct pt_regs *regs)
{
#ifdef CONFIG_COMPAT
if (test_tsk_thread_flag(task, TIF_31BIT))
return AUDIT_ARCH_S390;
#endif
return sizeof(long) == 8 ? AUDIT_ARCH_S390X : AUDIT_ARCH_S390;
}
#endif /* _ASM_SYSCALL_H */ #endif /* _ASM_SYSCALL_H */
...@@ -719,7 +719,11 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs) ...@@ -719,7 +719,11 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
long ret = 0; long ret = 0;
/* Do the secure computing check first. */ /* Do the secure computing check first. */
secure_computing_strict(regs->gprs[2]); if (secure_computing(regs->gprs[2])) {
/* seccomp failures shouldn't expose any additional code. */
ret = -1;
goto out;
}
/* /*
* The sysc_tracesys code in entry.S stored the system * The sysc_tracesys code in entry.S stored the system
...@@ -745,6 +749,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs) ...@@ -745,6 +749,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
regs->gprs[2], regs->orig_gpr2, regs->gprs[2], regs->orig_gpr2,
regs->gprs[3], regs->gprs[4], regs->gprs[3], regs->gprs[4],
regs->gprs[5]); regs->gprs[5]);
out:
return ret ?: regs->gprs[2]; return ret ?: regs->gprs[2];
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册