linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: keescook@chromium.org (Kees Cook)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/4] arch/arm: allow a scno of -1 to not cause a SIGILL
Date: Sat, 10 Nov 2012 14:44:44 -0800	[thread overview]
Message-ID: <1352587485-18348-4-git-send-email-keescook@chromium.org> (raw)
In-Reply-To: <1352587485-18348-1-git-send-email-keescook@chromium.org>

On tracehook-friendly platforms, a system call number of -1 falls
through without running much code or taking much action.

ARM is different. This adds a short-circuit check in the trace path to
avoid any additional work, as suggested by Russell King, to make sure
that ARM behaves the same way as other platforms.

Signed-off-by: Kees Cook <keescook@chromium.org>
---
 arch/arm/kernel/entry-common.S |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 8355d4b..0bef977 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -448,7 +448,10 @@ __sys_trace:
 	ldmccia	r1, {r0 - r6}			@ have to reload r0 - r6
 	stmccia	sp, {r4, r5}			@ and update the stack args
 	ldrcc	pc, [tbl, scno, lsl #2]		@ call sys_* routine
-	b	2b
+	cmp	scno, #-1			@ skip the syscall?
+	bne	2b
+	add	sp, sp, #S_OFF			@ restore stack
+	b	ret_slow_syscall
 
 __sys_trace_return:
 	str	r0, [sp, #S_R0 + S_OFF]!	@ save returned r0
-- 
1.7.9.5

  parent reply	other threads:[~2012-11-10 22:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-10 22:44 [PATCH v5 0/4] arch/arm: support seccomp Kees Cook
2012-11-10 22:44 ` [PATCH 1/4] arch/arm: add syscall_get_arch Kees Cook
2012-11-10 22:44 ` [PATCH 2/4] arch/arm: move secure_computing into trace Kees Cook
2012-11-10 22:44 ` Kees Cook [this message]
2012-11-10 22:44 ` [PATCH 4/4] arch/arm: select HAVE_ARCH_SECCOMP_FILTER Kees Cook
2012-11-13 19:23 ` [PATCH v5 0/4] arch/arm: support seccomp Andy Lutomirski
2012-11-14 19:05   ` Kees Cook
2012-11-14 19:07 ` Kees Cook
2012-11-15 13:25   ` Will Deacon
2012-11-15 20:23     ` Kees Cook
2012-11-15 21:02       ` Will Deacon
2012-11-15 20:34     ` Will Drewry

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=1352587485-18348-4-git-send-email-keescook@chromium.org \
    --to=keescook@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).