[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0d9ef42f-57c7-472b-89c1-4534f40991f7@oracle.com>
Date: Mon, 1 Sep 2025 20:44:56 +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 20:31, Kees Cook wrote:
> On Mon, Sep 01, 2025 at 08:20:18PM +0200, Vegard Nossum wrote:
>>
>> 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.
>
> Right, it was this:
>
> newval.tri = EXPR_AND(sym->def[S_DEF_USER].tri, sym->visible);
>
> But I made it effectively:
>
> if (sym->transitional)
> newval.tri = EXPR_AND(sym->def[S_DEF_USER].tri, sym->def[S_DEF_USER].tri);
> else
> newval.tri = EXPR_AND(sym->def[S_DEF_USER].tri, sym->visible);
>
> That first "if" is kind of pointless. I just sent the v3 before I saw
> this email. :P
>
> I was trying to avoid yet more indentation, but I could change it to:
>
> if (sym->transitional)
> newval.tri = sym->def[S_DEF_USER].tri;
> else
> newval.tri = EXPR_AND(sym->def[S_DEF_USER].tri,
> sym->visible);
>
> ?
>
If you change sym_calc_visibility() to always return 'yes' for
transitional values then I don't think you need to touch
sym_calc_value() at all.
Vegard
Powered by blists - more mailing lists