[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140815143346.GV27466@arm.com>
Date: Fri, 15 Aug 2014 15:33:46 +0100
From: Will Deacon <will.deacon@....com>
To: AKASHI Takahiro <takahiro.akashi@...aro.org>
Cc: "linaro-kernel@...ts.linaro.org" <linaro-kernel@...ts.linaro.org>,
Will Drewry <wad@...omium.org>,
Kees Cook <keescook@...omium.org>,
Catalin Marinas <Catalin.Marinas@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Andy Lutomirski <luto@...capital.net>,
Deepak Saxena <dsaxena@...aro.org>,
Lee Campbell <leecam@...gle.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v5 3/3] arm64: Add seccomp support
On Tue, Aug 12, 2014 at 12:17:53PM +0100, AKASHI Takahiro wrote:
> On 08/12/2014 06:40 PM, Will Deacon wrote:
> > On Tue, Aug 12, 2014 at 07:57:25AM +0100, AKASHI Takahiro wrote:
> >>
> >> > case SECCOMP_MODE_FILTER:
> >> > case SECCOMP_RET_TRACE:
> >> > ...
> >> > if (syscall_get_nr(current, regs) < 0)
> >> > goto skip;
> >>
> >> This implies that we should modify syscallno *before* __secure_computing()
> >> returns.
> >
> > Why does it imply that? There are four competing entities here:
> >
> > - seccomp
> > - tracehook
> > - ftrace (trace_sys_*)
> > - audit
> >
> > With the exception of ftrace, they can all potentially rewrite the pt_regs
> > (the code you cite above is just below a ptrace_event call), so we have
> > to choose some order in which to call them.
>
> (audit won't change registers.)
Sorry, you're quite right.
> > On entry, x86 and arm call them in the order I listed above, so it seems
> > sensible to follow that.
>
> Right, but as far as I understand, ptrace_event() in __secure_computing()
> calls ptrace_notify(), and eventually executes ptrace_stop(), which can
> be stopped while tracer runs (until ptrace(PTRACE_CONT)?).
> So syscall_get_nr() is expected to return -1 if trace changes a syscall number to -1
> (as far as sycall_get_nr() refers to syscallno in pt_regs).
>
> That is why I think we should have PTRACE_SET_SYSCALL.
Gotcha, yeah that looks like the cleanest approach after all. Thanks for the
explanation.
Will
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists