Re: BUG: bad usercopy in memdup_user

From: Linus Torvalds
Date: Tue Dec 19 2017 - 23:36:51 EST

On Tue, Dec 19, 2017 at 8:05 PM, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> And yes, we had a few cases where the hashing actually did hide the
> values, and I've been applying patches to turn those from %p to %px.

So far at least:

10a7e9d84915 Do not hash userspace addresses in fault handlers
85c3e4a5a185 mm/slab.c: do not hash pointers when debugging slab
d81041820873 powerpc/xmon: Don't print hashed pointers in xmon
328b4ed93b69 x86: don't hash faulting address in oops printout
b7ad7ef742a9 remove task and stack pointer printout from oops dump
6424f6bb4327 kasan: use %px to print addresses instead of %p

although that next-to-last case is a "remove %p" case rather than
"convert to %px".

And we'll probably hit a few more, I'm not at all claiming that we're
somehow "done". There's bound to be other cases people haven't noticed
yet (or haven't patched yet, like the usercopy case that Kees is
signed up to fix up).

But considering that we had something like 12k of those %p users, I
think a handful now (and maybe a few tens eventually) is worth the
pain and confusion.

I just want to make sure that the ones we _do_ convert we actually
spend the mental effort really looking at, and really asking "does it
make sense to convert this?"

Not just knee-jerking "oh, it's hashed, let's just unhash it".