From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753223AbcHQVT6 (ORCPT ); Wed, 17 Aug 2016 17:19:58 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:37622 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752488AbcHQVT5 (ORCPT ); Wed, 17 Aug 2016 17:19:57 -0400 MIME-Version: 1.0 In-Reply-To: <1471451765.4075.205.camel@perches.com> References: <1471287614.4075.85.camel@perches.com> <1471451765.4075.205.camel@perches.com> From: Kees Cook Date: Wed, 17 Aug 2016 14:19:54 -0700 Message-ID: Subject: Re: BUG and WARN kernel log levels To: Joe Perches Cc: LKML Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 17, 2016 at 9:36 AM, Joe Perches wrote: > On Mon, 2016-08-15 at 12:00 -0700, Joe Perches wrote: >> 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 > > And here I submitted patches: > https://lkml.org/lkml/2010/10/30/176 Ah, I see some of this series landed. I see commits scattered in the tree, but not as many as you sent, I think. What still remains? -Kees -- Kees Cook Nexus Security