Re: [PATCH v5] kptr_restrict for hiding kernel pointers

From: Ingo Molnar
Date: Wed Dec 22 2010 - 12:13:32 EST



* Dan Rosenberg <drosenberg@xxxxxxxxxxxxx> wrote:

> + 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?

Instead a warning could be inserted into the generated output instead, for example
'pK-error' (carefully staying within pointer length limits).

Also, it would be nice to see a couple of actual %pK usage sites submitted as well -
instead of this pure infrastructure patch.

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/