From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id C77FE1A0018 for ; Fri, 5 Sep 2014 01:05:39 +1000 (EST) Date: Thu, 4 Sep 2014 17:02:34 +0200 From: Oleg Nesterov To: Aaron Tomlin Subject: Re: [PATCH 1/2] sched: Add helper for task stack page overrun checking Message-ID: <20140904150234.GA6480@redhat.com> References: <1409842224-11847-1-git-send-email-atomlin@redhat.com> <1409842224-11847-2-git-send-email-atomlin@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <1409842224-11847-2-git-send-email-atomlin@redhat.com> Cc: dzickus@redhat.com, pzijlstr@redhat.com, riel@redhat.com, peterz@infradead.org, bmr@redhat.com, x86@kernel.org, linux-kernel@vger.kernel.org, rostedt@goodmis.org, minchan@kernel.org, mingo@redhat.com, aneesh.kumar@linux.vnet.ibm.com, hannes@cmpxchg.org, tglx@linutronix.de, linuxppc-dev@lists.ozlabs.org, akpm@linux-foundation.org, jcastillo@redhat.com List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 the start of start_kernel() ? If not, perhaps this new helper should check "task != &init_task" itself so that we can simplify its users? Oleg. > > static inline int object_is_on_stack(void *obj) > { > diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c > index 8a4e5cb..06c7390 100644 > --- a/kernel/trace/trace_stack.c > +++ b/kernel/trace/trace_stack.c > @@ -13,7 +13,6 @@ > #include > #include > #include > -#include > > #include > > @@ -171,8 +170,8 @@ check_stack(unsigned long ip, unsigned long *stack) > i++; > } > > - if ((current != &init_task && > - *(end_of_stack(current)) != STACK_END_MAGIC)) { > + if (current != &init_task && > + task_stack_end_corrupted(current)) { > print_max_stack(); > BUG(); > } > -- > 1.9.3 >