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

2024-10-11 Thread Josh Poimboeuf
On Fri, Oct 11, 2024 at 08:32:33AM +0200, Ard Biesheuvel wrote: > 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

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

2024-10-11 Thread Josh Poimboeuf
On Fri, Oct 11, 2024 at 08:29:48AM +0200, Ard Biesheuvel wrote: > 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 > > > @

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; > >

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] objtool: Deal with relative jump tables correctly

2024-10-09 Thread Josh Poimboeuf
On Wed, Oct 09, 2024 at 10:16:52PM -0700, Josh Poimboeuf wrote: > > And has there been any movement on compiler annotations? > > If this is worth while, it is something I could look into: Kees and I > > work very closely with both the GCC and the Clang folks, and have >

Re: [PATCH] objtool: Deal with relative jump tables correctly

2024-10-09 Thread Josh Poimboeuf
[ Adding Jan and Jose for the jump table annotation discussion below ] On Wed, Oct 09, 2024 at 05:18:36PM +0200, Ard Biesheuvel wrote: > On Tue, 8 Oct 2024 at 19:42, Josh Poimboeuf wrote: > > > > On Tue, Oct 08, 2024 at 12:47:48AM +0200, Ard Biesheuvel wrote: > > > -

Re: [PATCH v2] objtool: Report section name in elf_init_reloc_text_sym() warning

2024-05-06 Thread Josh Poimboeuf
On Mon, May 06, 2024 at 08:55:54AM -0700, Kees Cook wrote: > While tracking down issues with LKDTM's .rodata "function", I found > the warning from elf_init_reloc_text_sym() to be unhelpful because it > wasn't clear which calling path it was coming from. Report the sec->name > and rephrase the warn

Re: [PATCH] objtool: Provide origin hint for elf_init_reloc_text_sym() errors

2024-05-04 Thread Josh Poimboeuf
On Tue, Apr 30, 2024 at 04:51:07PM -0700, Kees Cook wrote: > @@ -891,8 +892,8 @@ struct reloc *elf_init_reloc_text_sym(struct elf *elf, > struct section *sec, > int addend = insn_off; > > if (!(insn_sec->sh.sh_flags & SHF_EXECINSTR)) { > - WARN("bad call to %s() for data

Re: [PATCH] usercopy: delete __noreturn from usercopy_abort

2024-03-06 Thread Josh Poimboeuf
On Wed, Mar 06, 2024 at 09:52:01AM +, Russell King (Oracle) wrote: > On Tue, Mar 05, 2024 at 09:58:46AM -0800, Josh Poimboeuf wrote: > > This is an off-by-one bug which is common in unwinders, due to the fact > > that the address on the stack points to the return address rath

Re: [PATCH] usercopy: delete __noreturn from usercopy_abort

2024-03-05 Thread Josh Poimboeuf
> >> For the usercopy_abort function, whether '__noreturn' is added > >> does not affect the internal behavior of the usercopy_abort function. > >> Therefore, it is recommended that '__noreturn' be deleted > >> so that backtrace can work properly. > > > > This isn't acceptable. Removing __noreturn