mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kaitao Cheng <kaitao.cheng@linux.dev>
To: Petr Mladek <pmladek@suse.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Kaitao Cheng <chengkaitao@kylinos.cn>
Subject: [PATCH v2] lib/vsprintf: Make no_hash_pointers take effect early
Date: Fri, 12 Jun 2026 11:06:42 +0800	[thread overview]
Message-ID: <20260612030642.14239-1-kaitao.cheng@linux.dev> (raw)

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.

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

Signed-off-by: Kaitao Cheng <chengkaitao@kylinos.cn>
---
Changes in v2 (Andy Shevchenko):
- Add a description of the kernel documentation to the commit log.

Link to v1:
https://lore.kernel.org/all/20260610124525.59110-1-kaitao.cheng@linux.dev/
---
 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.43.0


             reply	other threads:[~2026-06-12  3:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12  3:06 Kaitao Cheng [this message]
2026-06-16 12:05 ` Petr Mladek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260612030642.14239-1-kaitao.cheng@linux.dev \
    --to=kaitao.cheng@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=chengkaitao@kylinos.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®