Skip to content

Commit

Permalink
objtool: Don't make .altinstructions writable
Browse files Browse the repository at this point in the history
When objtool creates the .altinstructions section, it sets the SHF_WRITE
flag to make the section writable -- unless the section had already been
previously created by the kernel.  The mismatch between kernel-created
and objtool-created section flags can cause failures with external
tooling (kpatch-build).  And the section doesn't need to be writable
anyway.

Make the section flags consistent with the kernel's.

Fixes: 9bc0bb5 ("objtool/x86: Rewrite retpoline thunk calls")
Reported-by: Joe Lawrence <[email protected]>
Signed-off-by: Josh Poimboeuf <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Link: https://lore.kernel.org/r/6c284ae89717889ea136f9f0064d914cd8329d31.1624462939.git.jpoimboe@redhat.com
  • Loading branch information
jpoimboe authored and Ingo Molnar committed Jun 24, 2021
1 parent 49faa77 commit e31694e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/objtool/arch/x86/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ static int elf_add_alternative(struct elf *elf,
sec = find_section_by_name(elf, ".altinstructions");
if (!sec) {
sec = elf_create_section(elf, ".altinstructions",
SHF_WRITE, size, 0);
SHF_ALLOC, size, 0);

if (!sec) {
WARN_ELF("elf_create_section");
Expand Down

0 comments on commit e31694e

Please sign in to comment.