From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80994C83F17 for ; Sun, 13 Jul 2025 09:35:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0CBE86B0089; Sun, 13 Jul 2025 05:35:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 07D126B008A; Sun, 13 Jul 2025 05:35:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ED4666B008C; Sun, 13 Jul 2025 05:35:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id DA0786B0089 for ; Sun, 13 Jul 2025 05:35:31 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 5D48E80384 for ; Sun, 13 Jul 2025 09:35:31 +0000 (UTC) X-FDA: 83658733662.09.BCBC416 Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf08.hostedemail.com (Postfix) with ESMTP id A4911160004 for ; Sun, 13 Jul 2025 09:35:29 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=CiugZelt; spf=pass (imf08.hostedemail.com: domain of gregkh@linuxfoundation.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org; dmarc=pass (policy=none) header.from=linuxfoundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1752399329; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Swx1/CGQiu71DZs5MWSN7ltHvjzjINKK37IIfeXZr4c=; b=pHRm/M9rAqjlDDxqTUVvUTfYCK5OFHpofZSXi7W9OLJ+8hZ/45lNuFnH2cAqzMldaPJY2X RaGX6sGLqcvhVeHjnlIROuV4gf6Q47NbNpMDyjma6yjC306S2hW+iBI3QxDLdDwaOUouzY dxztb7gFvZbEKtjSMFf3VzENdWnhQ2o= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=CiugZelt; spf=pass (imf08.hostedemail.com: domain of gregkh@linuxfoundation.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org; dmarc=pass (policy=none) header.from=linuxfoundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1752399330; a=rsa-sha256; cv=none; b=uF0LKJIM02bSwuwSOvSbGrwF/8u3Y3rYDzwt7dlhP9RPAj9kY4JZiLaUvIs/YuABRHjH9r DZZmuDrnfXri/BwbxxcboZX+5KjJ4VnRirEgLR4P9tuFHbE0t+QCdVpZkNsgdvPVGNk0+1 3UTD636LfBtV0drGIP7MZo8XEDZGF6g= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 5716640BE3; Sun, 13 Jul 2025 09:35:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDC30C4CEE3; Sun, 13 Jul 2025 09:35:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1752399328; bh=Di228D3he1kxfcQNeDttgDNudPZC7dWeCIHqqV3j/+A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CiugZeltTFj7XoOE7eyXEHykY+ug0GRTmmZQkfFBClWEylCuUKJa+T47ord1c/+Uz UvHGZitaPcdtzs98B1sClpdsTvICmGT3ETjmXhi4jzyNaYO04gZsrYFpVUSM9ZM2F9 O6d0gpQ7KFbU51hNtgufoKwnoXK9D/msksiuipYc= Date: Sun, 13 Jul 2025 11:35:25 +0200 From: Greg KH To: Huacai Chen Cc: Huacai Chen , Andrew Morton , linux-mm@kvack.org, Alexander Viro , Christian Brauner , Jan Kara , linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] init: Handle bootloader head in kernel parameters Message-ID: <2025071306-barber-unbalance-53bb@gregkh> References: <20250711102455.3673865-1-chenhuacai@loongson.cn> <2025071130-mangle-ramrod-38ff@gregkh> <2025071116-pushchair-happening-a4cf@gregkh> <2025071150-oasis-chewy-4137@gregkh> <2025071330-alkalize-bonus-ebec@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Stat-Signature: am4rwneofpp9fb7z9zam7ofc4ywypbnm X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: A4911160004 X-Rspam-User: X-HE-Tag: 1752399329-423603 X-HE-Meta: U2FsdGVkX19EMTVoJ9mm3Cc3fIk7EOyo4RRv4O3Hvj4jSNufVCFEuPS+ZkhAd1Jk0bAnTQ/R4M4o38dG1Ru77NCS977TOIUwyZg8h0hW/kt56WnhmxFajeUr7Oy18St+srPKJ5wz+LgSIM2B1WHp/KnMC7xAH6KyUo6UpPYXZ4QM298UUN5W1S86IiK/ebOI1QXkyPmOFHaaPYIftllpJpcKRJcXIPo87PyaOwxXhbGV8SBJwa+huiZkqBFPvo2UipV6w3JPCVqxWNoJf0F4v+BRoOpmfU4tQifeMIeQCig6cnhBDD6vitTpVRDMJdDgrGv00KvbLi0k0IWJNeJBYCgYhzKNl1X2WSLa3ETqrE6hN+HYK6i/V8cj0ddHXooX/A3cZn3KY6sNLKVhLsJabrzBwgTcIpCDLQhNgnEViR7b5ul5ZmYmaXplJ7ZVD72/8XAvVI64qTiSaSnaHZT39T3vQu7/KNS9FtCjkNa2Ajv+amI2fXMpbpw/GkmsWUzv9CJKkln4n5P+nsRv5jE6CsYHM1uaCgvwSfvnAASUbCAGBHGG7BgQcj+KfuHWl0xvsaGqKGM2svkCxSJ4JT6+joteSDrVEpbYAaL6fFGbMxKWaHvOEHBF3MZjFVSqv7O+NcWkVMyQ5NBhS7SV8wwdYEUkdDIeGqPtA8tzFfdzNzqzIKD6mhQtc0FMExaDwWvbDW408T+UzVWKJzpcjIFNZA/urbyEQU4mVungtMkqWUOf7kYTqsFBLwOobjMx8JrwDgucmq8k0e5VUQVZs7JDPD6/Hikw0S4EOwn+mOBF9XwhJOoUv7RSEbv1ckJrRPT0m20iYEqNqRx4xtBNN8cmLSCejUB2aqu3OkfByX8dQ/Np7vzKTbEdM/NpvhEvUAbGbINcjh2ub7E4akSqK1S0caX1f0bh6ixPMbwONNa8zw33rE8aMp17DoakzhvwN0B5Vh2yLdDcRVCe2wnUZ+O JsYC5ALD Uja72CsYl2HEm0WHeO6mCc3OPiA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Sun, Jul 13, 2025 at 05:11:20PM +0800, Huacai Chen wrote: > On Sun, Jul 13, 2025 at 4:30 PM Greg KH wrote: > > > > On Sat, Jul 12, 2025 at 11:18:44PM +0800, Huacai Chen wrote: > > > On Fri, Jul 11, 2025 at 9:04 PM Greg KH wrote: > > > > > > > > On Fri, Jul 11, 2025 at 08:51:28PM +0800, Huacai Chen wrote: > > > > > On Fri, Jul 11, 2025 at 8:41 PM Greg KH wrote: > > > > > > > > > > > > On Fri, Jul 11, 2025 at 08:34:25PM +0800, Huacai Chen wrote: > > > > > > > Hi, Greg, > > > > > > > > > > > > > > On Fri, Jul 11, 2025 at 7:06 PM Greg KH wrote: > > > > > > > > > > > > > > > > On Fri, Jul 11, 2025 at 06:24:55PM +0800, Huacai Chen wrote: > > > > > > > > > BootLoader may pass a head such as "BOOT_IMAGE=/boot/vmlinuz-x.y.z" to > > > > > > > > > kernel parameters. But this head is not recognized by the kernel so will > > > > > > > > > be passed to user space. However, user space init program also doesn't > > > > > > > > > recognized it. > > > > > > > > > > > > > > > > Then why is it on the kernel command line if it is not recognized? > > > > > > > UEFI put it at the beginning of the command line, you can see it from > > > > > > > /proc/cmdline, both on x86 and LoongArch. > > > > > > > > > > > > Then fix UEFI :) > > > > > > > > > > > > My boot command line doesn't have that on x86, perhaps you need to fix > > > > > > your bootloader? > > > > > Not only UEFI, Grub also do this, for many years, not now. I don't > > > > > know why they do this, but I think at least it is not a bug. For > > > > > example, maybe it just tells user the path of kernel image via > > > > > /proc/cmdline. > > > > > > > > > > [chenhuacai@kernelserver linux-official.git]$ uname -a > > > > > Linux kernelserver 6.12.0-84.el10.x86_64 #1 SMP PREEMPT_DYNAMIC Tue > > > > > May 13 13:39:02 UTC 2025 x86_64 GNU/Linux > > > > > [chenhuacai@kernelserver linux-official.git]$ cat /proc/cmdline > > > > > BOOT_IMAGE=(hd0,gpt2)/vmlinuz-6.12.0-84.el10.x86_64 > > > > > root=UUID=c8fcb11a-0f2f-48e5-a067-4cec1d18a721 ro > > > > > crashkernel=2G-64G:256M,64G-:512M > > > > > resume=UUID=1c320fec-3274-4b5b-9adf-a06 > > > > > 42e7943c0 rhgb quiet > > > > > > > > Sounds like a bootloader bug: > > > > > > > > $ cat /proc/cmdline > > > > root=/dev/sda2 rw > > > > > > > > I suggest fixing the issue there, at the root please. > > > Grub pass BOOT_IMAGE for all EFI-based implementations, related commits of Grub: > > > https://cgit.git.savannah.gnu.org/cgit/grub.git/commit/?id=16ccb8b138218d56875051d547af84410d18f9aa > > > https://cgit.git.savannah.gnu.org/cgit/grub.git/commit/?id=25953e10553dad2e378541a68686fc094603ec54 > > > > From 2005 and 2011? Why have we not had any reports of this being an > > issue before now? What changed in the kernel recently? > As said before, just in some corner cases it causes problems, but > corner case doesn't means nothing. > > > > > > Linux kernel treats BOOT_IMAGE as an "offender" of unknown command > > > line parameters, related commits of kernel: > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=86d1919a4fb0d9c115dd1d3b969f5d1650e45408 > > > > So in 2021 we started printing out command line arguments that were > > "wrong", so is this when everyone noticed that grub was wrong? > Somebody may think a warning is harmless, somebody thinks a warning > means a problem needs to fix. Great, then fix it in grub to not do this :) Are we supposed to paper over the bugs in all bootloaders? Especially for ones that we have the source to? > > > There are user space projects that search BOOT_IMAGE from /proc/cmdline: > > > https://github.com/linuxdeepin/deepin-ab-recovery/blob/master/util.go > > > (search getBootOptions) > > > https://github.com/linuxdeepin/deepin-ab-recovery/blob/master/main.go > > > (search getKernelReleaseWithBootOption) > > > > What does it use these options for that it can't get from the valid ones > > instead? > Some projects have fallback methods, some projects don't work, but at > least this means some user space programs depend on it already. > > > > > > So, we can say Grub pass BOOT_IMAGE is reasonable and there are user > > > space programs that hope it be in /proc/cmdline. > > > > But who relies on this that never noticed the kernel complaining about > > it for the past 4 years? > So If I'm the first man who notices this and wants to improve > something, then it is my mistake? No, not at all, I'm saying to fix the root problem here please. And that root problem is grub adding stuff that causes warnings in Linux to happen. Why is this Linux's issue to handle? thanks, greg k-h