Re: [PATCH v5 09/15] x86: Use an opaque type for functions not callable from C

From: Josh Poimboeuf
Date: Thu Oct 14 2021 - 15:07:05 EST


On Thu, Oct 14, 2021 at 02:52:11PM -0400, Steven Rostedt wrote:
> On Thu, 14 Oct 2021 11:47:01 -0700
> Kees Cook <keescook@xxxxxxxxxxxx> wrote:
>
> > On Thu, Oct 14, 2021 at 07:31:26PM +0200, Borislav Petkov wrote:
> > > On Thu, Oct 14, 2021 at 09:07:57AM -0700, Kees Cook wrote:
> > > Looking at the changelog, DECLARE_ASM_FUNC_SYMBOL, makes a lot more
> > > sense to me even if it doesn't specify the aspect that it is not called
> > > by C but who cares - it is generic enough.
> >
> > Around we go. :) Josh[1] and Steven[2] explicitly disagreed with
> > that name, leading to the current name[3]. Do you want it to be
> > DECLARE_ASM_FUNC_SYMBOL() over those objections?
>
> Just note, that I was fine with the original name, but was against the
> version Josh suggested ;-)

Naming is important, especially for something as confusing as this. We
need to be able to read it in a few months and have some idea of what's
going on.

"DECLARE_ASM_FUNC_SYMBOL" is nonsensical. As a reader of the code I
wonder why are some asm functions using it and not others? And how do I
know if I need it for my new function?

"extern const u8 int3_magic[]" is even worse. Why are some asm
functions randomly declared as arrays, and others not? Where can I go
to find out more without digging through the commit log?

--
Josh