Skip to content

Commit e31694e

Browse files
jpoimboeingomolnar
authored andcommitted
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: 9bc0bb5 ("objtool/x86: Rewrite retpoline thunk calls") Reported-by: Joe Lawrence <joe.lawrence@redhat.com> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/6c284ae89717889ea136f9f0064d914cd8329d31.1624462939.git.jpoimboe@redhat.com
1 parent 49faa77 commit e31694e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tools/objtool/arch/x86/decode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ static int elf_add_alternative(struct elf *elf,
684684
sec = find_section_by_name(elf, ".altinstructions");
685685
if (!sec) {
686686
sec = elf_create_section(elf, ".altinstructions",
687-
SHF_WRITE, size, 0);
687+
SHF_ALLOC, size, 0);
688688

689689
if (!sec) {
690690
WARN_ELF("elf_create_section");

0 commit comments

Comments
 (0)