All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@cpushare.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Roland McGrath <roland@redhat.com>,
	linux-kernel@vger.kernel.org, cpushare-devel@cpushare.com
Subject: [patch] i386 seccomp fix for auditing/ptrace
Date: Mon, 5 Sep 2005 05:54:32 +0200	[thread overview]
Message-ID: <20050905035432.GG17185@g5.random> (raw)

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
stop
receive_data failure
kill
exit_code 0 signal 9
The malicious bytecode has been killed successfully by seccomp
Starting computing some safe bytecode
init
load
start
stop
174 counts
kill
exit_code 0 signal 0
The seccomp_test.py completed successfully, thank you for testing.

Thanks.

Signed-off-by: Andrea Arcangeli <andrea@cpushare.com>

diff -r 1df7bfbb783f arch/i386/kernel/ptrace.c
--- a/arch/i386/kernel/ptrace.c	Fri Sep  2 09:01:35 2005
+++ b/arch/i386/kernel/ptrace.c	Mon Sep  5 05:30:49 2005
@@ -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);

                 reply	other threads:[~2005-09-05  3:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050905035432.GG17185@g5.random \
    --to=andrea@cpushare.com \
    --cc=akpm@osdl.org \
    --cc=cpushare-devel@cpushare.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.