mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] lib/vsprintf: Make no_hash_pointers take effect early
@ 2026-06-10 12:45 Kaitao Cheng
  2026-06-10 14:59 ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Kaitao Cheng @ 2026-06-10 12:45 UTC (permalink / raw)
  To: Andrew Morton, Petr Mladek, Steven Rostedt, Andy Shevchenko,
	Rasmus Villemoes, Sergey Senozhatsky
  Cc: linux-kernel, Muchun Song, Kaitao Cheng

From: Kaitao Cheng <chengkaitao@kylinos.cn>

The no_hash_pointers boot parameter is now handled as an alias for
hash_pointers=never. However, hash_pointers=never only records the
selected mode during early parameter parsing, and no_hash_pointers is
not updated until hash_pointers_finalize() runs later from SLUB init.

This leaves a window during very early boot where %p output is still
hashed even though the user explicitly requested unhashed pointers with
no_hash_pointers or hash_pointers=never.

Set no_hash_pointers as soon as the "never" mode is parsed. The later
hash_pointers_finalize() call still keeps the final policy decision in
one place, but explicit requests to disable pointer hashing now take
effect for early boot users too.

Signed-off-by: Kaitao Cheng <chengkaitao@kylinos.cn>
---
 lib/vsprintf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 4221e95701f9..9d35c84f6c49 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -2361,6 +2361,7 @@ static int __init hash_pointers_mode_parse(char *str)
 	} else if (strcmp(str, "never") == 0) {
 		pr_info("Hash pointers mode set to never.\n");
 		hash_pointers_mode = HASH_PTR_NEVER;
+		no_hash_pointers = true;
 	} else if (strcmp(str, "always") == 0) {
 		pr_info("Hash pointers mode set to always.\n");
 		hash_pointers_mode = HASH_PTR_ALWAYS;
-- 
2.50.1 (Apple Git-155)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] lib/vsprintf: Make no_hash_pointers take effect early
  2026-06-10 12:45 [PATCH] lib/vsprintf: Make no_hash_pointers take effect early Kaitao Cheng
@ 2026-06-10 14:59 ` Andy Shevchenko
  2026-06-11  6:45   ` Kaitao Cheng
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2026-06-10 14:59 UTC (permalink / raw)
  To: Kaitao Cheng
  Cc: Andrew Morton, Petr Mladek, Steven Rostedt, Rasmus Villemoes,
	Sergey Senozhatsky, linux-kernel, Muchun Song, Kaitao Cheng

On Wed, Jun 10, 2026 at 08:45:25PM +0800, Kaitao Cheng wrote:

> The no_hash_pointers boot parameter is now handled as an alias for
> hash_pointers=never. However, hash_pointers=never only records the
> selected mode during early parameter parsing, and no_hash_pointers is
> not updated until hash_pointers_finalize() runs later from SLUB init.
> 
> This leaves a window during very early boot where %p output is still
> hashed even though the user explicitly requested unhashed pointers with
> no_hash_pointers or hash_pointers=never.
> 
> Set no_hash_pointers as soon as the "never" mode is parsed. The later
> hash_pointers_finalize() call still keeps the final policy decision in
> one place, but explicit requests to disable pointer hashing now take
> effect for early boot users too.

How is it documented now? And if not documented at all, needs to be.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] lib/vsprintf: Make no_hash_pointers take effect early
  2026-06-10 14:59 ` Andy Shevchenko
@ 2026-06-11  6:45   ` Kaitao Cheng
  2026-06-11  7:20     ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Kaitao Cheng @ 2026-06-11  6:45 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Andrew Morton, Petr Mladek, Steven Rostedt, Rasmus Villemoes,
	Sergey Senozhatsky, linux-kernel, Muchun Song, Kaitao Cheng

在 2026/6/10 22:59, Andy Shevchenko 写道:
> On Wed, Jun 10, 2026 at 08:45:25PM +0800, Kaitao Cheng wrote:
> 
>> The no_hash_pointers boot parameter is now handled as an alias for
>> hash_pointers=never. However, hash_pointers=never only records the
>> selected mode during early parameter parsing, and no_hash_pointers is
>> not updated until hash_pointers_finalize() runs later from SLUB init.
>>
>> This leaves a window during very early boot where %p output is still
>> hashed even though the user explicitly requested unhashed pointers with
>> no_hash_pointers or hash_pointers=never.
>>
>> Set no_hash_pointers as soon as the "never" mode is parsed. The later
>> hash_pointers_finalize() call still keeps the final policy decision in
>> one place, but explicit requests to disable pointer hashing now take
>> effect for early boot users too.
> 
> How is it documented now? And if not documented at all, needs to be.

In Documentation/admin-guide/kernel-parameters.txt, the descriptions of
both no_hash_pointers and hash_pointers= are already marked as [KNL,EARLY],
which should match the current semantics.

-- 
Thanks
Kaitao Cheng


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] lib/vsprintf: Make no_hash_pointers take effect early
  2026-06-11  6:45   ` Kaitao Cheng
@ 2026-06-11  7:20     ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2026-06-11  7:20 UTC (permalink / raw)
  To: Kaitao Cheng
  Cc: Andrew Morton, Petr Mladek, Steven Rostedt, Rasmus Villemoes,
	Sergey Senozhatsky, linux-kernel, Muchun Song, Kaitao Cheng

On Thu, Jun 11, 2026 at 02:45:15PM +0800, Kaitao Cheng wrote:
> 在 2026/6/10 22:59, Andy Shevchenko 写道:
> > On Wed, Jun 10, 2026 at 08:45:25PM +0800, Kaitao Cheng wrote:
> > 
> >> The no_hash_pointers boot parameter is now handled as an alias for
> >> hash_pointers=never. However, hash_pointers=never only records the
> >> selected mode during early parameter parsing, and no_hash_pointers is
> >> not updated until hash_pointers_finalize() runs later from SLUB init.
> >>
> >> This leaves a window during very early boot where %p output is still
> >> hashed even though the user explicitly requested unhashed pointers with
> >> no_hash_pointers or hash_pointers=never.
> >>
> >> Set no_hash_pointers as soon as the "never" mode is parsed. The later
> >> hash_pointers_finalize() call still keeps the final policy decision in
> >> one place, but explicit requests to disable pointer hashing now take
> >> effect for early boot users too.
> > 
> > How is it documented now? And if not documented at all, needs to be.
> 
> In Documentation/admin-guide/kernel-parameters.txt, the descriptions of
> both no_hash_pointers and hash_pointers= are already marked as [KNL,EARLY],
> which should match the current semantics.

This detail should be also mentioned in the commit message.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-06-11  7:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-10 12:45 [PATCH] lib/vsprintf: Make no_hash_pointers take effect early Kaitao Cheng
2026-06-10 14:59 ` Andy Shevchenko
2026-06-11  6:45   ` Kaitao Cheng
2026-06-11  7:20     ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®