All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: zhoumin <teczm@foxmail.com>
Cc: dakr@kernel.org, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org, rafael@kernel.org,
	viro@zeniv.linux.org.uk
Subject: Re: [PATCH] kobject_uevent: add uevent_helper exist check
Date: Mon, 7 Apr 2025 17:35:35 +0200	[thread overview]
Message-ID: <2025040743-kick-computing-0ecd@gregkh> (raw)
In-Reply-To: <tencent_019E709405D8474A5D5A21E429D046331808@qq.com>

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

  reply	other threads:[~2025-04-07 15:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-04 17:31 [PATCH] kobject_uevent: add uevent_helper exist check zhoumin
2025-04-05 22:52 ` Andrew Morton
2025-04-06  6:19   ` zhoumin
2025-04-07  7:01     ` Greg KH
2025-04-07  7:00 ` Greg KH
2025-04-07 15:18   ` zhoumin
2025-04-07 15:35     ` Greg KH [this message]
2025-04-07 16:22       ` zhoumin

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=2025040743-kick-computing-0ecd@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=dakr@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=teczm@foxmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.