Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1757822lqe; Mon, 8 Apr 2024 21:44:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV/qsel09EpoeRNFlmqkDysmSLzukOPxNq4+e0MnBEqCQGeKMCkPU5ud3AnDhhqVD3z3MkoBcv4wYnsGdmhUIunfImqT10xdbfXr21Heg== X-Google-Smtp-Source: AGHT+IFFHlDOEN83Ytv+zuAU9nMaQYHRN0f8RnpoQpEE7AKJEXB4izaZ8oIKdULtB1HYCExVyy2U X-Received: by 2002:a17:907:318a:b0:a51:dc1f:b1a7 with SMTP id xe10-20020a170907318a00b00a51dc1fb1a7mr2743200ejb.38.1712637858075; Mon, 08 Apr 2024 21:44:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712637858; cv=pass; d=google.com; s=arc-20160816; b=akQUfrtq3hMCJCzS3aTjvp04vUuiX9qE4KTHoqomjxVDGhvFzh3EI70TS1vxls7jTM U55atf2usZevYrIOj8QQURnGuSBghKQC2ZEYyv+4Vcg/GpDFuD6xPgKVNdYx3OK9Frze QPoWzIqTNGkuWBTK6yYVnP0kYenJS32eUBEDWB6MXrILUwjInnpqOFd3zDp0l6NuZVKu ql1fuxx5lcB5SBqqsVBhpCO3yf7zsUXdb6bGzeSIHtggFQs1vgYIG6FYfb69NdKxCJQ2 qiTxo+nM6RrFtVaAuTkbOkJAVP16vnEHGM5ON9wzlTdp7rRMjuQy38jXQsUeb8LFlslq Plig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=HlcStEtxk80hmlPxnNw4MACKrmXNwvs3p3wf2jmRDBI=; fh=BU9JIhSfyRxOUWuAHLzMUnHZTQQlaZHJJHIgoQtqiqQ=; b=x9juilLLAT0kIFmhUztUWhYJHQ8X6tu9eTlmKjflVtaNOq7QitfiEpl4mGAxsIa4mv 4EVAP8Os4Apt7lWSAdpNBAXPeyZ0yJOBXRstDQbawDqqzqVSZS9D9FnCKFw524oNTguC 9xHL44Q66v6NTpHXKslGpLPYDepf583cDiRb0t39k2n9Y/3DRei7ZcN0VpH2mDx+GM7N ymf4EOb9RnoEJoxEpohjA7MRC0FmbdKRUGoJr9CXHRX2BUAJOZD5TyUGw02QUYHBbc1i 50fUQA+/4xdScx8kuqrOObUw4ydUk4WhQz/RfXgvfOQQzrBcsTA33QstChCyxmYh3TID w9WA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XR6VWoEr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-136237-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136237-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id gs33-20020a1709072d2100b00a51b5282839si3579586ejc.718.2024.04.08.21.44.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 21:44:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136237-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XR6VWoEr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-136237-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136237-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CA0B11F21FD0 for ; Tue, 9 Apr 2024 04:44:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D370E612F6; Tue, 9 Apr 2024 04:44:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XR6VWoEr" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 EF6333399B; Tue, 9 Apr 2024 04:44:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712637841; cv=none; b=PpsRYWLQQfLcziOXBAs5ggDcu7c5qt211VjtwmXD1NJAeBgP0XWrXqHO+L2P82Ka0yIc90ufI2djbUwEPYLr4v7m+g1qyIlF0EO3QTdki87yc5kJ1qsK+kFSPgKWZH228eI97hq8W3YET0Sl1hzCYCl/M2VexY5VvxEJBwiWwko= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712637841; c=relaxed/simple; bh=bDcauKtxgbpkQX74FEAfo2NPyUT++CTn+Q/La644a14=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JtE302oORNBmvDaGxh1Qiv00eWsN7+SHF4qaT2K4zN/OhcM+L7/pzIDl1H4XQzfe1pHLjSjC9N17ENqBnpO7d5k15J0aiNeuEE0QcuQmwC20NwCDW2FNtmwDDv69RM5E2rMraRLjs8t0Q9WabIIGMKAczbZQMcq4ht8kxA32aYc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XR6VWoEr; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 884B3C43390; Tue, 9 Apr 2024 04:44:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712637840; bh=bDcauKtxgbpkQX74FEAfo2NPyUT++CTn+Q/La644a14=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XR6VWoEr6C7UVwqHUKtLyLbUz4qYGSXAKHCNIiptwPWIDqrIfaLUWzoPePz7PtEuN wphPVduavnbNUVefIAOcOagpySisqPOThq0VyJyyvwQ+4Y/Wg9+fri719oSGzkCEqs H5r9GaaLlxtrlNrqkb2eHzkoAUrcBIxZ81SXnvUFpZGQ5J4vAZC9eVJJtGRlbnnLlB RjwuSH3DdzSR/HtNH9Fd4byeTiuSRAvI4Ho16/k3BFmUVWG9tHz56oyrHsstMygsoX t++okkLDebsmYjk7r7z4l/8uZLT2NTYCDnZgcK7Dwu5BS4gqktC68r/bxYcO4AMjVq He+j+KMFNRU0Q== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 2D827CE1E93; Mon, 8 Apr 2024 21:44:00 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: Zhenhua Huang , Masami Hiramatsu , "Paul E . McKenney" Subject: [PATCH v2 fs/proc/bootconfig 2/2] fs/proc: Skip bootloader comment if no embedded kernel parameters Date: Mon, 8 Apr 2024 21:43:58 -0700 Message-Id: <20240409044358.1156477-2-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Masami Hiramatsu If the "bootconfig" kernel command-line argument was specified or if the kernel was built with CONFIG_BOOT_CONFIG_FORCE, but if there are no embedded kernel parameter, omit the "# Parameters from bootloader:" comment from the /proc/bootconfig file. This will cause automation to fall back to the /proc/cmdline file, which will be identical to the comment in this no-embedded-kernel-parameters case. Signed-off-by: Masami Hiramatsu Signed-off-by: Paul E. McKenney --- fs/proc/bootconfig.c | 2 +- include/linux/bootconfig.h | 1 + init/main.c | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/proc/bootconfig.c b/fs/proc/bootconfig.c index e5635a6b127b0..87dcaae32ff87 100644 --- a/fs/proc/bootconfig.c +++ b/fs/proc/bootconfig.c @@ -63,7 +63,7 @@ static int __init copy_xbc_key_value_list(char *dst, size_t size) dst += ret; } } - if (ret >= 0 && boot_command_line[0]) { + if (cmdline_has_extra_options() && ret >= 0 && boot_command_line[0]) { ret = snprintf(dst, rest(dst, end), "# Parameters from bootloader:\n# %s\n", boot_command_line); if (ret > 0) diff --git a/include/linux/bootconfig.h b/include/linux/bootconfig.h index ca73940e26df8..e5ee2c694401e 100644 --- a/include/linux/bootconfig.h +++ b/include/linux/bootconfig.h @@ -10,6 +10,7 @@ #ifdef __KERNEL__ #include #include +bool __init cmdline_has_extra_options(void); #else /* !__KERNEL__ */ /* * NOTE: This is only for tools/bootconfig, because tools/bootconfig will diff --git a/init/main.c b/init/main.c index 2ca52474d0c30..881f6230ee59e 100644 --- a/init/main.c +++ b/init/main.c @@ -487,6 +487,11 @@ static int __init warn_bootconfig(char *str) early_param("bootconfig", warn_bootconfig); +bool __init cmdline_has_extra_options(void) +{ + return extra_command_line || extra_init_args; +} + /* Change NUL term back to "=", to make "param" the whole string. */ static void __init repair_env_string(char *param, char *val) { -- 2.40.1