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: <202509011125.5879901C@keescook>
Date: Mon, 1 Sep 2025 11:31:27 -0700
From: Kees Cook <kees@...nel.org>
To: Vegard Nossum <vegard.nossum@...cle.com>
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 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);

?

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ