Re: [PATCH v4] printk: hash addresses printed with %p

2017-10-18 Thread Sergey Senozhatsky
On (10/18/17 17:04), Tobin C. Harding wrote: [..] > > > +/* protects ptr_secret and have_key */ > > > +DEFINE_SPINLOCK(key_lock); > > > +static siphash_key_t ptr_secret __read_mostly; > > > +static atomic_t have_key = ATOMIC_INIT(0); > > > + > > > +static int initialize_ptr_secret(void) > > > +{ >

Re: [PATCH v4] printk: hash addresses printed with %p

2017-10-17 Thread Tobin C. Harding
On Wed, Oct 18, 2017 at 02:44:31PM +0900, Sergey Senozhatsky wrote: > On (10/18/17 15:21), Tobin C. Harding wrote: > [..] > > diff --git a/lib/vsprintf.c b/lib/vsprintf.c > > index 86c3385b9eb3..4609738cd2cd 100644 > > --- a/lib/vsprintf.c > > +++ b/lib/vsprintf.c > > @@ -33,6 +33,8 @@ > > #includ

Re: [PATCH v4] printk: hash addresses printed with %p

2017-10-17 Thread Sergey Senozhatsky
On (10/18/17 15:21), Tobin C. Harding wrote: [..] > diff --git a/lib/vsprintf.c b/lib/vsprintf.c > index 86c3385b9eb3..4609738cd2cd 100644 > --- a/lib/vsprintf.c > +++ b/lib/vsprintf.c > @@ -33,6 +33,8 @@ > #include > #include > #include > +#include > +#include > #ifdef CONFIG_BLOCK > #in

[PATCH v4] printk: hash addresses printed with %p

2017-10-17 Thread Tobin C. Harding
Currently there are many places in the kernel where addresses are being printed using an unadorned %p. Kernel pointers should be printed using %pK allowing some control via the kptr_restrict sysctl. Exposing addresses gives attackers sensitive information about the kernel layout in memory. We can