lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNAQAoPhZrbY=5iBSCxWegSaoqsdtY=3zK+u+ZrgevidAsw@mail.gmail.com>
Date: Sun, 25 May 2025 02:07:44 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Bill Wendling <isanbard@...il.com>
Cc: Bill Wendling <morbo@...gle.com>, 
	Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>, 
	Randy Dunlap <rdunlap@...radead.org>
Subject: Re: [PATCH v3] kconfig: check for a NULL pointer before access

On Sat, May 24, 2025 at 9:49 AM Bill Wendling <isanbard@...il.com> wrote:
>
> The call to 'prop_get_symbol' may return NULL in some cases. The if-then
> statement accesses the returned value without cheecking if it's
> non-NULL. After inlining, the compiler may treat the conditional as
> 'undefined behavior', which the compiler may take the opportunity to do
> whatever it wants with the UB path. This patch simply adds a check to
> ensure that 'def_sym' is non-NULL to avoid this behavior.
>
> Signed-off-by: Bill Wendling <isanbard@...il.com>


Same reaction to this patch

https://lore.kernel.org/linux-kbuild/20250212154537.235297-1-ant.v.moryakov@gmail.com/


Please attach a test case
that causes a segfault with NULL pointer dereference.











> ---
> Cc: Masahiro Yamada <masahiroy@...nel.org>
> Cc: linux-kbuild@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org
> v3:
>   - Fix whitespace for real now.
>   - Patch from another email account so that the whitespace is retained.
> v2:
>   - Fix whitespace
> ---
>   scripts/kconfig/symbol.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
> index d57f8cbba291..9c5068225328 100644
> --- a/scripts/kconfig/symbol.c
> +++ b/scripts/kconfig/symbol.c
> @@ -272,7 +272,7 @@ struct symbol *sym_choice_default(struct menu *choice)
>                 if (prop->visible.tri == no)
>                         continue;
>                 def_sym = prop_get_symbol(prop);
> -               if (def_sym->visible != no)
> +               if (def_sym && def_sym->visible != no)
>                         return def_sym;
>         }
>
> --
> 2.49.0.1164.gab81da1b16-goog
>


-- 
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ