[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202512121709.F5617B17D@keescook>
Date: Fri, 12 Dec 2025 17:24:31 -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 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.
If I'm missing some other way to do this, I'd be happy to give it a shot!
-Kees
[1] https://lore.kernel.org/linux-hardening/20250905002418.464643-1-kees@kernel.org/
--
Kees Cook
Powered by blists - more mailing lists