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]
Date:	Thu, 20 Sep 2007 23:58:44 +0400
From:	Alexey Dobriyan <adobriyan@...il.com>
To:	Rob Landley <rob@...dley.net>
Cc:	linux-tiny@...enic.com, Tim Bird <tim.bird@...sony.com>,
	linux kernel <linux-kernel@...r.kernel.org>,
	CE Linux Developers List <celinux-dev@...e.celinuxforum.org>,
	Michael Opdenacker <michael@...e-electrons.com>
Subject: Re: [Announce] Linux-tiny project revival

On Thu, Sep 20, 2007 at 03:38:42PM -0500, Rob Landley wrote:
> I've been playing with an idea for a while to improve the printk() situation, 
> but it's a more intrusive change than I've had time to bang on.
> 
> Right now, the first argument to printk() is a loglevel, but it's handled via 
> string concatenation.  I'd like to change that to be an integer, and make it 
> an actual comma-separated first argument.  (Mandatory, not optional.)
> 
> So instead of:
>   printk(KERN_NOTICE "Fruit=%d\n", banana);
> It would now be:
>   printk(KERN_NOTICE, "Fruit=%d\n", banana);
> 
> Change the header from:
>   #define KERN_NOTICE "<5>"
> to:
>   #define KERN_NOTICE 5
> 
> Then you can change the printk guts to do something vaguely like (untested):
> #define printk(arg1, arg2, ...) actual_printk("<" #arg1 ">" arg2, __VA_ARGS__)
> 
> And so far no behavior has changed.  But now the _fun_ part is, you can add a 
> config symbol for "what is the minimum loglevel I care about?"

Given that
a) there're plenty of printks without any KERN_* bloat,
b) there're printks that SHOULD NOT have KERN_* bloat,
c) debugging-by-printk method is widely used and this will force
   additional typing, head-scratching  and swear words
d) time wasted on pointless discussions whether some particular
   printk ALERT or CRIT
e) flag day for printk,

I think that this idea is not worth it.

> #define printk(level, str, ...) \
>   do { \
>     if (level < CONFIG_PRINTK_DOICARE) \
>       actual_printk("<" #level ">" str, __VA_ARGS__); \
>   } while(0);

> Opinions?

Ick.

	Alexey "ignore_loglevel" Dobriyan



--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -52,6 +52,7 @@ extern const char linux_proc_banner[];
  */
 #define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
 
+#ifdef CONFIG_FOO
 #define	KERN_EMERG	"<0>"	/* system is unusable			*/
 #define	KERN_ALERT	"<1>"	/* action must be taken immediately	*/
 #define	KERN_CRIT	"<2>"	/* critical conditions			*/
@@ -59,6 +60,15 @@ extern const char linux_proc_banner[];
 #define	KERN_WARNING	"<4>"	/* warning conditions			*/
 #define	KERN_NOTICE	"<5>"	/* normal but significant condition	*/
 #define	KERN_INFO	"<6>"	/* informational			*/
+#else
+#define	KERN_EMERG	""
+#define	KERN_ALERT	""
+#define	KERN_CRIT	""
+#define	KERN_ERR	""
+#define	KERN_WARNING	""
+#define	KERN_NOTICE	""
+#define	KERN_INFO	""
+#endif
 #define	KERN_DEBUG	"<7>"	/* debug-level messages			*/
 
 extern int console_printk[];
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ