[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2025040731-eternity-statutory-4a80@gregkh>
Date: Mon, 7 Apr 2025 09:00:35 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: zhoumin <teczm@...mail.com>
Cc: rafael@...nel.org, dakr@...nel.org, akpm@...ux-foundation.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kobject_uevent: add uevent_helper exist check
On Sat, Apr 05, 2025 at 01:31:02AM +0800, zhoumin wrote:
> 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?
> Logs a debug messase before call_usermodehelper_setup.
I can not parse this sentence, sorry.
> e.g.: pr_emerg("action:%s devpath:%s\n", action_string, devpath);
> You will see a large number of uevent_helper processes
> are attempted to be created before the rootfs is mounted.
Again, why is that a problem?
> Signed-off-by: zhoumin <teczm@...mail.com>
Please use your name here, not an alias.
> ---
> lib/kobject_uevent.c | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
> index b7f2fa08d9c8..f3d34ded141a 100644
> --- a/lib/kobject_uevent.c
> +++ b/lib/kobject_uevent.c
> @@ -28,6 +28,7 @@
> #include <net/sock.h>
> #include <net/netlink.h>
> #include <net/net_namespace.h>
> +#include <linux/namei.h>
>
>
> atomic64_t uevent_seqnum;
> @@ -58,6 +59,23 @@ static const char *kobject_actions[] = {
> [KOBJ_UNBIND] = "unbind",
> };
>
> +#ifdef CONFIG_UEVENT_HELPER
> +static int uevent_helper_lookup(void)
> +{
> + static int ret = -ENOENT;
> + struct path path;
> +
> + if (!ret)
> + return ret;
> +
> + ret = kern_path(uevent_helper, LOOKUP_FOLLOW, &path);
> + if (!ret)
> + path_put(&path);
What happens when the root filesystem changes to the new one? This
feels wrong as Andrew said.
thanks,
greg k-h
Powered by blists - more mailing lists