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 7D99AC83F1A for ; Mon, 14 Jul 2025 10:18:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C92F26B007B; Mon, 14 Jul 2025 06:18:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C43EF6B0089; Mon, 14 Jul 2025 06:18:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B59E76B008A; Mon, 14 Jul 2025 06:18:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id A06746B007B for ; Mon, 14 Jul 2025 06:18:36 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id EA12716057C for ; Mon, 14 Jul 2025 10:18:35 +0000 (UTC) X-FDA: 83662470990.22.778AC13 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf03.hostedemail.com (Postfix) with ESMTP id E03FC20014 for ; Mon, 14 Jul 2025 10:18:33 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RvRnGL8h; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf03.hostedemail.com: domain of chenhuacai@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=chenhuacai@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1752488314; 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=lg32TyQXrs/hV1TiuSWIE+rCBIHpfA/CIe5qSg5KUpQ=; b=8HXKcVtQe6h9d0Wr+Q2Y4GBeBFPTjyWCO9tvpB8B2wsXz96hdvNV9jvvZyGy1wkXh4JCb8 Ixtx3V3dFaVaEKwoWDj8h3R/vJfoZt5pKECGCOEu951AP7pZdGcLzc0lqHdN0rBLhL4wOG EeCqDMbv/yh8cP402FEGRlVzh6Dyr1U= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1752488314; a=rsa-sha256; cv=none; b=iOoFw0yhWo4V8N702/BEkeVwwqcxFUAOcYRFMnPz+Vetqvc/UUz/E4vJCWT+X/TzhnxX8G PKTH19lIUjUoBgj9v5r9gEZXztTTCII+ENCaMJWtOeWtBtxe5c654NZMARs1TWtdE20OOg 3UzKB7Aj4HHlq2kSVawDz09Stp8rIbE= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RvRnGL8h; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf03.hostedemail.com: domain of chenhuacai@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=chenhuacai@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D380A5C5D04 for ; Mon, 14 Jul 2025 10:18:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84EBCC4CEED for ; Mon, 14 Jul 2025 10:18:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1752488312; bh=+57UPy+qTf25cjB3/LPUH3B7cWaNxCDrc05uMGhvQLM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=RvRnGL8hLV+iMQFt525uF2/QGslE0TJmTeEVlLHMEOUGk4C7T3WQhPwH0rOgip/vT moBfDx36WrGsnaTe1lzKdpQ5b5ColUw5aChYlPg4ekdSBw0hoWakohY+48+FWjRbhD xKiYALgi1O4ScrvmdyJJWd5tTSJYD+xsP5jUDrMt1WgwN7TsLKaLmvYjI+j+/femJ8 7x1SM6uxaydacWii2tN4WMPVCIMm/eEoyjgEGAlMfI+DjDhhBOTyf/pm9EMoE+Vkkg nw4GSsaaGcqB7hzYyTPRtueiRUK0zRIiinMxM6zvePmv2lhLTHoFLAwBM+8+Ruxb7O SEJOIKTecA6sg== Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-60bf5a08729so7649369a12.0 for ; Mon, 14 Jul 2025 03:18:32 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCVaElTPVMiIeWSHjH2nzW9T5kLwaFU8W56QZ+2vWA9RQnI3wEEN2ulgtXxNcMYnpJowWtwYENO6Zg==@kvack.org X-Gm-Message-State: AOJu0YyGEmsw34YkjzBqdPnok/Qz337lys8NGX7AIKkXvJZ8F4X3auhd HpgOJiAP3trKiF2qEIsHsVf1E8Qt5hKM0Fyxabj3XHpWTc8KVbBAquMBv7G6dgyGPB+RVmY3Q2u 42GmOKFy0qy+rOd9nqgygSUVlOYGXloU= X-Google-Smtp-Source: AGHT+IEbgsdrEbpMoRTpuQx3aEWsVHDo+zRZGrPlM9uO/YzZhKjwT1oque9/aqHQNdP/KW3JflRrozLBlvMp3rCzrns= X-Received: by 2002:a05:6402:30bb:b0:60c:4220:5d8b with SMTP id 4fb4d7f45d1cf-611e84ab122mr8444566a12.17.1752488310997; Mon, 14 Jul 2025 03:18:30 -0700 (PDT) MIME-Version: 1.0 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> <2025071306-barber-unbalance-53bb@gregkh> In-Reply-To: <2025071306-barber-unbalance-53bb@gregkh> From: Huacai Chen Date: Mon, 14 Jul 2025 18:18:17 +0800 X-Gmail-Original-Message-ID: X-Gm-Features: Ac12FXygS4qiUkiWUpWDgdRwfIMJyn6wDTCQVcKxzmp_IilR1J7VWEyTwUbL9Xg Message-ID: Subject: Re: [PATCH] init: Handle bootloader head in kernel parameters To: Greg KH Cc: Huacai Chen , Andrew Morton , linux-mm@kvack.org, Alexander Viro , Christian Brauner , Jan Kara , linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Stat-Signature: 5sb9nc8qeszb6uem44wfbxiw1jgm18g8 X-Rspamd-Queue-Id: E03FC20014 X-Rspamd-Server: rspam10 X-Rspam-User: X-HE-Tag: 1752488313-79705 X-HE-Meta: U2FsdGVkX18xIeDLM12NF5sLKtxT5xOQ5jrxg+JliYVy58wUM8lr659K0G/ibY2LhAWgLLsdc3rF0si/0ae3BRPxvotN8cvlwJYS4IuW+viVkQNGD/Yjw05WKCdPiwCtTx7d5NyiHCtT22Kzr0FYdmU22Pxw15zbqO6xBbfHhQkmWJL8Xg6VnhU9VxPf86DGopYzpYYGtOaFRahVH7G5d1G2ZgIx0434E9H5b977Et3pCeLg8b67RNd4u3AhGrdyml/hAtqyOWPA2Wj+mqAPJTQ/AG28PbSM3SOfxrdnsSIeZb008bd5KmwRYx1rU9jGmvaQ/pup5sQ4eb26Ryr4QZL8GVaqodckZTD8vOOPh8lM/6bT3Q/TP+f6/4J3FUDqoTKOc/rFb2wtaRJg6oQKapmYgrtKLPLcE0CGG0ssv7hbNdnVeiAUf6mAhdm74es4ZwSPv5FeZoBpAIQbDAGajYgdgcIbjPRsY5lOtVy1GoMcqvq2l8JDUItIJIHvdEy19ZuvoyYboUxkG9nYR6q+wNx+HisnTp0SpXAb2hTLneHjazMCd6dWiOOEcYzOE6QHjr2MSqQfLknqZse0H/6R5MncZlvfziJGs2I118DYZdXv9ehCey/YEzwopaANkanY6hB7KsyRpy5iKu8MkkSqKrVk8IBgoxEAoUvWA2h+fic/pDMIxkGnivGEtfU/Aj6esM+RYLMtK5Gf4Gc5249zsv6zOac4tk3+6+oFeYuSkeu7ObGfeJWTKHB/Iumh94qzDYEOXBH0xkccs6tuI44inDBXs4KcDVN87gQOsGnh4gd0vsnlgofOsgL+biBHXNMInkj2B2koGBonCk/Xk4xE+auKVLyRWVxESIdoWHz82W9P/0dZwV4JEKmSYfRk2DkjutKCMjxmxSlit3DdOVWC8nXJ5blTzv01MWGYfDix0n5xidNsc1zu6sUp0Bnlxe5eNks2MNCq1kuI+Dko4AX oUZTf1Mq j8SpY9L1gK+TGCcH3DM+lDw575RwQBp2E+TX4sUAAx7TVpAZolrmZSovsByHt0DCYzsccE+NksnLGypMxArMtJBHnUO23qYCMDd0is/4alfaz4cYTUyN6cfnOVUZLJhTrbVQaORqSBLjKXqCtsRY5qs7+T9PRaamWbOBBmjKPF8JE4lgD2iurBT3A75ETQam/GJ90tNmJIC/yriCdNIdakXMzJ+xXV8AFh7jq0EhfsB0nn0bwndqnG1Nc9bTJge2wV7U9LQuxKvtkXiLAePTF4k7gG9b/5fMBQH4HTQbVvAaN4re3S2Wxt8ojXQADcYfm9sH45B596jiH5pmHbF+iDhoOld47bhEKTHh5AokH5XULGNkkZ0EsibJJR4hDgvTdCSyRdAvm9qJ/f02vX6VUk2q6IbJu/qMDD+tn 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 5:35=E2=80=AFPM Greg KH wrote: > > On Sun, Jul 13, 2025 at 05:11:20PM +0800, Huacai Chen wrote: > > On Sun, Jul 13, 2025 at 4:30=E2=80=AFPM Greg KH wrote: > > > > > > On Sat, Jul 12, 2025 at 11:18:44PM +0800, Huacai Chen wrote: > > > > On Fri, Jul 11, 2025 at 9:04=E2=80=AFPM Greg KH wrote: > > > > > > > > > > On Fri, Jul 11, 2025 at 08:51:28PM +0800, Huacai Chen wrote: > > > > > > On Fri, Jul 11, 2025 at 8:41=E2=80=AFPM 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=E2=80=AFPM Greg KH wrote: > > > > > > > > > > > > > > > > > > On Fri, Jul 11, 2025 at 06:24:55PM +0800, Huacai Chen wro= te: > > > > > > > > > > BootLoader may pass a head such as "BOOT_IMAGE=3D/boot/= vmlinuz-x.y.z" to > > > > > > > > > > kernel parameters. But this head is not recognized by t= he kernel so will > > > > > > > > > > be passed to user space. However, user space init progr= am also doesn't > > > > > > > > > > recognized it. > > > > > > > > > > > > > > > > > > Then why is it on the kernel command line if it is not re= cognized? > > > > > > > > UEFI put it at the beginning of the command line, you can s= ee it from > > > > > > > > /proc/cmdline, both on x86 and LoongArch. > > > > > > > > > > > > > > Then fix UEFI :) > > > > > > > > > > > > > > My boot command line doesn't have that on x86, perhaps you ne= ed to fix > > > > > > > your bootloader? > > > > > > Not only UEFI, Grub also do this, for many years, not now. I do= n't > > > > > > know why they do this, but I think at least it is not a bug. Fo= r > > > > > > 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=3D(hd0,gpt2)/vmlinuz-6.12.0-84.el10.x86_64 > > > > > > root=3DUUID=3Dc8fcb11a-0f2f-48e5-a067-4cec1d18a721 ro > > > > > > crashkernel=3D2G-64G:256M,64G-:512M > > > > > > resume=3DUUID=3D1c320fec-3274-4b5b-9adf-a06 > > > > > > 42e7943c0 rhgb quiet > > > > > > > > > > Sounds like a bootloader bug: > > > > > > > > > > $ cat /proc/cmdline > > > > > root=3D/dev/sda2 rw > > > > > > > > > > I suggest fixing the issue there, at the root please. > > > > Grub pass BOOT_IMAGE for all EFI-based implementations, related com= mits of Grub: > > > > https://cgit.git.savannah.gnu.org/cgit/grub.git/commit/?id=3D16ccb8= b138218d56875051d547af84410d18f9aa > > > > https://cgit.git.savannah.gnu.org/cgit/grub.git/commit/?id=3D25953e= 10553dad2e378541a68686fc094603ec54 > > > > > > 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=3D86d1919a4fb0d9c115dd1d3b969f5d1650e45408 > > > > > > 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/cmd= line: > > > > 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 o= nes > > > 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 use= r > > > > space programs that hope it be in /proc/cmdline. > > > > > > But who relies on this that never noticed the kernel complaining abou= t > > > 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? As I said before: Corner cases have had problems since 2005, and just because they are corner cases, they are not noticed by everyone. But once they are noticed, they need to be fixed. And we cannot change Grub (LILO do the same thing) now, because user space relies on it already. > > thanks, > > greg k-h