On Sat, Apr 17, 2021 at 12:26:56AM +0200, Thomas Gleixner wrote: > On Fri, Apr 16 2021 at 13:38, Sami Tolvanen wrote: > > With CONFIG_CFI_CLANG, the compiler replaces function addresses in C > > code with jump table addresses. > > Fine. > > > To avoid referring to jump tables in entry code with PTI, > > What has this to do with PTI?
Short answer: in earlier development of this series, entry routines were attempting to jump to the (unmapped) jump tables, and IDT code had similar issues. But yes, the commit message can be improved; I'll let Sami explain the details. > > disable CFI for IDT and paravirt code, and use function_nocfi() to > > prevent jump table addresses from being added to the IDT or system > > call entry points. > > How does this changelog make sense for anyone not familiar with the > matter at hand? > > Where is the analysis why excluding > > > +CFLAGS_REMOVE_idt.o := $(CC_FLAGS_CFI) > > +CFLAGS_REMOVE_paravirt.o := $(CC_FLAGS_CFI) > > all of idt.c and paravirt.c is correct and how that is going to be > correct in the future? > > These files are excluded from CFI, so I can add whatever I want to them > and circumvent the purpose of CFI, right? > > Brilliant plan that. But I know, sekurity ... *sigh* we're on the same side. :P I will choose to understand your comments here as: "How will enforcement of CFI policy be correctly maintained here if the justification for disabling it for whole compilation units is not clearly understandable by other developers not familiar with the nuances of its application?" This is a completely justified position to take. Thank you for calling it out; we'll make it better. -- Kees Cook