From: Vegard Nossum <vegard.nossum@oracle.com>
To: Kees Cook <kees@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Petr Vorel <pvorel@suse.cz>,
linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH] kconfig: Avoid prompting for transitional symbols
Date: Tue, 30 Sep 2025 08:25:06 +0200 [thread overview]
Message-ID: <f2556f4c-9036-4b79-a4b0-4e4c82a93abc@oracle.com> (raw)
In-Reply-To: <20250930045300.work.375-kees@kernel.org>
On 30/09/2025 06:53, Kees Cook wrote:
> The "transitional" symbol keyword, while working with the "olddefconfig"
> target, was prompting during "oldconfig". This occurred because these
> symbols were not being marked as user-defined when they received values
> from transitional symbols that had user values. The "olddefconfig" target
> explicitly doesn't prompt for anything, so this deficiency wasn't noticed.
>
> The issue manifested when a symbol's value came from a transitional
> symbol's user value but the receiving symbol wasn't marked with
> SYMBOL_DEF_USER. Thus the "oldconfig" logic would then prompt for these
> symbols unnecessarily.
>
> Check after value calculation whether a symbol without a user value
> gets its value from a single transitional symbol that does have a user
> value. In such cases, mark the receiving symbol as user-defined to
> prevent prompting.
Sorry for not catching this issue.
> diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
> index 760cac998381..9cc2fd5bc016 100644
> --- a/scripts/kconfig/symbol.c
> +++ b/scripts/kconfig/symbol.c
> @@ -411,7 +411,7 @@ bool sym_dep_errors(void)
> void sym_calc_value(struct symbol *sym)
> {
> struct symbol_value newval, oldval;
> - struct property *prop;
> + struct property *prop = NULL;
> struct menu *choice_menu;
>
> if (!sym)
> @@ -520,6 +520,22 @@ void sym_calc_value(struct symbol *sym)
> ;
> }
>
> + /*
> + * If the symbol lacks a user value but its value comes from a
> + * single transitional symbol with an existing user value, mark
> + * this symbol as having a user value to avoid prompting.
> + */
> + if (prop && !sym_has_value(sym)) {
> + struct symbol *ds = prop_get_symbol(prop);
> + if (ds && (ds->flags & SYMBOL_TRANS) && sym_has_value(ds)) {
> + if (sym->type == S_BOOLEAN || sym->type == S_TRISTATE)
> + sym->def[S_DEF_USER].tri = newval.tri;
> + else
> + sym->def[S_DEF_USER].val = newval.val;
sym->def[S_DEF_USER] and newval are both 'struct symbol_value', can we
just unconditionally do this instead?
sym->def[S_DEF_USER] = newval;
> + sym->flags |= SYMBOL_DEF_USER;
> + }
> + }
> +
> sym->curr = newval;
> sym_validate_range(sym);
I have to run, will take a closer look later. Thanks,
Vegard
next prev parent reply other threads:[~2025-09-30 6:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-30 4:53 [PATCH] kconfig: Avoid prompting for transitional symbols Kees Cook
2025-09-30 6:25 ` Vegard Nossum [this message]
2025-09-30 14:59 ` Kees Cook
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=f2556f4c-9036-4b79-a4b0-4e4c82a93abc@oracle.com \
--to=vegard.nossum@oracle.com \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=pvorel@suse.cz \
--cc=torvalds@linux-foundation.org \
/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