lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a0c147a5-a727-0ce8-a0c3-200fe3b17e4a@deltatee.com>
Date:   Mon, 27 Nov 2017 10:20:48 -0700
From:   Logan Gunthorpe <logang@...tatee.com>
To:     Joe Perches <joe@...ches.com>, Julia Lawall <julia.lawall@...6.fr>
Cc:     linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
        Andy Whitcroft <apw@...onical.com>
Subject: Re: [PATCH v2] checkpatch: Add a warning for log messages that don't
 end in a new line



On 27/11/17 01:28 AM, Joe Perches wrote:
> checkpatch already reports printks without KERN_<level>
> 
> # printk should use KERN_* levels
> 		if ($line =~ /\bprintk\s*\(\s*(?!KERN_[A-Z]+\b)/) {
> 			WARN("PRINTK_WITHOUT_KERN_LEVEL",
> 			     "printk() should include KERN_<LEVEL> facility level\n" . $herecurr);
> 		}
> 

Yes, but that kind of misses the mark in a similar way a new line 
warning misses the mark. Consider:

printk("blahblah: ");
printk("blah\n");

Check patch will report that both lines are missing a KERN_ level, but 
actually the second line is meant to be a continuation. So someone fixes 
it, naively:

printk(KERN_INFO, "blahblah: ");
printk(KERN_INFO, "blah\n");

Now, checkpatch will not warn on either and it looks like they fixed it, 
even though it's pretty clear that it's not correct either way. With, my 
patch, it will report a missing new line on the first line. If someone 
looked at it, they may realize it's actually missing a KERN_CONT. If we 
use the space heuristic, in this case, the warning might also suggest it 
may be missing a _cont. But the huristic isn't great... maybe the author 
actually meant:

printk(KERN_INFO, "blahblah:\n");
printk(KERN_INFO, "   blah\n");

But I wouldn't say a warning in this case is a bad thing because it 
forces someone to look at something that is obviously wrong in some way.

Logan


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ