Re: [PATCH v2 0/5] Improve objtool jump table handling
From: Josh Poimboeuf
Date: Thu Oct 10 2024 - 16:36:28 EST
On Thu, Oct 10, 2024 at 07:50:17PM +0200, Ard Biesheuvel wrote:
> On Thu, 10 Oct 2024 at 14:28, Ard Biesheuvel <ardb+git@xxxxxxxxxx> wrote:
> >
> > From: Ard Biesheuvel <ardb@xxxxxxxxxx>
> >
> > Jump table handling has faded into the background a little due to the
> > fact that jump tables are [currently] disabled when enabling retpoline
> > mitigations and/or IBT on x86.
> >
> > However, this is likely to come back and bite us later, so it still
> > needs to be addressed. Given the difficulty in identifying jump tables
> > from .rodata references and indirect jump instructions that often have
> > no obvious correlation, it would be better to do this in the compiler.
> >
> > This series implements [on the objtool side] the suggestion made at GNU
> > Cauldron this year to annotate the indirect jump with a R_X86_64_NONE
> > relocation that refers to the jump table, and ensure that it is covered
> > by a STT_OBJECT symbol whose size accurately reflects the size of the
> > jump table.
> >
>
> For the adventurous, I have a branch [0] that implements the first
> part of this in Clang.
>
> Getting the jump table emitted as a STT_OBJECT with a proper size
> shouldn't be too hard either, but I'll look into that later.
>
>
> [0] https://github.com/ardbiesheuvel/llvm-project/tree/jump-table-annotations
That was fast! This is good stuff, thank you for working on this.
--
Josh