From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753174AbcHOTAX (ORCPT ); Mon, 15 Aug 2016 15:00:23 -0400 Received: from smtprelay0080.hostedemail.com ([216.40.44.80]:60846 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752856AbcHOTAW (ORCPT ); Mon, 15 Aug 2016 15:00:22 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,joe@perches.com,:::,RULES_HIT:41:355:379:541:599:960:967:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2525:2560:2563:2682:2685:2828:2859:2899:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3871:3872:3873:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4184:4250:4321:5007:6691:7903:8660:8985:9025:9108:10004:10400:10848:11026:11232:11473:11658:11783:11854:11914:12043:12517:12519:12663:12740:13069:13148:13230:13311:13357:13439:13894:14180:14181:14659:14721:21060:21067:21080:21451:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:6,LUA_SUMMARY:none X-HE-Tag: anger88_599407c1d443e X-Filterd-Recvd-Size: 1908 Message-ID: <1471287614.4075.85.camel@perches.com> Subject: Re: BUG and WARN kernel log levels From: Joe Perches To: Kees Cook Cc: LKML Date: Mon, 15 Aug 2016 12:00:14 -0700 In-Reply-To: References: Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.2-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2016-08-15 at 11:53 -0700, Kees Cook wrote: > Hi, > > So, I noticed that asm-gemeric/bug.h defines BUG() without a log level: > > #ifndef HAVE_ARCH_BUG > #define BUG() do { \ >        printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \ > > Seems like it should have one? > > Also, I think we might want to examine WARN() a bit... it doesn't have > a log level either, but only a fraction of callers set one: > > $ git grep -E 'WARN(_TAINT|)(_RATELIMIT|_ONCE|)\([^\)]' | grep -v KERN_ | wc -l > 2735 > > $ git grep -E 'WARN(_TAINT|)(_RATELIMIT|_ONCE|)\([^\)]' | grep KERN_ | wc -l > 77 > > If I'm reading checkpatch.pl correctly, it doesn't warn about missing > log levels on WARN calls, but I think it should. > > How do you think is best to clean this up? > > Mainly, I'd like to add a format string to BUG, or introduce a new > BUGish call that takes a format... I once suggested something similar awhile ago. https://lkml.org/lkml/2008/7/8/261 I think it's best to remove any KERN_ from the use of all the WARN variants and add it to the WARN definitions. Same with BUG.