提交 8156b451 编写于 作者: W Will Drewry 提交者: James Morris

seccomp: fix build warnings when there is no CONFIG_SECCOMP_FILTER

If both audit and seccomp filter support are disabled, 'ret' is marked
as unused.

If just seccomp filter support is disabled, data and skip are considered
unused.

This change fixes those build warnings.
Reported-by: NStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: NWill Drewry <wad@chromium.org>
Acked-by: NKees Cook <keescook@chromium.org>
Signed-off-by: NJames Morris <james.l.morris@oracle.com>
上级 e4da89d0
...@@ -377,8 +377,7 @@ int __secure_computing(int this_syscall) ...@@ -377,8 +377,7 @@ int __secure_computing(int this_syscall)
int mode = current->seccomp.mode; int mode = current->seccomp.mode;
int exit_sig = 0; int exit_sig = 0;
int *syscall; int *syscall;
u32 ret = SECCOMP_RET_KILL; u32 ret;
int data;
switch (mode) { switch (mode) {
case SECCOMP_MODE_STRICT: case SECCOMP_MODE_STRICT:
...@@ -392,12 +391,15 @@ int __secure_computing(int this_syscall) ...@@ -392,12 +391,15 @@ int __secure_computing(int this_syscall)
return 0; return 0;
} while (*++syscall); } while (*++syscall);
exit_sig = SIGKILL; exit_sig = SIGKILL;
ret = SECCOMP_RET_KILL;
break; break;
#ifdef CONFIG_SECCOMP_FILTER #ifdef CONFIG_SECCOMP_FILTER
case SECCOMP_MODE_FILTER: case SECCOMP_MODE_FILTER: {
int data;
ret = seccomp_run_filters(this_syscall); ret = seccomp_run_filters(this_syscall);
data = ret & SECCOMP_RET_DATA; data = ret & SECCOMP_RET_DATA;
switch (ret & SECCOMP_RET_ACTION) { ret &= SECCOMP_RET_ACTION;
switch (ret) {
case SECCOMP_RET_ERRNO: case SECCOMP_RET_ERRNO:
/* Set the low-order 16-bits as a errno. */ /* Set the low-order 16-bits as a errno. */
syscall_set_return_value(current, task_pt_regs(current), syscall_set_return_value(current, task_pt_regs(current),
...@@ -432,6 +434,7 @@ int __secure_computing(int this_syscall) ...@@ -432,6 +434,7 @@ int __secure_computing(int this_syscall)
} }
exit_sig = SIGSYS; exit_sig = SIGSYS;
break; break;
}
#endif #endif
default: default:
BUG(); BUG();
...@@ -442,8 +445,10 @@ int __secure_computing(int this_syscall) ...@@ -442,8 +445,10 @@ int __secure_computing(int this_syscall)
#endif #endif
audit_seccomp(this_syscall, exit_sig, ret); audit_seccomp(this_syscall, exit_sig, ret);
do_exit(exit_sig); do_exit(exit_sig);
#ifdef CONFIG_SECCOMP_FILTER
skip: skip:
audit_seccomp(this_syscall, exit_sig, ret); audit_seccomp(this_syscall, exit_sig, ret);
#endif
return -1; return -1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册