linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vegard Nossum <vegard.nossum@oracle.com>
To: Kees Cook <kees@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <nicolas.schier@linux.dev>,
	Jonathan Corbet <corbet@lwn.net>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org,
	Miguel Ojeda <ojeda@kernel.org>,
	Stephen Brennan <stephen.s.brennan@oracle.com>,
	Marco Bonelli <marco@mebeim.net>, Petr Vorel <pvorel@suse.cz>,
	linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH v2] kconfig: Add transitional symbol attribute for migration support
Date: Mon, 1 Sep 2025 20:20:18 +0200	[thread overview]
Message-ID: <d25b2c63-32e2-4a41-b982-da5131cffd2f@oracle.com> (raw)
In-Reply-To: <202509010949.9A61A98@keescook>


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

  reply	other threads:[~2025-09-01 18:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-30  2:01 [PATCH v2] kconfig: Add transitional symbol attribute for migration support Kees Cook
2025-09-01  8:34 ` Vegard Nossum
2025-09-01 16:56   ` Kees Cook
2025-09-01 18:20     ` Vegard Nossum [this message]
2025-09-01 18:31       ` Kees Cook
2025-09-01 18:44         ` Vegard Nossum
2025-09-04  2:51           ` Kees Cook
2025-09-04 17:03             ` Vegard Nossum
2025-09-04 17:10               ` Vegard Nossum
2025-09-05  9:41                 ` Vegard Nossum
2025-09-05 16:24                   ` Kees Cook
2025-09-05 16:23               ` Kees Cook
2025-09-01  9:09 ` Jani Nikula
2025-09-01 16:48   ` Kees Cook
2025-09-01 16:39 ` Randy Dunlap
2025-09-01 16:45   ` Kees Cook
2025-09-01 16:54     ` Randy Dunlap

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=d25b2c63-32e2-4a41-b982-da5131cffd2f@oracle.com \
    --to=vegard.nossum@oracle.com \
    --cc=arnd@arndb.de \
    --cc=corbet@lwn.net \
    --cc=kees@kernel.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marco@mebeim.net \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nicolas.schier@linux.dev \
    --cc=ojeda@kernel.org \
    --cc=pvorel@suse.cz \
    --cc=rdunlap@infradead.org \
    --cc=stephen.s.brennan@oracle.com \
    /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;
as well as URLs for NNTP newsgroup(s).