[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d25b2c63-32e2-4a41-b982-da5131cffd2f@oracle.com>
Date: Mon, 1 Sep 2025 20:20:18 +0200
From: Vegard Nossum <vegard.nossum@...cle.com>
To: Kees Cook <kees@...nel.org>
Cc: Nathan Chancellor <nathan@...nel.org>,
Nicolas Schier <nicolas.schier@...ux.dev>,
Jonathan Corbet <corbet@....net>,
Masahiro Yamada <masahiroy@...nel.org>,
Randy Dunlap
<rdunlap@...radead.org>, Arnd Bergmann <arnd@...db.de>,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
linux-kbuild@...r.kernel.org, linux-doc@...r.kernel.org,
Miguel Ojeda <ojeda@...nel.org>,
Stephen Brennan <stephen.s.brennan@...cle.com>,
Marco Bonelli <marco@...eim.net>, Petr Vorel <pvorel@...e.cz>,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v2] kconfig: Add transitional symbol attribute for
migration support
On 01/09/2025 18:56, Kees Cook wrote:
>>> @@ -459,13 +462,15 @@ void sym_calc_value(struct symbol *sym)
>>> sym_calc_choice(choice_menu);
>>> newval.tri = sym->curr.tri;
>>> } else {
>>> - if (sym->visible != no) {
>>> + if (sym->usable) {
>>> /* if the symbol is visible use the user value
>>> * if available, otherwise try the default value
>>> */
>>> if (sym_has_value(sym)) {
>>> + tristate value = sym->transitional ?
>>> + sym->def[S_DEF_USER].tri : sym->visible;
>>> newval.tri = EXPR_AND(sym->def[S_DEF_USER].tri,
>>> - sym->visible);
>>> + value);
>> This looks a bit odd to me. Just thinking out loud: your new logic is
>> there to be able to use a value even though it's not visible. In the
>> case where it's transitional you use the .config value instead of the
>> condition that makes it visible.
>>
>> Could you simply change sym_calc_visibility() instead to always return
>> 'yes' when the symbol is transitional? Wouldn't that simplify everything
>> in sym_calc_value()?
> It's a tristate, so "m" is also possible besides "y". (sym->visible is
> also a tristate. 🙂
That would be fine, right?
We'd pass the if (sym->visible != no) check... we'd do the
newval.tri = EXPR_AND(sym->def[S_DEF_USER].tri, sym->visible);
EXPR_AND() is basically min() (with n=0, m=1, y=2), so effectively it
would end up doing
newval.tri = min(sym->def[S_DEF_USER].tri, 2);
which is the same as
newval.tri = sym->def[S_DEF_USER].tri;
That's what your code is currently doing too, but in a much more
roundabout way.
Vegard
Powered by blists - more mailing lists