i386 seccomp fix for auditing/ptrace
PATCH 1/1 i386 seccomp fix for auditing/ptrace
Hello,
This is the same issue as ppc64 before, when returning to userland we shouldn't re-compute the seccomp check or the task could be killed during sigreturn when orig_eax is overwritten by the sigreturn syscall. This was found by Roland.
This was harmless from a security standpoint, but some i686 users reported failures with auditing enabled system wide (some distro surprisingly makes it the default) and I reproduced it too by keeping the whole workload under strace -f.
Patch is tested and works for me under strace -f.
nobody@athlon:~/cpushare> strace -o /tmp/o -f python seccomp_test.py
make: Nothing to be done for `seccomp_test'.
Starting computing some malicious bytecode
init
load
start
stopreceive_data failure
killexit_code 0 signal 9
The malicious bytecode has been killed successfully by seccomp Starting computing some safe bytecode
init
load
start
stop
174 counts
killexit_code 0 signal 0
The seccomp_test.py completed successfully, thank you for testing.
Thanks.
arch/i386/kernel/ptrace.c +3 -2
@@ -680,8 +680,9 @@ __attribute__((regparm (3 )))void do_syscall_trace (struct pt_regs *regs,int entryexit) { -/* do the secure computing check first */ -secure_computing (regs->orig_eax); +if (!entryexit) +/* do the secure computing check first */ +secure_computing (regs->orig_eax);if (unlikely (current->audit_context) && entryexit)audit_syscall_exit (current,AUDITSC_RESULT (regs->eax), regs->eax);