Re: [PATCH V8 2/2] printk: hash addresses printed with %p

2017-10-30 Thread Tobin C. Harding
On Mon, Oct 30, 2017 at 08:00:46PM -0400, Steven Rostedt wrote: > On Tue, 31 Oct 2017 09:41:02 +1100 > "Tobin C. Harding" wrote: > > > > Cool. So I think we need > > > > get_random_bytes(&ptr_key, sizeof(ptr_key)); > > You'll need to add a comment here to describe what ordering the memory

Re: [PATCH V8 2/2] printk: hash addresses printed with %p

2017-10-30 Thread Steven Rostedt
On Tue, 31 Oct 2017 09:41:02 +1100 "Tobin C. Harding" wrote: > Cool. So I think we need > > get_random_bytes(&ptr_key, sizeof(ptr_key)); You'll need to add a comment here to describe what ordering the memory barrier is used against. That is, somewhere else there's something that needs to

Re: [PATCH V8 2/2] printk: hash addresses printed with %p

2017-10-30 Thread Tobin C. Harding
On Mon, Oct 30, 2017 at 05:33:22PM -0400, Steven Rostedt wrote: > On Thu, 26 Oct 2017 13:58:38 +1100 > "Tobin C. Harding" wrote: > > > > +static bool have_filled_random_ptr_key; > > > +static siphash_key_t ptr_key __read_mostly; > > > + > > > +static void fill_random_ptr_key(struct random_ready_c

Re: [PATCH V8 2/2] printk: hash addresses printed with %p

2017-10-30 Thread Steven Rostedt
On Thu, 26 Oct 2017 13:58:38 +1100 "Tobin C. Harding" wrote: > > +static bool have_filled_random_ptr_key; > > +static siphash_key_t ptr_key __read_mostly; > > + > > +static void fill_random_ptr_key(struct random_ready_callback *unused) > > +{ > > + get_random_bytes(&ptr_key, sizeof(ptr_key)); >

Re: [PATCH V8 2/2] printk: hash addresses printed with %p

2017-10-25 Thread Jason A. Donenfeld
On Thu, Oct 26, 2017 at 4:53 AM, Tobin C. Harding wrote: > +static bool have_filled_random_ptr_key; __read_mostly

Re: [PATCH V8 2/2] printk: hash addresses printed with %p

2017-10-25 Thread Tobin C. Harding
On Thu, Oct 26, 2017 at 01:53:56PM +1100, Tobin C. Harding wrote: > 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 a

[PATCH V8 2/2] printk: hash addresses printed with %p

2017-10-25 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