Re: [PATCH 00/11] x86/ibt: FineIBT-BHI
From: Peter Zijlstra
Date: Thu Feb 13 2025 - 05:48:23 EST
On Mon, Feb 10, 2025 at 10:29:22AM -0800, Sami Tolvanen wrote:
> Hi Peter,
>
> On Fri, Feb 7, 2025 at 4:28 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> >
> > Hi!
> >
> > Respin of the FineIBT-BHI patches.
> >
> > Scott has managed to get LLVM bits merged:
> >
> > https://github.com/llvm/llvm-project/commit/e223485c9b38a5579991b8cebb6a200153eee245
> >
> > Which prompted me to update these patches once again.
> >
> > They boot and build the next kernel on my ADL when booted with: cfi=fineibt+bhi
> >
> > Aside from the last two patches -- which implement the FineIBT-BHI scheme
> > proper -- I'm planning on getting these patches merged 'soon'.
> >
> > Scott, what those last two patches need, aside from a lot more testing, is a
> > coherent writeup of how the mitigation works and ideally also a few numbers
> > proving the performance gains are worth it.
> >
> > Last version at:
> >
> > https://lore.kernel.org/all/20240927194856.096003183@xxxxxxxxxxxxx/T/#u
> >
> > Current patches:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git x86/fineibt-bhi
> >
> > Patches apply on top of tip/master.
>
> I gave this a spin with a ToT Clang; LKDTM 's CFI_FORWARD_PROTO test
> now traps in __bhi_args_1 as expected, and the changes look good to
> me. The is_endbr() clean-up also fixes the gendwarfksyms+ftrace build
> issue reported earlier. Feel free to add:
>
> Reviewed-by: Sami Tolvanen <samitolvanen@xxxxxxxxxx>
Thanks!
> One thing I realized is that CONFIG_CFI_PERMISSIVE doesn't actually do
> anything when FineIBT is used since we lose track of CFI trap
> locations. I'm not sure if that's worth fixing, but perhaps we could
> disable FineIBT when permissive mode is enabled to avoid confusion?
Hmm, yeah, that's one thing I keep forgetting about. Let me try and fix
it and see how ugly it gets before offering an opinion :-)