From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kees Cook Subject: Re: [PATCH v2 7/7] bug: Move WARN_ON() "cut here" into exception handler Date: Tue, 10 Sep 2019 01:59:30 -0700 Message-ID: <201909100157.CEE99802C@keescook> References: <201908200943.601DD59DCE@keescook> <20190909160539.GA989@tigerII.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20190909160539.GA989@tigerII.localdomain> Sender: linux-kernel-owner@vger.kernel.org To: Sergey Senozhatsky Cc: 20190819234111.9019-8-keescook@chromium.org, Andrew Morton , Christophe Leroy , Peter Zijlstra , Drew Davenport , Arnd Bergmann , "Steven Rostedt (VMware)" , Feng Tang , Petr Mladek , Mauro Carvalho Chehab , Borislav Petkov , YueHaibing , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org List-Id: linux-arch.vger.kernel.org On Tue, Sep 10, 2019 at 01:05:39AM +0900, Sergey Senozhatsky wrote: > On (08/20/19 09:47), Kees Cook wrote: > [..] > > @@ -181,6 +181,15 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs) > > } > > } > > > > + /* > > + * BUG() and WARN_ON() families don't print a custom debug message > > + * before triggering the exception handler, so we must add the > > + * "cut here" line now. WARN() issues its own "cut here" before the > > + * extra debugging message it writes before triggering the handler. > > + */ > > + if ((bug->flags & BUGFLAG_NO_CUT_HERE) == 0) > > + printk(KERN_DEFAULT CUT_HERE); > > Shouldn't this be pr_warn() or pr_crit()? The pr_* helpers here would (potentially) add unwanted prefixes, so those aren't used. KERN_DEFAULT is used here because that's how it's always been printed. I didn't want to change that for this refactoring work. I'm not opposed to it, generally speaking, though. :) -- Kees Cook From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-f194.google.com ([209.85.210.194]:42428 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725818AbfIJI7d (ORCPT ); Tue, 10 Sep 2019 04:59:33 -0400 Received: by mail-pf1-f194.google.com with SMTP id w22so11146455pfi.9 for ; Tue, 10 Sep 2019 01:59:33 -0700 (PDT) Date: Tue, 10 Sep 2019 01:59:30 -0700 From: Kees Cook Subject: Re: [PATCH v2 7/7] bug: Move WARN_ON() "cut here" into exception handler Message-ID: <201909100157.CEE99802C@keescook> References: <201908200943.601DD59DCE@keescook> <20190909160539.GA989@tigerII.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190909160539.GA989@tigerII.localdomain> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Sergey Senozhatsky Cc: 20190819234111.9019-8-keescook@chromium.org, Andrew Morton , Christophe Leroy , Peter Zijlstra , Drew Davenport , Arnd Bergmann , "Steven Rostedt (VMware)" , Feng Tang , Petr Mladek , Mauro Carvalho Chehab , Borislav Petkov , YueHaibing , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Message-ID: <20190910085930.73v1sMC0sbpaHl1PTFMS6Yn_8RATk1xWj_II9OVTXYg@z> On Tue, Sep 10, 2019 at 01:05:39AM +0900, Sergey Senozhatsky wrote: > On (08/20/19 09:47), Kees Cook wrote: > [..] > > @@ -181,6 +181,15 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs) > > } > > } > > > > + /* > > + * BUG() and WARN_ON() families don't print a custom debug message > > + * before triggering the exception handler, so we must add the > > + * "cut here" line now. WARN() issues its own "cut here" before the > > + * extra debugging message it writes before triggering the handler. > > + */ > > + if ((bug->flags & BUGFLAG_NO_CUT_HERE) == 0) > > + printk(KERN_DEFAULT CUT_HERE); > > Shouldn't this be pr_warn() or pr_crit()? The pr_* helpers here would (potentially) add unwanted prefixes, so those aren't used. KERN_DEFAULT is used here because that's how it's always been printed. I didn't want to change that for this refactoring work. I'm not opposed to it, generally speaking, though. :) -- Kees Cook