Re: [PATCH] vsprintf: Fix %pK with kptr_restrict == 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 08, 2022 at 02:51:39PM +0100, Petr Mladek wrote:
> On Thu 2022-01-27 11:11:02, Christophe Leroy wrote:

...

> Instead, I would create:
> 
> /*
>  * default is to _not_ leak addresses, so hash before printing,
>  * unless no_hash_pointers is specified on the command line.
>  */
> static noinline_for_stack
> char *default_pointer(const char *fmt, char *buf, char *end, void *ptr,
> 		      struct printf_spec spec)
> {
> 	if (unlikely(no_hash_pointers))
> 		return pointer_string(buf, end, ptr, spec);
> 
> 	return ptr_to_id(buf, end, ptr, spec);
> }
> 
> and use it in both hash_pointer() and pointer().

I like this idea.

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux