From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-177.mta0.migadu.com (out-177.mta0.migadu.com [91.218.175.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6A133E5A19 for ; Thu, 18 Jun 2026 11:07:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781780858; cv=none; b=hLJWoGwpiSikSqZB5jgkOQ7OuHPbVKVNOWVwhzn84NJmedLblTuHH9K/fnTwI0WMWXNFigHnVEWPMgdHvW8VVtTetpJCmmHC+7RU1do8Jb8yzT1qoTWtvl/mxyp7CObmddlLYrUYcHgTlxKIUEziJhoZcF+fIdLNrp1ntHLvZpg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781780858; c=relaxed/simple; bh=bC2zdbphI6dj2V3FCf8G9kmilOGNUmJ0ienIFBl/Djw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bLcoVfst1lep9ucne8Ss5m60OXvpZlM3KHycF8Wg2T2N7pyZGrD9EPJqHdKW13PiVu9r5I+JEIpMlhiD3XnM04GVC0SONXbJF84DUZQROkv1IP+JnKtvKNYp7kBl9Z9WJK6k5fBfQT6Odp7laS3wTmTxxLlNI589tFmBIc/j8y0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=aWXvG8wS; arc=none smtp.client-ip=91.218.175.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="aWXvG8wS" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1781780853; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=wZNTiRzff58o4k+792FEkm4AuA28sBxPkxl92BpxUmw=; b=aWXvG8wSx+yfFI+cXgwdSIs+IgI5KYp0bMP1iIoSV7z5vWG3IFmBd9197McpWoAIIX1qKu 0H46+UNB4hrkYvm0Rfjm7MgMWNn1LU7mbxlCpFofvRLEUPbzdZCNLva0x29jmx5vPeGz/x acCsJrwKqURdMmg6E76qL8oU8eQqRTo= From: Kaitao Cheng To: akpm@linux-foundation.org, pmladek@suse.com, rostedt@goodmis.org, andriy.shevchenko@linux.intel.com, linux@rasmusvillemoes.dk, senozhatsky@chromium.org Cc: linux-kernel@vger.kernel.org, muchun.song@linux.dev, Kaitao Cheng Subject: [PATCH v3] lib/vsprintf: Make no_hash_pointers take effect early Date: Thu, 18 Jun 2026 19:06:40 +0800 Message-ID: <20260618110640.82749-1-kaitao.cheng@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT From: Kaitao Cheng 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 --- Changes in v3 (Petr Mladek): - Avoid stale no_hash_pointers state when hash_pointers overrides it. Changes in v2 (Andy Shevchenko): - Add a description of the kernel documentation to the commit log. Link to v2: https://lore.kernel.org/all/20260612030642.14239-1-kaitao.cheng@linux.dev/ Link to v1: https://lore.kernel.org/all/20260610124525.59110-1-kaitao.cheng@linux.dev/ --- lib/vsprintf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 4221e95701f9..ca2f12144152 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -2352,6 +2352,9 @@ void __init hash_pointers_finalize(bool slub_debug) static int __init hash_pointers_mode_parse(char *str) { + /* Avoid stale no_hash_pointers state when hash_pointers overrides it */ + no_hash_pointers = false; + if (!str) { pr_warn("Hash pointers mode empty; falling back to auto.\n"); hash_pointers_mode = HASH_PTR_AUTO; @@ -2361,6 +2364,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)