Re: [PATCH v2 5/5] crypto: x86/crc32c - Tweak jump table to validate objtool logic

2024-10-10 Thread Ard Biesheuvel
On Thu, 10 Oct 2024 at 22:34, Josh Poimboeuf wrote: > > On Thu, Oct 10, 2024 at 02:28:07PM +0200, Ard Biesheuvel wrote: > > From: Ard Biesheuvel > > > > Tweak the jump table so > > - the address is taken far way from its use > > - its offset from the start of .rodata is != 0x0 > > - its type is S

Re: [PATCH v2 3/5] objtool: Add support for annotated jump tables

2024-10-10 Thread Ard Biesheuvel
On Thu, 10 Oct 2024 at 22:15, Josh Poimboeuf wrote: > > On Thu, Oct 10, 2024 at 02:28:05PM +0200, Ard Biesheuvel wrote: > > +++ b/tools/objtool/arch/x86/special.c > > @@ -115,30 +115,51 @@ struct reloc *arch_find_switch_table(struct > > objtool_file *file, > > struct reloc *text_reloc, *ro

Re: [RFC PATCH v1 0/1] seal system mappings

2024-10-10 Thread Jeff Xu
On Tue, Oct 8, 2024 at 5:42 PM Liam R. Howlett wrote: > > * Jeff Xu [241008 11:01]: > > Hi Liam, > > > > On Mon, Oct 7, 2024 at 7:19 PM Liam R. Howlett > > wrote: > > > > > > * jef...@chromium.org [241004 12:32]: > > > > From: Jeff Xu > > > > > > > > Seal vdso, vvar, sigpage, uprobes and vsys

Re: [PATCH] mseal.rst additional fix

2024-10-10 Thread Jeff Xu
On Tue, Oct 8, 2024 at 9:37 AM Randy Dunlap wrote: > > > > On 10/7/24 9:18 PM, jef...@chromium.org wrote: > > From: Jeff Xu > > > > Change "overwrite" to overwrites" > > > > Signed-off-by: Jeff Xu > > --- > > Documentation/userspace-api/mseal.rst | 2 +- > > 1 file changed, 1 insertion(+), 1 de

Re: [PATCH v2 0/5] Improve objtool jump table handling

2024-10-10 Thread Josh Poimboeuf
On Thu, Oct 10, 2024 at 07:50:17PM +0200, Ard Biesheuvel wrote: > On Thu, 10 Oct 2024 at 14:28, Ard Biesheuvel wrote: > > > > From: Ard Biesheuvel > > > > Jump table handling has faded into the background a little due to the > > fact that jump tables are [currently] disabled when enabling retpoli

Re: [PATCH v2 5/5] crypto: x86/crc32c - Tweak jump table to validate objtool logic

2024-10-10 Thread Josh Poimboeuf
On Thu, Oct 10, 2024 at 02:28:07PM +0200, Ard Biesheuvel wrote: > From: Ard Biesheuvel > > Tweak the jump table so > - the address is taken far way from its use > - its offset from the start of .rodata is != 0x0 > - its type is STT_OBJECT and its size is set to the size of the actual > table >

Re: [PATCH v2 3/5] objtool: Add support for annotated jump tables

2024-10-10 Thread Josh Poimboeuf
On Thu, Oct 10, 2024 at 02:28:05PM +0200, Ard Biesheuvel wrote: > +++ b/tools/objtool/arch/x86/special.c > @@ -115,30 +115,51 @@ struct reloc *arch_find_switch_table(struct > objtool_file *file, > struct reloc *text_reloc, *rodata_reloc; > struct section *table_sec; > unsigned l

Re: [PATCH v2 3/5] objtool: Add support for annotated jump tables

2024-10-10 Thread Josh Poimboeuf
On Thu, Oct 10, 2024 at 02:28:05PM +0200, Ard Biesheuvel wrote: > @@ -1394,8 +1396,12 @@ static struct reloc *insn_reloc(struct objtool_file > *file, struct instruction *i > if (!file) > return NULL; > > - reloc = find_reloc_by_dest_range(file->elf, insn->sec, > -

Re: [PATCH v2 2/5] objtool: Allow arch code to discover jump table size

2024-10-10 Thread Josh Poimboeuf
On Thu, Oct 10, 2024 at 02:28:04PM +0200, Ard Biesheuvel wrote: > @@ -,7 +2234,6 @@ static void mark_func_jump_tables(struct objtool_file > *file, > struct symbol *func) > { > struct instruction *insn, *last = NULL; > - struct reloc *reloc; > >

subscribe

2024-10-10 Thread Atul Raut

Re: [PATCH v2 0/5] Improve objtool jump table handling

2024-10-10 Thread Ard Biesheuvel
On Thu, 10 Oct 2024 at 14:28, Ard Biesheuvel wrote: > > From: Ard Biesheuvel > > 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

Re: [PATCH v2 1/5] objtool: Deal with relative jump tables correctly

2024-10-10 Thread Josh Poimboeuf
On Thu, Oct 10, 2024 at 04:07:45PM +0200, Peter Zijlstra wrote: > On Thu, Oct 10, 2024 at 03:59:43PM +0200, Ard Biesheuvel wrote: > > On Thu, 10 Oct 2024 at 15:26, Peter Zijlstra wrote: > > > > > > On Thu, Oct 10, 2024 at 02:28:03PM +0200, Ard Biesheuvel wrote: > > > > diff --git a/tools/objtool/c

Re: [PATCH v2 1/5] objtool: Deal with relative jump tables correctly

2024-10-10 Thread Peter Zijlstra
On Thu, Oct 10, 2024 at 03:59:43PM +0200, Ard Biesheuvel wrote: > On Thu, 10 Oct 2024 at 15:26, Peter Zijlstra wrote: > > > > On Thu, Oct 10, 2024 at 02:28:03PM +0200, Ard Biesheuvel wrote: > > > diff --git a/tools/objtool/check.c b/tools/objtool/check.c > > > index 3cb3e9b5ad0b..7f7981a93535 1006

Re: [PATCH v2 1/5] objtool: Deal with relative jump tables correctly

2024-10-10 Thread Ard Biesheuvel
On Thu, 10 Oct 2024 at 15:26, Peter Zijlstra wrote: > > On Thu, Oct 10, 2024 at 02:28:03PM +0200, Ard Biesheuvel wrote: > > diff --git a/tools/objtool/check.c b/tools/objtool/check.c > > index 3cb3e9b5ad0b..7f7981a93535 100644 > > --- a/tools/objtool/check.c > > +++ b/tools/objtool/check.c > > @@

Re: [PATCH v2 1/5] objtool: Deal with relative jump tables correctly

2024-10-10 Thread Peter Zijlstra
On Thu, Oct 10, 2024 at 02:28:03PM +0200, Ard Biesheuvel wrote: > diff --git a/tools/objtool/check.c b/tools/objtool/check.c > index 3cb3e9b5ad0b..7f7981a93535 100644 > --- a/tools/objtool/check.c > +++ b/tools/objtool/check.c > @@ -2101,6 +2101,8 @@ static int add_jump_table(struct objtool_file *f

[PATCH v2 5/5] crypto: x86/crc32c - Tweak jump table to validate objtool logic

2024-10-10 Thread Ard Biesheuvel
From: Ard Biesheuvel Tweak the jump table so - the address is taken far way from its use - its offset from the start of .rodata is != 0x0 - its type is STT_OBJECT and its size is set to the size of the actual table - the indirect jump is annotated with a R_X86_64_NONE relocation pointing to t

[PATCH v2 4/5] crypto: x86/crc32c - Use idiomatic relative jump table

2024-10-10 Thread Ard Biesheuvel
From: Ard Biesheuvel The original crc32c code used a place-relative jump table but with a slightly awkward use of two separate symbols. To help objtool, this was replaced with a bog-standard position dependent jump table call, which was subsequently tweaked to use a RIP-relative reference to the

[PATCH v2 3/5] objtool: Add support for annotated jump tables

2024-10-10 Thread Ard Biesheuvel
From: Ard Biesheuvel Add logic to follow R_X86_64_NONE relocations attached to indirect jumps, which are emitted to annotate jump tables, which are otherwise difficult to spot reliably. If an ELF symbol is associated with the jump table, its size is taken as the size of the jump table, and subse

[PATCH v2 2/5] objtool: Allow arch code to discover jump table size

2024-10-10 Thread Ard Biesheuvel
From: Ard Biesheuvel In preparation for adding support for annotated jump tables, where ELF relocations and symbols are used to describe the locations of jump tables in the executable, refactor the jump table discovery logic so the table size can be returned from arch_find_switch_table(). Signed

[PATCH v2 1/5] objtool: Deal with relative jump tables correctly

2024-10-10 Thread Ard Biesheuvel
From: Ard Biesheuvel Relative jump tables contain entries that carry the offset between the target of the jump and the start of the jump table. This permits the use of the PIC idiom of leaqjump_table(%rip), %tbl movslq (%tbl,%idx,4), %offset addq%offset, %tbl jmp *%t

[PATCH v2 0/5] Improve objtool jump table handling

2024-10-10 Thread Ard Biesheuvel
From: Ard Biesheuvel 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 di