Re: [PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-21 Thread Amnon Shiloh
Hi Oleg, Yes, I can see that "arch/x86/kernel/vsyscall_64.c" has changed dramatically since I last looked at it. Since this is the case, I no longer need to trap the vsyscall page. Now however, that "vsyscall" was effectively replaced by vdso, it creates a new problem for me and probably for

Re: [PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-21 Thread Oleg Nesterov
Hi Amnon, Please read my previous email ;) http://marc.info/?l=linux-kernel=135342649119153 On 11/21, u3...@miso.sublimeip.com wrote: > > Hi Oleg, > > > Or. Perhaps we can define TRAP_VSYSCALL and change emulate_vsyscall() to > > do > > > > > > if (current->ptrace &&

Re: [PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-21 Thread Oleg Nesterov
Hi Amnon, Please read my previous email ;) http://marc.info/?l=linux-kernelm=135342649119153 On 11/21, u3...@miso.sublimeip.com wrote: Hi Oleg, Or. Perhaps we can define TRAP_VSYSCALL and change emulate_vsyscall() to do if (current-ptrace test_thread_flag(TIF_SYSCALL_TRACE))

Re: [PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-21 Thread Amnon Shiloh
Hi Oleg, Yes, I can see that arch/x86/kernel/vsyscall_64.c has changed dramatically since I last looked at it. Since this is the case, I no longer need to trap the vsyscall page. Now however, that vsyscall was effectively replaced by vdso, it creates a new problem for me and probably for anyone

Re: [PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-20 Thread u3557
Hi Oleg, > Or. Perhaps we can define TRAP_VSYSCALL and change emulate_vsyscall() to > do > > > if (current->ptrace && test_thread_flag(TIF_SYSCALL_TRACE)) > send_sigtrap(TRAP_VSYSCALL, ...); > > if it returns true? > I wish it were possible, but the vsyscall page is entered

Re: [PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-20 Thread Oleg Nesterov
On 11/20, Oleg Nesterov wrote: > > On 11/19, Steven Rostedt wrote: > > > > Is this really what we want? > > I am not sure, that is why I am asking. Yes. And, > Well yes, with the new implementation __vsyscall_page simply does > syscall, so I guess (say) strace will "just work". But, afaics,

Re: [PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-20 Thread Steven Rostedt
On Tue, 2012-11-20 at 16:48 +0100, Oleg Nesterov wrote: > > But here, there's no prejudice between tasks. All tasks will now hit the > > breakpoint regardless of if it is being traced or not. > ^^ > > This is hardware breakpoint, it is per-task. I forgot that hw breakpoints are

Re: [PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-20 Thread Oleg Nesterov
On 11/19, Steven Rostedt wrote: > > On Mon, 2012-11-19 at 18:47 +0100, Oleg Nesterov wrote: > > > > Just I think Amnon has a point, shouldn't we change this change like below? > > (on top of this fixlet). > > > > Oleg. > > > > --- x/arch/x86/kernel/hw_breakpoint.c > > +++

Re: [PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-20 Thread u3557
Dear Steve, > But here, there's no prejudice between tasks. All tasks will now hit the > breakpoint regardless of if it is being traced or not. Just to clarify, there is no intention to allow conventional breakpoints in the vsyscall page - that would indeed be a disaster affecting all other

Re: [PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-20 Thread u3557
Dear Steve, But here, there's no prejudice between tasks. All tasks will now hit the breakpoint regardless of if it is being traced or not. Just to clarify, there is no intention to allow conventional breakpoints in the vsyscall page - that would indeed be a disaster affecting all other

Re: [PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-20 Thread Oleg Nesterov
On 11/19, Steven Rostedt wrote: On Mon, 2012-11-19 at 18:47 +0100, Oleg Nesterov wrote: Just I think Amnon has a point, shouldn't we change this change like below? (on top of this fixlet). Oleg. --- x/arch/x86/kernel/hw_breakpoint.c +++ x/arch/x86/kernel/hw_breakpoint.c @@

Re: [PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-20 Thread Steven Rostedt
On Tue, 2012-11-20 at 16:48 +0100, Oleg Nesterov wrote: But here, there's no prejudice between tasks. All tasks will now hit the breakpoint regardless of if it is being traced or not. ^^ This is hardware breakpoint, it is per-task. I forgot that hw breakpoints are swapped out

Re: [PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-20 Thread Oleg Nesterov
On 11/20, Oleg Nesterov wrote: On 11/19, Steven Rostedt wrote: Is this really what we want? I am not sure, that is why I am asking. Yes. And, Well yes, with the new implementation __vsyscall_page simply does syscall, so I guess (say) strace will just work. But, afaics, only if

Re: [PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-20 Thread u3557
Hi Oleg, Or. Perhaps we can define TRAP_VSYSCALL and change emulate_vsyscall() to do if (current-ptrace test_thread_flag(TIF_SYSCALL_TRACE)) send_sigtrap(TRAP_VSYSCALL, ...); if it returns true? I wish it were possible, but the vsyscall page is entered in user-mode,

Re: [PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-19 Thread Steven Rostedt
On Mon, 2012-11-19 at 18:47 +0100, Oleg Nesterov wrote: > On 11/09, Oleg Nesterov wrote: > > > > On 11/09, Oleg Nesterov wrote: > > > > > > Note: TASK_SIZE doesn't look right at least on x86, I think it should > > > be replaced by TASK_SIZE_MAX. > > > ... > > > ---

Re: [PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-19 Thread Oleg Nesterov
On 11/09, Oleg Nesterov wrote: > > On 11/09, Oleg Nesterov wrote: > > > > Note: TASK_SIZE doesn't look right at least on x86, I think it should > > be replaced by TASK_SIZE_MAX. > > ... > > --- x/arch/x86/kernel/hw_breakpoint.c > > +++ x/arch/x86/kernel/hw_breakpoint.c > > @@ -200,7 +200,7 @@ int

Re: [PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-19 Thread Oleg Nesterov
On 11/09, Oleg Nesterov wrote: On 11/09, Oleg Nesterov wrote: Note: TASK_SIZE doesn't look right at least on x86, I think it should be replaced by TASK_SIZE_MAX. ... --- x/arch/x86/kernel/hw_breakpoint.c +++ x/arch/x86/kernel/hw_breakpoint.c @@ -200,7 +200,7 @@ int

Re: [PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-19 Thread Steven Rostedt
On Mon, 2012-11-19 at 18:47 +0100, Oleg Nesterov wrote: On 11/09, Oleg Nesterov wrote: On 11/09, Oleg Nesterov wrote: Note: TASK_SIZE doesn't look right at least on x86, I think it should be replaced by TASK_SIZE_MAX. ... --- x/arch/x86/kernel/hw_breakpoint.c +++

Re: [PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-09 Thread Oleg Nesterov
On 11/09, Oleg Nesterov wrote: > > Note: TASK_SIZE doesn't look right at least on x86, I think it should > be replaced by TASK_SIZE_MAX. > ... > --- x/arch/x86/kernel/hw_breakpoint.c > +++ x/arch/x86/kernel/hw_breakpoint.c > @@ -200,7 +200,7 @@ int arch_check_bp_in_kernelspace(struct > va =

[PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-09 Thread Oleg Nesterov
arch_check_bp_in_kernelspace() tries to avoid the overflow and does 2 TASK_SIZE checks but it needs OR, not AND. Consider va = TASK_SIZE -1 and len = 2 case. Note: TASK_SIZE doesn't look right at least on x86, I think it should be replaced by TASK_SIZE_MAX. Signed-off-by: Oleg Nesterov ---

[PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-09 Thread Oleg Nesterov
arch_check_bp_in_kernelspace() tries to avoid the overflow and does 2 TASK_SIZE checks but it needs OR, not AND. Consider va = TASK_SIZE -1 and len = 2 case. Note: TASK_SIZE doesn't look right at least on x86, I think it should be replaced by TASK_SIZE_MAX. Signed-off-by: Oleg Nesterov

Re: [PATCH] arch_check_bp_in_kernelspace: fix the range check

2012-11-09 Thread Oleg Nesterov
On 11/09, Oleg Nesterov wrote: Note: TASK_SIZE doesn't look right at least on x86, I think it should be replaced by TASK_SIZE_MAX. ... --- x/arch/x86/kernel/hw_breakpoint.c +++ x/arch/x86/kernel/hw_breakpoint.c @@ -200,7 +200,7 @@ int arch_check_bp_in_kernelspace(struct va =