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: <202512121741.5583E7D@keescook>
Date: Fri, 12 Dec 2025 17:43:15 -0800
From: Kees Cook <kees@...nel.org>
To: Andrew Pinski <andrew.pinski@....qualcomm.com>
Cc: Qing Zhao <qing.zhao@...cle.com>, Uros Bizjak <ubizjak@...il.com>,
	Joseph Myers <josmyers@...hat.com>,
	Richard Biener <rguenther@...e.de>,
	Jeff Law <jeffreyalaw@...il.com>, Andrew Pinski <pinskia@...il.com>,
	Jakub Jelinek <jakub@...hat.com>, Martin Uecker <uecker@...raz.at>,
	Peter Zijlstra <peterz@...radead.org>,
	Ard Biesheuvel <ardb@...nel.org>, Jan Hubicka <hubicka@....cz>,
	Richard Earnshaw <richard.earnshaw@....com>,
	Richard Sandiford <richard.sandiford@....com>,
	Marcus Shawcroft <marcus.shawcroft@....com>,
	Kyrylo Tkachov <kyrylo.tkachov@....com>,
	Kito Cheng <kito.cheng@...il.com>,
	Palmer Dabbelt <palmer@...belt.com>,
	Andrew Waterman <andrew@...ive.com>,
	Jim Wilson <jim.wilson.gcc@...il.com>,
	Dan Li <ashimida.1990@...il.com>,
	Sami Tolvanen <samitolvanen@...gle.com>,
	Ramon de C Valle <rcvalle@...gle.com>,
	Joao Moreira <joao@...rdrivepizza.com>,
	Nathan Chancellor <nathan@...nel.org>,
	Bill Wendling <morbo@...gle.com>,
	"Osterlund, Sebastian" <sebastian.osterlund@...el.com>,
	"Constable, Scott D" <scott.d.constable@...el.com>,
	gcc-patches@....gnu.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v9 1/7] typeinfo: Introduce KCFI typeinfo mangling API

On Fri, Dec 12, 2025 at 05:29:43PM -0800, Andrew Pinski wrote:
> On Fri, Dec 12, 2025 at 5:24 PM Kees Cook <kees@...nel.org> wrote:
> >
> > On Fri, Dec 12, 2025 at 03:07:51PM -0800, Andrew Pinski wrote:
> > > On Tue, Dec 9, 2025 at 6:27 PM Kees Cook <kees@...nel.org> wrote:
> > > [...]
> > > > +uint32_t
> > > > +typeinfo_get_hash (tree type)
> > > > +{
> > > > +  gcc_assert (type != NULL_TREE);
> > > > +  uint32_t hash_state = 2166136261U; /* FNV-1a 32-bit offset basis.  */
> > > > +
> > > > +  mangle_type (type, nullptr, &hash_state);
> > > > +  return hash_state;
> > > > +}
> > >
> > > It might make sense to do a few self_test here instead of (in addition
> > > to) having a testcase.
> > > This way the testing is done earlier.
> >
> > I tried to do this back in v2 and could not make it work. See [1] for
> > more details on what I found, but basically I don't have access to the
> > parser itself in the selftests, so I couldn't build end-to-end testing
> > of arbitrary C (testing node types isn't really a sufficient test in my
> > view). I could to basic type tests, but it would be redundant to what
> > I ended up with in dg, and I didn't want to split up the testing.
> 
> I am asking for self-tests of the API and not depending on the C
> parser. So generating some FUNCTION_TYPE types and then getting back
> the hash and/or name.
> 
> > (testing node types isn't really a sufficient test in my view)
> It might not be a fully sufficient test in itself; it does not mean it
> is NOT a useful test to have. This is why I mentioned in addition to.
> Testing the API outside of the end-to-end testing is a good thing and
> can find bugs early on.  GCC does not have enough self-tests really
> and folks don't use it as much as we should.

Okay, yeah, if doing this kind of "manual" construction is viewed as
meaningful, I'll give it a shot to augment the existing tests.

-Kees

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ