Thread (1 message) 1 message, 1 author, 2010-12-22

Re: [PATCH v5] kptr_restrict for hiding kernel pointers

From: <hidden>
Date: 2010-12-22 21:44:34
Also in: lkml

On Wed, 22 Dec 2010 12:17:59 EST, Dan Rosenberg said:
On Wed, 2010-12-22 at 18:13 +0100, Ingo Molnar wrote:
quoted
* Dan Rosenberg [off-list ref] wrote:
quoted
+	case 'K':
+		/*
+		 * %pK cannot be used in IRQ context because its test
+		 * for CAP_SYSLOG would be meaningless.
+		 */
+		if (in_irq() || in_serving_softirq() || in_nmi())
+			WARN_ONCE(1, "%%pK used in interrupt context.\n");
Hm, that bit looks possibly broken - some useful warning in irq context could print
a pointer into the syslog and this would generate a second warning? That probably
would crash as it recurses back into the printk code?
The double "%%" acts as an escape and simply prints "%" rather than
treating it as a format specifier.
I think Ingo was more worried about the fact that we're doing a WARN_ONCE which
will generate a call to printk() - while we're in the middle of a printk() already.

So if we hit a 'printk(KERN_INFO "Some blather with a %pK pointer in it",ptr) in irq
context, what we'll get (if we're lucky is:

Some blather with a <50-60 lines of WARN_ONCE output> pointer in it.

If we're unlucky? Well... 

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help