lkml.org 
[lkml]   [2018]   [Mar]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] vsprintf: Make "null" pointer dereference more robust
On Thu, Mar 8, 2018 at 8:45 AM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> Umm. Look again. It _does_ affect plain %p.
>
> You're correct that it doesn't affect %px and %pK, since those never
> printed out (null) in the first place.
>
> It not only affects %p, but it also affects %pS and friends (sSfFB),

Looking around at the x86 panic thing, %p doesn't matter that much,
but %p[sSfFB] really do.

We use %pS/%pB to print out the instruction pointer. And a fault might
be due to the instruction pointer being bad.

And then we very much need to see the value, which the current
%pS-and-friends falls back to.

So printing <efault> would actually be horrible, in addition to the
extra page fault being wrong. In fact, _only_ NULL itself needs to be
printed as (null), because we'd care if it's 0 or 8 or something.

The other ones? The ones that would actually fault (%pI and friends)
would not matter.

The hex dumping one _might_ actually be useful if it got a buffer with
'probe_kernel_read()' and stopped half-way on problems. Maybe. The
others I can't imagine really care. efault or hex address.

Linus

\
 
 \ /
  Last update: 2018-03-08 18:26    [W:0.083 / U:0.784 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site