[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202509041805.5C660B7B70@keescook>
Date: Thu, 4 Sep 2025 18:09:09 -0700
From: Kees Cook <kees@...nel.org>
To: Andrew Pinski <andrew.pinski@....qualcomm.com>
Cc: Qing Zhao <qing.zhao@...cle.com>, Andrew Pinski <pinskia@...il.com>,
Richard Biener <rguenther@...e.de>,
Joseph Myers <josmyers@...hat.com>, 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>,
Peter Zijlstra <peterz@...radead.org>,
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>, gcc-patches@....gnu.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH v2 1/7] mangle: Introduce C typeinfo mangling API
On Thu, Sep 04, 2025 at 05:50:45PM -0700, Andrew Pinski wrote:
> On Thu, Sep 4, 2025 at 5:27 PM Kees Cook <kees@...nel.org> wrote:
> > +
> > + /* Unknown builtin type - this should never happen in a well-formed C program. */
> > + debug_tree (type);
> > + internal_error ("mangle: Unknown builtin type in function %qD - please report this as a bug",
> > + current_function_context);
>
> This should NOT be internal_error but rather sorry.
Ah, heh. I switched to internal_error because you'd suggested it in
the last version. Maybe I misunderstood where I should be using sorry vs
internal_error.
> > + if (!name && !TYPE_NAME (type))
> > + {
> > + static char anon_name[128];
>
> I am not a fan of a static variable here. Why not just a stack variable?
Oh, whoops. I will fix that.
> > + {
> > + /* Always show diagnostic information for missing struct names. */
> > + debug_tree (type);
> > + internal_error ("mangle: Missing case in struct name extraction - please report this as a bug");
>
> Again sorry rather than internal_error.
>
> I still think it would be better if the hashing and mangling be one
> step rather than 2 separate steps.
> Especially since this is only used for the hashing and will most
> likely only used there ever.
In this version the hashing happens immediately. No full string is built
unless the dumpfile is enabled.
-Kees
--
Kees Cook
Powered by blists - more mailing lists