linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Mickaël Salaün" <mic@digikod.net>
To: linux-kernel@vger.kernel.org
Cc: "Mickaël Salaün" <mic@digikod.net>,
	"Kees Cook" <keescook@chromium.org>,
	"Jeff Dike" <jdike@addtoit.com>,
	"Richard Weinberger" <richard@nod.at>,
	"James Morris" <jmorris@namei.org>,
	"Olof Johansson" <olof@lixom.net>,
	user-mode-linux-devel@lists.sourceforge.net,
	linux-security-module@vger.kernel.org
Subject: [PATCH v2 1/3] um/ptrace: Fix the syscall_trace_leave call
Date: Mon,  1 Aug 2016 23:01:55 +0200	[thread overview]
Message-ID: <1470085317-11932-2-git-send-email-mic@digikod.net> (raw)
In-Reply-To: <1470085317-11932-1-git-send-email-mic@digikod.net>

Keep the same semantic as before the commit 26703c636c1f: deallocate
audit context and fake a proper syscall exit.

This fix a kernel panic triggered by the seccomp_bpf test:
> [ RUN      ] global.ERRNO_valid
> BUG: failure at kernel/auditsc.c:1504/__audit_syscall_entry()!
> Kernel panic - not syncing: BUG!

Fixes: 26703c636c1f ("um/ptrace: run seccomp after ptrace")

Signed-off-by: Mickaël Salaün <mic@digikod.net>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: James Morris <jmorris@namei.org>
Cc: user-mode-linux-devel@lists.sourceforge.net
---
 arch/um/kernel/skas/syscall.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/um/kernel/skas/syscall.c b/arch/um/kernel/skas/syscall.c
index ef4b8f949b51..0728fee94398 100644
--- a/arch/um/kernel/skas/syscall.c
+++ b/arch/um/kernel/skas/syscall.c
@@ -21,11 +21,11 @@ void handle_syscall(struct uml_pt_regs *r)
 	PT_REGS_SET_SYSCALL_RETURN(regs, -ENOSYS);
 
 	if (syscall_trace_enter(regs))
-		return;
+		goto out;
 
 	/* Do the seccomp check after ptrace; failures should be fast. */
 	if (secure_computing(NULL) == -1)
-		return;
+		goto out;
 
 	/* Update the syscall number after orig_ax has potentially been updated
 	 * with ptrace.
@@ -37,5 +37,6 @@ void handle_syscall(struct uml_pt_regs *r)
 		PT_REGS_SET_SYSCALL_RETURN(regs,
 				EXECUTE_SYSCALL(syscall, regs));
 
+out:
 	syscall_trace_leave(regs);
 }
-- 
2.8.1

  reply	other threads:[~2016-08-01 21:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-11 21:56 [PATCH v1 0/3] Fix seccomp for UM (next) Mickaël Salaün
2016-07-11 21:57 ` [PATCH v1 1/3] um/ptrace: Fix the syscall_trace_leave call Mickaël Salaün
2016-07-11 21:57 ` [PATCH v1 2/3] um/ptrace: Fix the syscall number update after a ptrace Mickaël Salaün
2016-07-11 21:57 ` [PATCH v1 3/3] seccomp: Remove 2-phase API documentation Mickaël Salaün
2016-07-12  1:59 ` [PATCH v1 0/3] Fix seccomp for UM (next) Kees Cook
2016-07-28 18:29   ` Kees Cook
2016-08-01  0:54     ` James Morris
2016-08-01 21:01       ` [PATCH v2 " Mickaël Salaün
2016-08-01 21:01         ` Mickaël Salaün [this message]
2016-08-01 21:01         ` [PATCH v2 2/3] um/ptrace: Fix the syscall number update after a ptrace Mickaël Salaün
2016-08-01 21:01         ` [PATCH v2 3/3] seccomp: Remove 2-phase API documentation Mickaël Salaün
2016-08-09  0:35         ` [PATCH v2 0/3] Fix seccomp for UM (next) James Morris
2016-09-06 20:31           ` [PATCH v2 0/3] Fix seccomp for UM Mickaël Salaün

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=1470085317-11932-2-git-send-email-mic@digikod.net \
    --to=mic@digikod.net \
    --cc=jdike@addtoit.com \
    --cc=jmorris@namei.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=richard@nod.at \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).