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
| ||
|
Date: Tue, 25 Aug 2020 08:54:48 -0700 From: Joe Perches <joe@...ches.com> To: Nicolas Boichat <drinkcat@...omium.org>, Andy Whitcroft <apw@...onical.com> Cc: Steven Rostedt <rostedt@...dmis.org>, Andrew Morton <akpm@...ux-foundation.org>, linux-kernel@...r.kernel.org Subject: Re: [PATCH v2] checkpatch: Warn if trace_printk and friends are called On Tue, 2020-08-25 at 19:36 +0800, Nicolas Boichat wrote: > trace_printk is meant as a debugging tool, and should not be > compiled into production code without specific debug Kconfig > options enabled, or source code changes, as indicated by the > warning that shows up on boot if any trace_printk is called: > ** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE ** > ** ** > ** trace_printk() being used. Allocating extra memory. ** > ** ** > ** This means that this is a DEBUG kernel and it is ** > ** unsafe for production use. ** > > Let's warn developers when they try to submit such a change. > > Signed-off-by: Nicolas Boichat <drinkcat@...omium.org> thanks. > --- > See also extensive discussion under this thread: > https://lkml.org/lkml/2020/8/20/244 > > This seems to be the simplest way to try to reduce the number > of trace_printk that make it into the kernel. > > Changes in v2: > - Use $1 directly, fix wording, remove final period. > > scripts/checkpatch.pl | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index 4aa1d9d5e62c5b0..1102aa0ec2f7a05 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -4272,6 +4272,12 @@ sub process { > "Prefer dev_$level(... to dev_printk(KERN_$orig, ...\n" . $herecurr); > } > > +# trace_printk should not be used in production code. > + if ($line =~ /\b(trace_printk|trace_puts|ftrace_vprintk)\s*\(/) { > + WARN("TRACE_PRINTK", > + "Do not use $1() in production code (this can be ignored if built only with a debug config option)\n" . $herecurr); > + } > + > # ENOSYS means "bad syscall nr" and nothing else. This will have a small > # number of false positives, but assembly files are not checked, so at > # least the arch entry code will not trigger this warning.
Powered by blists - more mailing lists