From: Greg KH <gregkh@linuxfoundation.org>
To: Ren Wei <weir@nebusec.ai>
Cc: driver-core@lists.linux.dev, linux-kernel@vger.kernel.org,
rafael@kernel.org, dakr@kernel.org, johan@kernel.org,
akpm@linux-foundation.org, kay.sievers@vrfy.org, vega@nebusec.ai,
caoruide123@gmail.com
Subject: Re: [PATCH driver-core v2] kobject: terminate the uevent helper environment
Date: Wed, 25 Nov 2026 10:14:25 +0100 [thread overview]
Message-ID: <2026112516-germicide-viewing-3a9f@gregkh> (raw)
In-Reply-To: <39d1eae0d7c8b235f5d4b68d94205b70832ab786.1795506878.git.caoruide123@gmail.com>
On Wed, Nov 25, 2026 at 04:51:00PM +0800, Ren Wei wrote:
> From: Ruide Cao <caoruide123@gmail.com>
>
> struct kobj_uevent_env has room for UEVENT_NUM_ENVP (64) environment
> pointers and add_uevent_var() lets all of them be used. Once the last
> slot is filled there is no room left for a NULL terminator.
>
> The usermode helper path passes env->envp straight to
> call_usermodehelper_setup(), and kernel_execve() expects a NULL
> terminated array. A synthetic uevent written to a sysfs uevent file can
> supply enough variables to fill all 64 slots. With CONFIG_UEVENT_HELPER
> enabled and a helper configured, kernel_execve() then walks past the
> array into envp_idx and buf, and dereferences that data as string
> pointers.
>
> Lowering the limit to 63 would avoid the overrun, but it would also
> reduce the capacity available to every uevent, including the netlink
> path that does not need a terminator, and could make existing callers
> with many variables start failing.
>
> Add a dedicated sentinel slot instead, keep the limit at
> UEVENT_NUM_ENVP, and keep the array NULL terminated after a variable is
> added and after zap_modalias_env() removes one.
>
> Fixes: 7eff2e7a8b65 ("Driver core: change add_uevent_var to use a struct")
> Cc: stable@vger.kernel.org
> Reported-by: Vega <vega@nebusec.ai>
> Signed-off-by: Ruide Cao <caoruide123@gmail.com>
> Signed-off-by: Ren Wei <weir@nebusec.ai>
> ---
> Changes in v2:
> - Keep the capacity at 64 variables by adding a sentinel slot instead of
> lowering the add_uevent_var() limit, which would regress callers that
> emit many variables.
> - Compare against UEVENT_NUM_ENVP explicitly.
> - Keep envp[] NULL terminated after zap_modalias_env() removes MODALIAS.
>
> v1: https://lore.kernel.org/all/cover.1795426787.git.caoruide123@gmail.com/
Why did you not actually reply to my previous email?
Why did your previous patch not work? What testing was done differently
between the previous patch and this one to require this patch?
Without an actual discussion, just throwing random patches at us does
nothing to make us want to accept the change at all, for obvious reasons
(i.e. what would you want to see if you were in my position here?)
thanks,
greg k-h
next prev parent reply other threads:[~2026-11-25 9:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 8:51 [PATCH driver-core v2] kobject: terminate the uevent helper environment Ren Wei
2026-11-25 9:14 ` Greg KH [this message]
2026-11-25 9:40 ` Ruide Cao
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=2026112516-germicide-viewing-3a9f@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=akpm@linux-foundation.org \
--cc=caoruide123@gmail.com \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=johan@kernel.org \
--cc=kay.sievers@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=vega@nebusec.ai \
--cc=weir@nebusec.ai \
/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