From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753425AbdKAKbI (ORCPT ); Wed, 1 Nov 2017 06:31:08 -0400 Received: from mx2.suse.de ([195.135.220.15]:34946 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751366AbdKAKbH (ORCPT ); Wed, 1 Nov 2017 06:31:07 -0400 Date: Wed, 1 Nov 2017 11:31:01 +0100 From: Borislav Petkov To: Andy Lutomirski Cc: X86 ML , "linux-kernel@vger.kernel.org" , Brian Gerst , Dave Hansen , Linus Torvalds Subject: Re: [PATCH 18/18] x86/traps: Use a new on_thread_stack() helper to clean up an assertion Message-ID: <20171101103101.oc7ljqml3xikte6y@pd.tnic> References: <2cff5ea4f32889e422dfb8c369ba3cfdb38625df.1509006199.git.luto@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2cff5ea4f32889e422dfb8c369ba3cfdb38625df.1509006199.git.luto@kernel.org> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 26, 2017 at 01:26:50AM -0700, Andy Lutomirski wrote: > Signed-off-by: Andy Lutomirski > --- > arch/x86/include/asm/processor.h | 6 ++++++ > arch/x86/kernel/traps.c | 3 +-- > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h > index 562c575d8bc3..26fc33231cbd 100644 > --- a/arch/x86/include/asm/processor.h > +++ b/arch/x86/include/asm/processor.h > @@ -541,6 +541,12 @@ static inline unsigned long current_top_of_stack(void) > #endif > } > > +static inline bool on_thread_stack(void) > +{ > + return (unsigned long)(current_top_of_stack() - > + current_stack_pointer) < THREAD_SIZE; > +} > + > #ifdef CONFIG_PARAVIRT > #include > #else > diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c > index 67db4f43309e..42a9c4458f5d 100644 > --- a/arch/x86/kernel/traps.c > +++ b/arch/x86/kernel/traps.c > @@ -141,8 +141,7 @@ void ist_begin_non_atomic(struct pt_regs *regs) > * will catch asm bugs and any attempt to use ist_preempt_enable > * from double_fault. > */ > - BUG_ON((unsigned long)(current_top_of_stack() - > - current_stack_pointer) >= THREAD_SIZE); > + BUG_ON(!on_thread_stack()); > > preempt_enable_no_resched(); > } > -- Having a commit message is always better. Other than that: Reviewed-by: Borislav Petkov -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --