From patchwork Thu Oct 5 17:17:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13410509 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F0D4E9271B for ; Thu, 5 Oct 2023 17:24:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230219AbjJERYC (ORCPT ); Thu, 5 Oct 2023 13:24:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230395AbjJERXd (ORCPT ); Thu, 5 Oct 2023 13:23:33 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C390C3C11; Thu, 5 Oct 2023 10:17:49 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65CF9C433C8; Thu, 5 Oct 2023 17:17:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696526269; bh=M0TvMEEC0UkMcAlSj1zsQkX0mGMTYLQ+X6r3nS6NweY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EVEF7H0nkibHxARzVD/nXBIu6ArBL5iFtEu7rnBLlPxHD2K3MAqRj48fJkmcSH6aJ gDBRevessxNx1OI5B8UOCpMl0ImASgVrv6dyqH+BdiV5Bw7TRCCtA6lqHfKL/tjpqp 6SfZBx47ZPt/CFWSM7ldEvhwoKozZ9yFcXrUHUnZdcg+uxNz3+Ii63RKz5UfavzPue 3AOueAT+osDfYj4ewBfwKvlILqMSiTLtyM9NwOE7JS73M36ifzafG6I4qnQAcTS1Z4 P2JWXvhnfYLvBA+Tr9wDOo+AxtUG7t7A6przoESj4fEAq7JPr4zU+V95nFttXIrH48 odOxsKJf8ORqQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 135D3CE0869; Thu, 5 Oct 2023 10:17:49 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org Cc: Jonathan Corbet , "Masami Hiramatsu (Google)" , "Paul E. McKenney" , Randy Dunlap , Andrew Morton , Stephen Rothwell , Arnd Bergmann Subject: [PATCH bootconfig 1/3] doc: Update /proc/cmdline documentation to include boot config Date: Thu, 5 Oct 2023 10:17:45 -0700 Message-Id: <20231005171747.541123-1-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <6ea609a4-12e3-4266-8816-b9fca1f1f21c@paulmck-laptop> References: <6ea609a4-12e3-4266-8816-b9fca1f1f21c@paulmck-laptop> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Update the /proc/cmdline documentation to explicitly state that this file provides kernel boot parameters obtained via boot config from the kernel image as well as those supplied by the boot loader. Signed-off-by: Paul E. McKenney Acked-by: Masami Hiramatsu (Google) Reviewed-by: Randy Dunlap Cc: Jonathan Corbet Cc: Andrew Morton Cc: Stephen Rothwell Cc: Arnd Bergmann --- Documentation/filesystems/proc.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems/proc.rst index 2b59cff8be17..5703b0e87cbe 100644 --- a/Documentation/filesystems/proc.rst +++ b/Documentation/filesystems/proc.rst @@ -691,7 +691,8 @@ files are there, and which are missing. apm Advanced power management info buddyinfo Kernel memory allocator information (see text) (2.5) bus Directory containing bus specific information - cmdline Kernel command line + cmdline Kernel command line, both from bootloader and embedded + in the kernel image cpuinfo Info about the CPU devices Available devices (block and character) dma Used DMS channels From patchwork Thu Oct 5 17:17:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13410510 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92DFBE9271D for ; Thu, 5 Oct 2023 17:24:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230316AbjJERYD (ORCPT ); Thu, 5 Oct 2023 13:24:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230401AbjJERXe (ORCPT ); Thu, 5 Oct 2023 13:23:34 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7BD33C27; Thu, 5 Oct 2023 10:17:49 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69A67C433C7; Thu, 5 Oct 2023 17:17:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696526269; bh=o5L4igQZuUyyRkvZWeW6hIphjuPRgbdBnW7gTpA7Zqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ljD0DSVXW7mrLs6rk+uo3OA3n8H7FoAXevG0rpTNVXlO2DhM+97akz/db9F7eliN5 SNbIT+B6xWAsEWFkyhHl9KEp9sDqDYd3nOR1FdJrXGba22PQ0OtrtztDB0xiLMUv4U NsIIAYqd5gIEja/x0tSYJgWFIS1sFMR4e5JhWh+kFR6GKb4Z4eU3efb+QA+VxubfD5 iJlmKXTYybduRDmv5K4UakHiSKx5UD2e7jPt8calVUcE8g2+UF9dQYAPuDmVzB9mKK RbgR4Q1HEngsKrSmb1wyPZLhT7YcBmnLC83OK62ejaUH/O5hGMEiPr7lL94GLALGEr 73I98sKn9MlgQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 167D2CE0975; Thu, 5 Oct 2023 10:17:49 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org Cc: Jonathan Corbet , "Masami Hiramatsu (Google)" , "Paul E. McKenney" , Linus Torvalds , Stephen Rothwell , Arnd Bergmann , Nick Desaulniers , Alexey Dobriyan , Andrew Morton , Kees Cook , linux-trace-kernel@vger.kernel.org Subject: [PATCH bootconfig 2/3] fs/proc: Add boot loader arguments as comment to /proc/bootconfig Date: Thu, 5 Oct 2023 10:17:46 -0700 Message-Id: <20231005171747.541123-2-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <6ea609a4-12e3-4266-8816-b9fca1f1f21c@paulmck-laptop> References: <6ea609a4-12e3-4266-8816-b9fca1f1f21c@paulmck-laptop> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org In kernels built with CONFIG_BOOT_CONFIG_FORCE=y, /proc/cmdline will show all kernel boot parameters, both those supplied by the boot loader and those embedded in the kernel image. This works well for those who just want to see all of the kernel boot parameters, but is not helpful to those who need to see only those parameters supplied by the boot loader. This is especially important when these parameters are presented to the boot loader by automation that might gather them from diverse sources. It is also useful when booting the next kernel via kexec(), in which case it is necessary to supply only those kernel command-line arguments from the boot loader, and most definitely not those that were embedded into the current kernel. Therefore, add comments to /proc/bootconfig of the form: # Parameters from bootloader: # root=UUID=ac0f0548-a69d-43ca-a06b-7db01bcbd5ad ro quiet ... The second added line shows only those kernel boot parameters supplied by the boot loader. Link: https://lore.kernel.org/all/CAHk-=wjpVAW3iRq_bfKnVfs0ZtASh_aT67bQBG11b4W6niYVUw@mail.gmail.com/ Link: https://lore.kernel.org/all/20230731233130.424913-1-paulmck@kernel.org/ Co-developed-by: Masami Hiramatsu Signed-off-by: Masami Hiramatsu Signed-off-by: Paul E. McKenney Cc: Linus Torvalds Cc: Stephen Rothwell Cc: Arnd Bergmann Cc: Nick Desaulniers Cc: Alexey Dobriyan Cc: Andrew Morton Cc: Kees Cook Cc: Cc: Acked-by: Masami Hiramatsu (Google) --- fs/proc/bootconfig.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/proc/bootconfig.c b/fs/proc/bootconfig.c index 2e244ada1f97..902b326e1e56 100644 --- a/fs/proc/bootconfig.c +++ b/fs/proc/bootconfig.c @@ -62,6 +62,12 @@ static int __init copy_xbc_key_value_list(char *dst, size_t size) break; dst += ret; } + if (ret >= 0 && boot_command_line[0]) { + ret = snprintf(dst, rest(dst, end), "# Parameters from bootloader:\n# %s\n", + boot_command_line); + if (ret > 0) + dst += ret; + } } out: kfree(key); From patchwork Thu Oct 5 17:17:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 13410511 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9E0EE9271B for ; Thu, 5 Oct 2023 17:24:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230477AbjJERYG (ORCPT ); Thu, 5 Oct 2023 13:24:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230481AbjJERXh (ORCPT ); Thu, 5 Oct 2023 13:23:37 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3CA846AE; Thu, 5 Oct 2023 10:17:54 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84356C433C8; Thu, 5 Oct 2023 17:17:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696526274; bh=dd281u/JTv/R6FmaGl1uLzRwofzwkxCFqbk7yrkrYr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QTsWqTsfq+kPIKxVgE9A/E+ADoBxbMda9uH0NMeSYTUmoZkhJ5aA8bZFN2ipYQRap 6KGadC9r4o/6b2g8JhWHpYGRxRqt4c2dDFyoJowgTaOnlfFHTBlHKNYYzIStoGgk6I 7wOXykqBJqEceFppYFJZTxw/98pUgrAU1BE+6ysGb7vTi8pKOOFvg+Rf7HWaekNqiy wnRfYOvB+mjsO+nPNtKgi+IufB1O4nmYAH+7dpobx4X1+MSOjpyrzibr/6r3KeOBB/ OA4eSdt7ynQVA7O4FSEdE0q7ukTyZW2lr+GYlQPcMdFUuFhof9o5MXYkai/o4vPsQy lOtI5vN+DTocQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 1975FCE0976; Thu, 5 Oct 2023 10:17:49 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org Cc: Jonathan Corbet , "Masami Hiramatsu (Google)" , "Paul E. McKenney" Subject: [PATCH bootconfig 3/3] doc: Add /proc/bootconfig to proc.rst Date: Thu, 5 Oct 2023 10:17:47 -0700 Message-Id: <20231005171747.541123-3-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <6ea609a4-12e3-4266-8816-b9fca1f1f21c@paulmck-laptop> References: <6ea609a4-12e3-4266-8816-b9fca1f1f21c@paulmck-laptop> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Add /proc/bootconfig description to Documentation/filesystems/proc.rst. Reported-by: Masami Hiramatsu Signed-off-by: Paul E. McKenney Acked-by: Masami Hiramatsu (Google) --- Documentation/filesystems/proc.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems/proc.rst index 5703b0e87cbe..a2c160f29632 100644 --- a/Documentation/filesystems/proc.rst +++ b/Documentation/filesystems/proc.rst @@ -689,6 +689,11 @@ files are there, and which are missing. File Content ============ =============================================================== apm Advanced power management info + bootconfig Kernel command line obtained from boot config, + and, if there were kernel parameters from the + boot loader, a "# Parameters from bootloader:" + line followed by a line containing those + parameters prefixed by "# ". (5.5) buddyinfo Kernel memory allocator information (see text) (2.5) bus Directory containing bus specific information cmdline Kernel command line, both from bootloader and embedded