mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Kees Cook <keescook@chromium.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Russell King <linux@arm.linux.org.uk>,
	Geremy Condra <gcondra@google.com>,
	Catalin Marinas <Catalin.Marinas@arm.com>,
	Al Viro <viro@zeniv.linux.org.uk>, Will Drewry <wad@chromium.org>
Subject: Re: [PATCH 2/4] arch/arm: move secure_computing into trace
Date: Fri, 9 Nov 2012 11:56:08 +0000	[thread overview]
Message-ID: <20121109115607.GA4489@mudshark.cambridge.arm.com> (raw)
In-Reply-To: <1352408373-25047-3-git-send-email-keescook@chromium.org>

One really minor nit...

On Thu, Nov 08, 2012 at 08:59:31PM +0000, Kees Cook wrote:
> There is very little difference in the TIF_SECCOMP and TIF_SYSCALL_WORK
> path in entry-common.S, so merge TIF_SECCOMP into TIF_SYSCALL_WORK and
> move seccomp into the syscall_trace_enter() handler.
> 
> Expanded some of the tracehook logic into the callers to make this code
> more readable. Since tracehook needs to do register changing, this portion
> is best left in its own function instead of copy/pasting into the callers.
> 
> Additionally, the return value for secure_computing() is now checked
> and a -1 value will result in the system call being skipped.
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>

[...]

> @@ -944,19 +939,39 @@ static int ptrace_syscall_trace(struct pt_regs *regs, int scno,
>  
>  asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno)
>  {
> -	scno = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_ENTER);
> +	current_thread_info()->syscall = scno;
> +
> +	/* do the secure computing check first */
> +	if (secure_computing(scno) == -1) {
> +		/* seccomp failures shouldn't expose any additional code. */
> +		scno = -1;
> +		goto out;
> +	}

Can we just return -1 here instead please? The whole jump label code makes
this code messier than it needs to be and there's no cleanup to be done.

> +	if (test_thread_flag(TIF_SYSCALL_TRACE))
> +		scno = tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);
> +
>  	if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
>  		trace_sys_enter(regs, scno);
> +
>  	audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, regs->ARM_r1,
>  			    regs->ARM_r2, regs->ARM_r3);
> +
> +out:
>  	return scno;
>  }

Cheers,

Will


  reply	other threads:[~2012-11-09 11:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-08 20:59 [PATCH v4 0/4] arch/arm: support seccomp Kees Cook
2012-11-08 20:59 ` [PATCH 1/4] arch/arm: add syscall_get_arch Kees Cook
2012-11-08 20:59 ` [PATCH 2/4] arch/arm: move secure_computing into trace Kees Cook
2012-11-09 11:56   ` Will Deacon [this message]
2012-11-08 20:59 ` [PATCH 3/4] arch/arm: allow a scno of -1 to not cause a SIGILL Kees Cook
2012-11-08 20:59 ` [PATCH 4/4] arch/arm: select HAVE_ARCH_SECCOMP_FILTER Kees Cook
2012-11-08 21:22 ` [PATCH v4 0/4] arch/arm: support seccomp Nicolas Pitre
  -- strict thread matches above, loose matches on Subject: below --
2012-11-10 22:44 [PATCH v5 " Kees Cook
2012-11-10 22:44 ` [PATCH 2/4] arch/arm: move secure_computing into trace Kees Cook
2012-11-02  0:14 [PATCH v3 0/4] arch/arm: support seccomp Kees Cook
2012-11-02  0:14 ` [PATCH 2/4] arch/arm: move secure_computing into trace Kees Cook
2012-11-01 19:46 [PATCH v2 0/4] arch/arm: support seccomp Kees Cook
2012-11-01 19:46 ` [PATCH 2/4] arch/arm: move secure_computing into trace Kees Cook
2012-11-01 20:33   ` Russell King - ARM Linux
2012-11-01 20:50     ` Kees Cook
2012-10-30  0:41 [PATCH 0/4] arch/arm: support seccomp Kees Cook
2012-10-30  0:41 ` [PATCH 2/4] arch/arm: move secure_computing into trace Kees Cook
2012-10-30  2:05   ` Al Viro
2012-10-31  0:13     ` Kees Cook

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=20121109115607.GA4489@mudshark.cambridge.arm.com \
    --to=will.deacon@arm.com \
    --cc=Catalin.Marinas@arm.com \
    --cc=gcondra@google.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=viro@zeniv.linux.org.uk \
    --cc=wad@chromium.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

Powered by JetHome