Commit e31694e0 authored by Josh Poimboeuf's avatar Josh Poimboeuf Committed by Ingo Molnar

objtool: Don't make .altinstructions writable

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: 9bc0bb50 ("objtool/x86: Rewrite retpoline thunk calls")
Reported-by: default avatarJoe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/6c284ae89717889ea136f9f0064d914cd8329d31.1624462939.git.jpoimboe@redhat.com
parent 49faa777
...@@ -684,7 +684,7 @@ static int elf_add_alternative(struct elf *elf, ...@@ -684,7 +684,7 @@ static int elf_add_alternative(struct elf *elf,
sec = find_section_by_name(elf, ".altinstructions"); sec = find_section_by_name(elf, ".altinstructions");
if (!sec) { if (!sec) {
sec = elf_create_section(elf, ".altinstructions", sec = elf_create_section(elf, ".altinstructions",
SHF_WRITE, size, 0); SHF_ALLOC, size, 0);
if (!sec) { if (!sec) {
WARN_ELF("elf_create_section"); WARN_ELF("elf_create_section");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment