From: Huacai Chen <chenhuacai@kernel.org>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Huacai Chen <chenhuacai@loongson.cn>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH V2] init: Handle bootloader identifier in kernel parameters
Date: Mon, 21 Jul 2025 18:10:55 +0800 [thread overview]
Message-ID: <CAAhV-H5nHBuXao1NGgSyD5CJzFHg6Vf0s+Fr3TadH01KjsMDSw@mail.gmail.com> (raw)
In-Reply-To: <2025072056-gambling-ranger-5b0f@gregkh>
On Sun, Jul 20, 2025 at 7:10 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Sun, Jul 20, 2025 at 06:55:09PM +0800, Huacai Chen wrote:
> > BootLoader (Grub, LILO, etc) may pass an identifier such as "BOOT_IMAGE=
> > /boot/vmlinuz-x.y.z" to kernel parameters. But these identifiers are not
> > recognized by the kernel itself so will be passed to user space. However
> > user space init program also doesn't recognized it.
> >
> > KEXEC may also pass an identifier such as "kexec" on some architectures.
> >
> > We cannot change BootLoader's behavior, because this behavior exists for
> > many years, and there are already user space programs search BOOT_IMAGE=
> > in /proc/cmdline to obtain the kernel image locations:
> >
> > 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)
> >
> > So the the best way is handle (ignore) it by the kernel itself, which
> > can avoid such boot warnings (if we use something like init=/bin/bash,
> > bootloader identifier can even cause a crash):
> >
> > Kernel command line: BOOT_IMAGE=(hd0,1)/vmlinuz-6.x root=/dev/sda3 ro console=tty
> > Unknown kernel command line parameters "BOOT_IMAGE=(hd0,1)/vmlinuz-6.x", will be passed to user space.
> >
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> > ---
> > V2: Update comments and commit messages.
> >
> > init/main.c | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/init/main.c b/init/main.c
> > index 225a58279acd..c53863e5ad82 100644
> > --- a/init/main.c
> > +++ b/init/main.c
> > @@ -545,6 +545,7 @@ static int __init unknown_bootoption(char *param, char *val,
> > const char *unused, void *arg)
> > {
> > size_t len = strlen(param);
> > + const char *bootloader[] = { "BOOT_IMAGE=", "kexec", NULL };
>
> Where is this magic set of values now documented? Each of these need to
> be strongly documented as to why we are ignoring them and who is adding
> them and why they can't be fixed for whatever reason.
OK, will do.
Huacai
>
> thanks,
>
> greg k-h
prev parent reply other threads:[~2025-07-21 10:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-20 10:55 Huacai Chen
2025-07-20 11:10 ` Greg KH
2025-07-21 10:10 ` Huacai Chen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAAhV-H5nHBuXao1NGgSyD5CJzFHg6Vf0s+Fr3TadH01KjsMDSw@mail.gmail.com \
--to=chenhuacai@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=chenhuacai@loongson.cn \
--cc=gregkh@linuxfoundation.org \
--cc=jack@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=stable@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox