[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2025040743-kick-computing-0ecd@gregkh>
Date: Mon, 7 Apr 2025 17:35:35 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: zhoumin <teczm@...mail.com>
Cc: dakr@...nel.org, akpm@...ux-foundation.org,
linux-kernel@...r.kernel.org, rafael@...nel.org,
viro@...iv.linux.org.uk
Subject: Re: [PATCH] kobject_uevent: add uevent_helper exist check
On Mon, Apr 07, 2025 at 11:18:12PM +0800, zhoumin wrote:
> Hi Greg
>
> I appreciate your patience in addressing this.
>
> > > The kernel creates uevent_helper process for every uevent sent,
> > > even if the uevent_helper does not exist. Before the rootfs is
> > > mounted, a large number of events are generated. This change
> > > introduces uevent_helper existence check to prevent unnecessary
> > > operations.
>
> > What problem is this causing? What changed to make this actually be a
> problem?
>
> I think calling uevent_helper before rootfs mount is pointless and waste
> time, because uevent_helper does not exist at that stage. For example,
> fs_initcall(chr_dev_init),subsys_initcall(usb_init) and etc, these module
> run before rootfs_initcall and will trigger kobject_uevent when
> uevent_helper isn't ready.
>
> However, I've discovered this issue was already addressed by commit:
> <b234ed6d629420827e2839c8c8935be85a0867fd> ("init: move
> usermodehelper_enable() to populate_rootfs()")
>
> Due to my device running an outdated kernel version, this change wasn't
> immediately apparent to me.
Ah, great, let's just stick with the change that we already have.
> But I propose we should make call_usermodehelper_exec fail earlier, link
> this:
> --- a/lib/kobject_uevent.c
> +++ b/lib/kobject_uevent.c
> @@ -610,7 +610,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
>
> #ifdef CONFIG_UEVENT_HELPER
> /* call uevent_helper, usually only enabled during early boot */
> - if (uevent_helper[0] && !kobj_usermode_filter(kobj)) {
> + if (uevent_helper[0] && !usermodehelper_disabled && !kobj_usermode_filter(kobj)) {
> struct subprocess_info *info;
>
> retval = add_uevent_var(env, "HOME=/");
Why? Will this actually change the speed of anything?
> > Signed-off-by: zhoumin
>
> > Please use your name here, not an alias.
>
> This is the Pinyin spelling of my Chinese name.
No reason you can not just use the Chinese spelling of your name either :)
thanks,
greg k-h
Powered by blists - more mailing lists