Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-10-06 Thread AKASHI Takahiro
On 10/04/2014 12:23 AM, Will Deacon wrote: On Wed, Oct 01, 2014 at 12:08:05PM +0100, AKASHI Takahiro wrote: Will, When I was looking into syscall_trace_exit() more closely, I found another (big) problem. There are two system calls, execve() and rt_sigreturn(), which change 'syscallno' in

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-10-06 Thread AKASHI Takahiro
On 10/04/2014 12:23 AM, Will Deacon wrote: On Wed, Oct 01, 2014 at 12:08:05PM +0100, AKASHI Takahiro wrote: Will, When I was looking into syscall_trace_exit() more closely, I found another (big) problem. There are two system calls, execve() and rt_sigreturn(), which change 'syscallno' in

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-10-03 Thread Will Deacon
On Wed, Oct 01, 2014 at 12:08:05PM +0100, AKASHI Takahiro wrote: > Will, > > When I was looking into syscall_trace_exit() more closely, I found > another (big) problem. > There are two system calls, execve() and rt_sigreturn(), which change > 'syscallno' in pt_regs to -1 in start_thread() and

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-10-03 Thread Will Deacon
On Wed, Oct 01, 2014 at 12:08:05PM +0100, AKASHI Takahiro wrote: Will, When I was looking into syscall_trace_exit() more closely, I found another (big) problem. There are two system calls, execve() and rt_sigreturn(), which change 'syscallno' in pt_regs to -1 in start_thread() and

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-10-01 Thread AKASHI Takahiro
Will, When I was looking into syscall_trace_exit() more closely, I found another (big) problem. There are two system calls, execve() and rt_sigreturn(), which change 'syscallno' in pt_regs to -1 in start_thread() and restore_sigframe(), respectively. Since syscallno is not valid anymore in

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-10-01 Thread AKASHI Takahiro
Will, When I was looking into syscall_trace_exit() more closely, I found another (big) problem. There are two system calls, execve() and rt_sigreturn(), which change 'syscallno' in pt_regs to -1 in start_thread() and restore_sigframe(), respectively. Since syscallno is not valid anymore in

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-09-05 Thread AKASHI Takahiro
On 09/02/2014 06:16 PM, Russell King - ARM Linux wrote: On Tue, Sep 02, 2014 at 05:47:29PM +0900, AKASHI Takahiro wrote: On 09/01/2014 08:47 PM, Russell King - ARM Linux wrote: On Wed, Aug 27, 2014 at 02:55:46PM +0900, AKASHI Takahiro wrote: 1) setting x0 to -ENOSYS is necessary because,

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-09-05 Thread AKASHI Takahiro
On 09/02/2014 06:16 PM, Russell King - ARM Linux wrote: On Tue, Sep 02, 2014 at 05:47:29PM +0900, AKASHI Takahiro wrote: On 09/01/2014 08:47 PM, Russell King - ARM Linux wrote: On Wed, Aug 27, 2014 at 02:55:46PM +0900, AKASHI Takahiro wrote: 1) setting x0 to -ENOSYS is necessary because,

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-09-02 Thread Russell King - ARM Linux
On Tue, Sep 02, 2014 at 10:16:22AM +0100, Russell King - ARM Linux wrote: > On Tue, Sep 02, 2014 at 05:47:29PM +0900, AKASHI Takahiro wrote: > > On 09/01/2014 08:47 PM, Russell King - ARM Linux wrote: > >> On Wed, Aug 27, 2014 at 02:55:46PM +0900, AKASHI Takahiro wrote: > >>> 1) > >>> setting x0

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-09-02 Thread Russell King - ARM Linux
On Tue, Sep 02, 2014 at 05:47:29PM +0900, AKASHI Takahiro wrote: > On 09/01/2014 08:47 PM, Russell King - ARM Linux wrote: >> On Wed, Aug 27, 2014 at 02:55:46PM +0900, AKASHI Takahiro wrote: >>> 1) >>> setting x0 to -ENOSYS is necessary because, otherwise, user-issued >>> syscall(-1) will >>>

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-09-02 Thread AKASHI Takahiro
On 09/01/2014 08:47 PM, Russell King - ARM Linux wrote: On Wed, Aug 27, 2014 at 02:55:46PM +0900, AKASHI Takahiro wrote: 1) setting x0 to -ENOSYS is necessary because, otherwise, user-issued syscall(-1) will return a bogus value when audit tracing is on. Please note that, on arm,

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-09-02 Thread AKASHI Takahiro
On 09/01/2014 08:37 PM, Will Deacon wrote: On Wed, Aug 27, 2014 at 06:55:46AM +0100, AKASHI Takahiro wrote: On 08/27/2014 02:51 AM, Will Deacon wrote: On Fri, Aug 22, 2014 at 01:35:17AM +0100, AKASHI Takahiro wrote: Oops, you're absolutely right. I didn't think of this case.

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-09-02 Thread AKASHI Takahiro
On 09/01/2014 08:37 PM, Will Deacon wrote: On Wed, Aug 27, 2014 at 06:55:46AM +0100, AKASHI Takahiro wrote: On 08/27/2014 02:51 AM, Will Deacon wrote: On Fri, Aug 22, 2014 at 01:35:17AM +0100, AKASHI Takahiro wrote: Oops, you're absolutely right. I didn't think of this case.

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-09-02 Thread AKASHI Takahiro
On 09/01/2014 08:47 PM, Russell King - ARM Linux wrote: On Wed, Aug 27, 2014 at 02:55:46PM +0900, AKASHI Takahiro wrote: 1) setting x0 to -ENOSYS is necessary because, otherwise, user-issued syscall(-1) will return a bogus value when audit tracing is on. Please note that, on arm,

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-09-02 Thread Russell King - ARM Linux
On Tue, Sep 02, 2014 at 05:47:29PM +0900, AKASHI Takahiro wrote: On 09/01/2014 08:47 PM, Russell King - ARM Linux wrote: On Wed, Aug 27, 2014 at 02:55:46PM +0900, AKASHI Takahiro wrote: 1) setting x0 to -ENOSYS is necessary because, otherwise, user-issued syscall(-1) will return a bogus

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-09-02 Thread Russell King - ARM Linux
On Tue, Sep 02, 2014 at 10:16:22AM +0100, Russell King - ARM Linux wrote: On Tue, Sep 02, 2014 at 05:47:29PM +0900, AKASHI Takahiro wrote: On 09/01/2014 08:47 PM, Russell King - ARM Linux wrote: On Wed, Aug 27, 2014 at 02:55:46PM +0900, AKASHI Takahiro wrote: 1) setting x0 to -ENOSYS is

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-09-01 Thread Russell King - ARM Linux
On Wed, Aug 27, 2014 at 02:55:46PM +0900, AKASHI Takahiro wrote: > 1) > setting x0 to -ENOSYS is necessary because, otherwise, user-issued > syscall(-1) will > return a bogus value when audit tracing is on. > > Please note that, on arm, > not traced traced >

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-09-01 Thread Will Deacon
On Wed, Aug 27, 2014 at 06:55:46AM +0100, AKASHI Takahiro wrote: > On 08/27/2014 02:51 AM, Will Deacon wrote: > > On Fri, Aug 22, 2014 at 01:35:17AM +0100, AKASHI Takahiro wrote: > >> Oops, you're absolutely right. I didn't think of this case. > >> syscall_trace_enter() should not return a

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-09-01 Thread Will Deacon
On Wed, Aug 27, 2014 at 06:55:46AM +0100, AKASHI Takahiro wrote: On 08/27/2014 02:51 AM, Will Deacon wrote: On Fri, Aug 22, 2014 at 01:35:17AM +0100, AKASHI Takahiro wrote: Oops, you're absolutely right. I didn't think of this case. syscall_trace_enter() should not return a syscallno

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-09-01 Thread Russell King - ARM Linux
On Wed, Aug 27, 2014 at 02:55:46PM +0900, AKASHI Takahiro wrote: 1) setting x0 to -ENOSYS is necessary because, otherwise, user-issued syscall(-1) will return a bogus value when audit tracing is on. Please note that, on arm, not traced traced --

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-08-26 Thread AKASHI Takahiro
On 08/27/2014 02:51 AM, Will Deacon wrote: On Fri, Aug 22, 2014 at 01:35:17AM +0100, AKASHI Takahiro wrote: On 08/22/2014 02:08 AM, Kees Cook wrote: On Thu, Aug 21, 2014 at 3:56 AM, AKASHI Takahiro wrote: diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-08-26 Thread Will Deacon
On Fri, Aug 22, 2014 at 01:35:17AM +0100, AKASHI Takahiro wrote: > On 08/22/2014 02:08 AM, Kees Cook wrote: > > On Thu, Aug 21, 2014 at 3:56 AM, AKASHI Takahiro > > wrote: > >> diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c > >> index 8876049..c54dbcc 100644 > >> ---

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-08-26 Thread Will Deacon
On Fri, Aug 22, 2014 at 01:35:17AM +0100, AKASHI Takahiro wrote: On 08/22/2014 02:08 AM, Kees Cook wrote: On Thu, Aug 21, 2014 at 3:56 AM, AKASHI Takahiro takahiro.aka...@linaro.org wrote: diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index 8876049..c54dbcc 100644

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-08-26 Thread AKASHI Takahiro
On 08/27/2014 02:51 AM, Will Deacon wrote: On Fri, Aug 22, 2014 at 01:35:17AM +0100, AKASHI Takahiro wrote: On 08/22/2014 02:08 AM, Kees Cook wrote: On Thu, Aug 21, 2014 at 3:56 AM, AKASHI Takahiro takahiro.aka...@linaro.org wrote: diff --git a/arch/arm64/kernel/ptrace.c

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-08-21 Thread AKASHI Takahiro
On 08/22/2014 02:08 AM, Kees Cook wrote: On Thu, Aug 21, 2014 at 3:56 AM, AKASHI Takahiro wrote: If tracer specifies -1 as a syscall number, this traced system call should be skipped with a value in x0 used as a return value. This patch enables this semantics, but there is a restriction here:

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-08-21 Thread Kees Cook
On Thu, Aug 21, 2014 at 3:56 AM, AKASHI Takahiro wrote: > If tracer specifies -1 as a syscall number, this traced system call should > be skipped with a value in x0 used as a return value. > This patch enables this semantics, but there is a restriction here: > >when syscall(-1) is issued by

[PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-08-21 Thread AKASHI Takahiro
If tracer specifies -1 as a syscall number, this traced system call should be skipped with a value in x0 used as a return value. This patch enables this semantics, but there is a restriction here: when syscall(-1) is issued by user, tracer cannot skip this system call and modify a return

[PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-08-21 Thread AKASHI Takahiro
If tracer specifies -1 as a syscall number, this traced system call should be skipped with a value in x0 used as a return value. This patch enables this semantics, but there is a restriction here: when syscall(-1) is issued by user, tracer cannot skip this system call and modify a return

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-08-21 Thread Kees Cook
On Thu, Aug 21, 2014 at 3:56 AM, AKASHI Takahiro takahiro.aka...@linaro.org wrote: If tracer specifies -1 as a syscall number, this traced system call should be skipped with a value in x0 used as a return value. This patch enables this semantics, but there is a restriction here: when

Re: [PATCH v6 2/6] arm64: ptrace: allow tracer to skip a system call

2014-08-21 Thread AKASHI Takahiro
On 08/22/2014 02:08 AM, Kees Cook wrote: On Thu, Aug 21, 2014 at 3:56 AM, AKASHI Takahiro takahiro.aka...@linaro.org wrote: If tracer specifies -1 as a syscall number, this traced system call should be skipped with a value in x0 used as a return value. This patch enables this semantics, but