Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3841777ybl; Tue, 20 Aug 2019 03:08:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqz2/uN96p27SRcNTWZ9JuntKtKwE4UFwj3Fg2PZfTqyFOAH5SQZc3Dy1gk291AXUYYhqb+0 X-Received: by 2002:a62:2c93:: with SMTP id s141mr29203882pfs.114.1566295719905; Tue, 20 Aug 2019 03:08:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566295719; cv=none; d=google.com; s=arc-20160816; b=B7udQ7EUgIkDdHd9eaeDNIoaub8F7SyHnyPJicEI6988R80peqTDAY8eJhcMhNdb9p gynmccee+T0juJp19J1J/3RCJt2l4GYtkL6MoE9mWU4Uz69gGTq0jmoHoQfb4m38n4Gn K71kCBVdV/KbG/18saljRen3LkqEEkqNU9AaOHQBbw7oWBvl6qZonwrSym+++7RjmpBS KvWeEVmfpAZk03XvduPJFmzHs76n+HuWwYK3EmnHUDYdL4ovMfV92kOOW/bihtA0eNwW U4fIT7mJ3SxOIwXoPDnbQBn4pAUiM/lTExyGG/e+U+J3RacviSKv6o78RXFNr7U/RK6p OZzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=RUVsS3C5PVRVD/3Ci7OzOKjzjEi6jtHtjm1up0/Wduc=; b=VYdy1EGpOywvjzXhjwBg6vikwrxdXtfTxImyNmIcHiDtziTPZyWFAjFRSCFtCME3s4 /4wqhInbdlX9dhfoymVuQLpcVSd6MPIRg5TLZH9GYjaH6mJcXHGfR8fSB4pl4+3oGBH+ nmqx3TMuSmBmrZ3DUxE7qLf9jhF3OH6Mum2QgoegE+JQXnVqFtZY+1PKwuNi8O49pATT HMfP7IUaUZo0t/seYK7X+Xq0Fvfr/eD+fLzqq4Ieiqi7HPS5ISw7bZdOSMI1plBmreYu 43YngzyteB9pmNEM6R9vijmNc6AWdKueuvp0Kw9PwWNbN8Hgr3Pv6mnNzb5O9W6w2iUR WE9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=oB3AP+9G; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u13si11981642plq.188.2019.08.20.03.08.24; Tue, 20 Aug 2019 03:08:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=oB3AP+9G; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728414AbfHTKHO (ORCPT + 99 others); Tue, 20 Aug 2019 06:07:14 -0400 Received: from merlin.infradead.org ([205.233.59.134]:35232 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729610AbfHTKHO (ORCPT ); Tue, 20 Aug 2019 06:07:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=RUVsS3C5PVRVD/3Ci7OzOKjzjEi6jtHtjm1up0/Wduc=; b=oB3AP+9GWs/aEEahebgMXd4/D UsamlvUvtqK96zapMTtGsPvoeqpI7wyZtQ4ehHuDKKrQbNWgpP/3pODfh/92kakNS40DCj9APC0nv Ji5hOp7mExcBghyuyE69W2Muk6WrGOwDlDiMXG6lWgmN4eX0S+esHyxaPxKx7eBv0oFi/B3n+OqXA hAyx1ZUE5dk/vyNzCfS9KzKGJoFPo4IJLyT3IQfG3R2/crHlnYqCxU4oSaO+qTXkAHcp/0UPITcQs CHlFjMGoFCOgFOlVq/699G2mrjqnozPpPWyw0lv+IfwU+WkV4qgXWC5WJWRJtQ9pE74gRqTfAr2Ux byqt4pAFw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1i012H-0006JA-0H; Tue, 20 Aug 2019 10:06:41 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 99B7F3075FF; Tue, 20 Aug 2019 12:06:07 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id C057120CE7753; Tue, 20 Aug 2019 12:06:38 +0200 (CEST) Date: Tue, 20 Aug 2019 12:06:38 +0200 From: Peter Zijlstra To: Kees Cook Cc: Andrew Morton , Christophe Leroy , 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 Subject: Re: [PATCH 7/7] bug: Move WARN_ON() "cut here" into exception handler Message-ID: <20190820100638.GK2332@hirez.programming.kicks-ass.net> References: <20190819234111.9019-1-keescook@chromium.org> <20190819234111.9019-8-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190819234111.9019-8-keescook@chromium.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 19, 2019 at 04:41:11PM -0700, Kees Cook wrote: > diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h > index 588dd59a5b72..da471fcc5487 100644 > --- a/include/asm-generic/bug.h > +++ b/include/asm-generic/bug.h > @@ -10,6 +10,7 @@ > #define BUGFLAG_WARNING (1 << 0) > #define BUGFLAG_ONCE (1 << 1) > #define BUGFLAG_DONE (1 << 2) > +#define BUGFLAG_PRINTK (1 << 3) > #define BUGFLAG_TAINT(taint) ((taint) << 8) > #define BUG_GET_TAINT(bug) ((bug)->flags >> 8) > #endif > diff --git a/lib/bug.c b/lib/bug.c > index 1077366f496b..6c22e8a6f9de 100644 > --- a/lib/bug.c > +++ b/lib/bug.c > @@ -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_PRINTK) == 0) > + printk(KERN_DEFAULT CUT_HERE); I'm not loving that BUGFLAG_PRINTK name, BUGFLAG_CUT_HERE makes more sense to me.