Re: [PATCH 0/2] introduce DUMP_PREFIX_UNHASHED for hex dumps

From: Matthew Wilcox
Date: Mon Jan 18 2021 - 13:46:21 EST


On Sat, Jan 16, 2021 at 04:09:48PM -0600, Timur Tabi wrote:
> First patch updates print_hex_dump() and related functions to
> allow callers to print hex dumps with unhashed addresses. It
> adds a new prefix type, so existing code is unchanged.
>
> Second patch changes a page poising function to use the new
> address type. This is just an example of a change. If it's
> wrong, it doesn't need to be applied.
>
> IMHO, hashed addresses make very little sense for hex dumps,
> which print addresses in 16- or 32-byte increments. Typical
> use-case is to correlate an addresses in between one of these
> increments with some other address, but that can't be done
> if the addresses are hashed. I expect most developers to
> want to replace their usage of DUMP_PREFIX_ADDRESS with
> DUMP_PREFIX_UNHASHED, now that they have the opportunity.

Yes, I'm sure most kernel developers actually do want to leak kernel
addresses into kernel messages. The important thing though is that it
should be hard for them to do that, and it should stick out like a sore
thumb if they do it.

Don't make it easy. And don't make it look like they're doing
something innocent. DUMP_PREFIX_SECURITY_HOLE would be OK
by me. DUMP_PREFIX_LEAK_INFORMATION would work fine too.
DUMP_PREFIX_MAKE_ATTACKERS_LIFE_EASY might be a bit too far.