Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5993458ybe; Tue, 10 Sep 2019 11:52:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqynNvKgPii4DnkVQHFR96Jpmyol+8QXwrsYdDZwvWeR6GjkSnF9H8QWgWKIBjG8cfMVpgHX X-Received: by 2002:a17:906:c738:: with SMTP id fj24mr26753360ejb.255.1568141571560; Tue, 10 Sep 2019 11:52:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568141571; cv=none; d=google.com; s=arc-20160816; b=DpEZZz3w0TMlN+niVG/xVL7Fw+6oUU8ekR5/5mxuxO5ZbtFrW0UDIMoRowPkLwxz6M jj7nL0gni9spdhNeRfjIOyfVWdG6X0fLAOMUsEMnPb53/+qTq5A69F5sZlvYajhZa0jU U3g+l+NYk8uSB2YtrhRgbun86AwEe16H6uo9V82hqkGipD9/5u4ZQnEVhK/DQ8lDFTd3 vWl89M0nahYTiyPjaUgYHE9P34CfS7wA+VByuPrh++/2/EYdVkK2Wyn+3dVY+WGUGo/n ZAgt1aRGlZt1z0FdNjIhzxHvIrpmFMxrg7KI2w62goInYV/pwpxzImvvBRLxlJmxMPMd YVrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=BVZkeB8kcfbAhGWCwFmsi+Af79YcNd2rTDIYMad/gaM=; b=xGSBJki4HYt2Ay2M9wQ6RHpTtBdcjy10mhFJ1wv1+x77WDas20WdRx4LuCIfq1Jhzf 0+xkF6ZQjeXfohn4rsx2ZOuxFOwo5hr8eRV+oS7UOin6zl8QvXZqip3ptPO1MZEoMfx4 cD5M53Y+CfOq4quwIiokFKkMsJSmFNLNUjX9Wj/MaTxEtlWNs/XB/biyWfByPeUH6ZSq 0/Tq4gqxvWcvvPqRTsQzkvl20A7WZzj2RAsdzSoTNykCfBNXSxe19h21xL/upng8362z Oi5U5N56BZtHuPwSnWLvfU0IHoGphxCbPEttFdGp9Cp+UOQJK7EdSCSGDNmfm1DxFBOR 7dbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=GMqgtLrw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v2si12471327edm.80.2019.09.10.11.52.28; Tue, 10 Sep 2019 11:52:51 -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=pass header.i=@chromium.org header.s=google header.b=GMqgtLrw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727294AbfIJI7e (ORCPT + 99 others); Tue, 10 Sep 2019 04:59:34 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:45380 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726121AbfIJI7d (ORCPT ); Tue, 10 Sep 2019 04:59:33 -0400 Received: by mail-pf1-f195.google.com with SMTP id y72so11120694pfb.12 for ; Tue, 10 Sep 2019 01:59:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=BVZkeB8kcfbAhGWCwFmsi+Af79YcNd2rTDIYMad/gaM=; b=GMqgtLrwt3KM8f3wheWQ7WpLBzaMDWSTCw5oTy8E406J0B6emHLl1jKtsM+6vYT72P VweUtZAmpCf6H/wVVMayc3KsdLLcGrydwRc+pZKkjJZPadftpD6K7raTMiVSPhaLV+dr PdGEZMyKA66nEZoTsUqvbTm1f6HMlCuf8pNeA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=BVZkeB8kcfbAhGWCwFmsi+Af79YcNd2rTDIYMad/gaM=; b=GDMKk3d1fdhkkNkg9zw+B9A8Qwcp9wXhZgV060ihgzV6VIx9Xkrua8mbAWHE9U0AYF nM5lUJy12C7/2mtUzjsN2v3ChX+BP1Xoa7nTr4zrO/VA7m8L2hvcwaZP3l4aEu8CTR/H M5k1NgzCrUmwysI+f0cuFNzd0tS9n/kE9e7lHR+F57sFfYZgq6ltKPWnkI8oQH4h24D0 4lnO1eIC0AMZrc9ozK3vlxtTdWr6HwzZskNu9I+E0iuQROKoLSP6LA/Zpl35K5xoQq7Q 5LabUbR8r4niYhNs50Eu/5bxkT7DHbwkftcaiub8/VxoosnQwsg29PKxnFvQLAa7u3Al dT5Q== X-Gm-Message-State: APjAAAUSmw+2j/VwdDjXe9kxyDk3giH2DYjuNYXLKc/Y1wlbaCQL7YtK 7w3yBg7APc5DRQOiMzY0LLcDbg== X-Received: by 2002:a63:6888:: with SMTP id d130mr25498575pgc.197.1568105972826; Tue, 10 Sep 2019 01:59:32 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 127sm34965672pfw.6.2019.09.10.01.59.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2019 01:59:31 -0700 (PDT) Date: Tue, 10 Sep 2019 01:59:30 -0700 From: Kees Cook 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 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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