Re: [PATCH 1/2] sched: Add helper for task stack page overrun checking

2014-09-04 Thread Aaron Tomlin
On Thu, Sep 04, 2014 at 05:02:34PM +0200, Oleg Nesterov wrote: > On 09/04, Aaron Tomlin wrote: > > > > +#define task_stack_end_corrupted(task) \ > > + (*(end_of_stack(task)) != STACK_END_MAGIC) > > and it is always used along with "tsk != init_task". > > But why we exclude swapper/0? Ca

[PATCH 1/2] sched: Add helper for task stack page overrun checking

2014-09-04 Thread Aaron Tomlin
This facility is used in a few places so let's introduce a helper function to improve readability. Signed-off-by: Aaron Tomlin --- arch/powerpc/mm/fault.c| 6 ++ arch/x86/mm/fault.c| 5 + include/linux/sched.h | 3 +++ kernel/trace/trace_stack.c | 5 ++--- 4 files change

Re: [PATCH 1/2] sched: Add helper for task stack page overrun checking

2014-09-04 Thread Peter Zijlstra
On Thu, Sep 04, 2014 at 03:50:23PM +0100, Aaron Tomlin wrote: > @@ -537,8 +535,8 @@ void bad_page_fault(struct pt_regs *regs, unsigned long > address, int sig) > printk(KERN_ALERT "Faulting instruction address: 0x%08lx\n", > regs->nip); > > - stackend = end_of_stack(curr

Re: [PATCH 1/2] sched: Add helper for task stack page overrun checking

2014-09-04 Thread Oleg Nesterov
On 09/04, Aaron Tomlin wrote: > > +#define task_stack_end_corrupted(task) \ > + (*(end_of_stack(task)) != STACK_END_MAGIC) and it is always used along with "tsk != init_task". But why we exclude swapper/0? Can't we add end_of_stack(current) = STACK_END_MAGIC; somewhere at th