| 134ab5bd | 26-Oct-2021 |
Peter Zijlstra <peterz@infradead.org> |
objtool,x86: Replace alternatives with .retpoline_sites
Instead of writing complete alternatives, simply provide a list of all the retpoline thunk calls. Then the kernel is free to do with them as i
objtool,x86: Replace alternatives with .retpoline_sites
Instead of writing complete alternatives, simply provide a list of all the retpoline thunk calls. Then the kernel is free to do with them as it pleases. Simpler code all-round.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Borislav Petkov <bp@suse.de> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Tested-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/r/20211026120309.850007165@infradead.org
show more ...
|
| c509331b | 26-Oct-2021 |
Peter Zijlstra <peterz@infradead.org> |
objtool: Shrink struct instruction
Any one instruction can only ever call a single function, therefore insn->mcount_loc_node is superfluous and can use insn->call_node.
This shrinks struct instruct
objtool: Shrink struct instruction
Any one instruction can only ever call a single function, therefore insn->mcount_loc_node is superfluous and can use insn->call_node.
This shrinks struct instruction, which is by far the most numerous structure objtool creates.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Borislav Petkov <bp@suse.de> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Tested-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/r/20211026120309.785456706@infradead.org
show more ...
|
| 1739c66e | 26-Oct-2021 |
Peter Zijlstra <peterz@infradead.org> |
objtool: Classify symbols
In order to avoid calling str*cmp() on symbol names, over and over, do them all once upfront and store the result.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.
objtool: Classify symbols
In order to avoid calling str*cmp() on symbol names, over and over, do them all once upfront and store the result.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Borislav Petkov <bp@suse.de> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Tested-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/r/20211026120309.658539311@infradead.org
show more ...
|
| db2b0c5d | 24-Jun-2021 |
Peter Zijlstra <peterz@infradead.org> |
objtool: Support pv_opsindirect calls for noinstr
Normally objtool will now follow indirect calls; there is no need.
However, this becomes a problem with noinstr validation; if there's an indirect
objtool: Support pv_opsindirect calls for noinstr
Normally objtool will now follow indirect calls; there is no need.
However, this becomes a problem with noinstr validation; if there's an indirect call from noinstr code, we very much need to know it is to another noinstr function. Luckily there aren't many indirect calls in entry code with the obvious exception of paravirt. As such, noinstr validation didn't work with paravirt kernels.
In order to track pv_ops[] call targets, objtool reads the static pv_ops[] tables as well as direct assignments to the pv_ops[] array, provided the compiler makes them a single instruction like:
bf87: 48 c7 05 00 00 00 00 00 00 00 00 movq $0x0,0x0(%rip) bf92 <xen_init_spinlocks+0x5f> bf8a: R_X86_64_PC32 pv_ops+0x268
There are, as of yet, no warnings for when this goes wrong :/
Using the functions found with the above means, all pv_ops[] calls are now subject to noinstr validation.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20210624095149.118815755@infradead.org
show more ...
|
| f56dae88 | 24-Jun-2021 |
Peter Zijlstra <peterz@infradead.org> |
objtool: Handle __sanitize_cov*() tail calls
Turns out the compilers also generate tail calls to __sanitize_cov*(), make sure to also patch those out in noinstr code.
Fixes: 0f1441b44e82 ("objtool:
objtool: Handle __sanitize_cov*() tail calls
Turns out the compilers also generate tail calls to __sanitize_cov*(), make sure to also patch those out in noinstr code.
Fixes: 0f1441b44e82 ("objtool: Fix noinstr vs KCOV") Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Marco Elver <elver@google.com> Link: https://lore.kernel.org/r/20210624095147.818783799@infradead.org
show more ...
|
| e2d9494b | 06-May-2021 |
Peter Zijlstra <peterz@infradead.org> |
objtool: Provide stats for jump_labels
Add objtool --stats to count the jump_label sites it encounters.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <ming
objtool: Provide stats for jump_labels
Add objtool --stats to count the jump_label sites it encounters.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20210506194158.153101906@infradead.org
show more ...
|
| cbf82a3d | 06-May-2021 |
Peter Zijlstra <peterz@infradead.org> |
objtool: Decode jump_entry::key addend
Teach objtool about the the low bits in the struct static_key pointer.
That is, the low two bits of @key in:
struct jump_entry { s32 code; s32 target; l
objtool: Decode jump_entry::key addend
Teach objtool about the the low bits in the struct static_key pointer.
That is, the low two bits of @key in:
struct jump_entry { s32 code; s32 target; long key; }
as found in the __jump_table section. Since @key has a relocation to the variable (to be resolved by the linker), the low two bits will be reflected in the relocation's addend.
As such, find the reloc and store the addend, such that we can access these bits.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20210506194158.028024143@infradead.org
show more ...
|
| 7bd2a600 | 26-Mar-2021 |
Peter Zijlstra <peterz@infradead.org> |
objtool: Cache instruction relocs
Track the reloc of instructions in the new instruction->reloc field to avoid having to look them up again later.
( Technically x86 instructions can have two reloca
objtool: Cache instruction relocs
Track the reloc of instructions in the new instruction->reloc field to avoid having to look them up again later.
( Technically x86 instructions can have two relocations, but not jumps and calls, for which we're using this. )
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Borislav Petkov <bp@suse.de> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Link: https://lkml.kernel.org/r/20210326151300.195441549@infradead.org
show more ...
|
| 43d5430a | 26-Mar-2021 |
Peter Zijlstra <peterz@infradead.org> |
objtool: Keep track of retpoline call sites
Provide infrastructure for architectures to rewrite/augment compiler generated retpoline calls. Similar to what we do for static_call()s, keep track of th
objtool: Keep track of retpoline call sites
Provide infrastructure for architectures to rewrite/augment compiler generated retpoline calls. Similar to what we do for static_call()s, keep track of the instructions that are retpoline calls.
Use the same list_head, since a retpoline call cannot also be a static_call.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Borislav Petkov <bp@suse.de> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Link: https://lkml.kernel.org/r/20210326151300.130805730@infradead.org
show more ...
|
| 2f2f7e47 | 26-Mar-2021 |
Peter Zijlstra <peterz@infradead.org> |
objtool: Add elf_create_undef_symbol()
Allow objtool to create undefined symbols; this allows creating relocations to symbols not currently in the symbol table.
Signed-off-by: Peter Zijlstra (Intel
objtool: Add elf_create_undef_symbol()
Allow objtool to create undefined symbols; this allows creating relocations to symbols not currently in the symbol table.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Borislav Petkov <bp@suse.de> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Link: https://lkml.kernel.org/r/20210326151300.064743095@infradead.org
show more ...
|
| d0c5c4cc | 26-Mar-2021 |
Peter Zijlstra <peterz@infradead.org> |
objtool: Create reloc sections implicitly
Have elf_add_reloc() create the relocation section implicitly.
Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com> Signed-off-by: Peter Zijlstra (Intel) <pe
objtool: Create reloc sections implicitly
Have elf_add_reloc() create the relocation section implicitly.
Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Borislav Petkov <bp@suse.de> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Link: https://lkml.kernel.org/r/20210326151259.880174448@infradead.org
show more ...
|
| ef47cc01 | 26-Mar-2021 |
Peter Zijlstra <peterz@infradead.org> |
objtool: Add elf_create_reloc() helper
We have 4 instances of adding a relocation. Create a common helper to avoid growing even more.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Si
objtool: Add elf_create_reloc() helper
We have 4 instances of adding a relocation. Create a common helper to avoid growing even more.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Borislav Petkov <bp@suse.de> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Link: https://lkml.kernel.org/r/20210326151259.817438847@infradead.org
show more ...
|
| 3a647607 | 26-Mar-2021 |
Peter Zijlstra <peterz@infradead.org> |
objtool: Rework the elf_rebuild_reloc_section() logic
Instead of manually calling elf_rebuild_reloc_section() on sections we've called elf_add_reloc() on, have elf_write() DTRT.
This makes it easie
objtool: Rework the elf_rebuild_reloc_section() logic
Instead of manually calling elf_rebuild_reloc_section() on sections we've called elf_add_reloc() on, have elf_write() DTRT.
This makes it easier to add random relocations in places without carefully tracking when we're done and need to flush what section.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Borislav Petkov <bp@suse.de> Signed-off-by: Ingo Molnar <mingo@kernel.org> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Link: https://lkml.kernel.org/r/20210326151259.754213408@infradead.org
show more ...
|
| a2f605f9 | 26-Feb-2021 |
Peter Zijlstra <peterz@infradead.org> |
objtool: Collate parse_options() users
Ensure there's a single place that parses check_options, in preparation for extending where to get options from.
Signed-off-by: Peter Zijlstra (Intel) <peterz
objtool: Collate parse_options() users
Ensure there's a single place that parses check_options, in preparation for extending where to get options from.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Link: https://lkml.kernel.org/r/20210226110004.193108106@infradead.org
show more ...
|
| 8ad15c69 | 26-Feb-2021 |
Peter Zijlstra <peterz@infradead.org> |
objtool: Add --backup
Teach objtool to write backups files, such that it becomes easier to see what objtool did to the object file.
Backup files will be ${name}.orig.
Suggested-by: Borislav Petkov
objtool: Add --backup
Teach objtool to write backups files, such that it becomes easier to see what objtool did to the object file.
Backup files will be ${name}.orig.
Suggested-by: Borislav Petkov <bp@alien8.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Acked-by: Borislav Petkov <bp@suse.de> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Link: https://lkml.kernel.org/r/YD4obT3aoXPWl7Ax@hirez.programming.kicks-ass.net
show more ...
|