kpatch-elf: copy ELF e_flags from patched .o

Kernel v6.2+ commit de3d098dd1fc ("powerpc/64: Add module check for ELF
ABI version") now verifies the ELF header e_flags for its ABI value and
refuse to load modules with complaint, "Invalid module architecture in
ELF header: 21"

Like other ELF header details, copy the flags from the reference ELF
input file to the new ELF file to avoid module load errors.

Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
This commit is contained in:
Joe Lawrence 2023-01-16 09:33:55 -05:00 committed by Josh Poimboeuf
parent 7d22fefa35
commit 2ddeccccb2
1 changed files with 1 additions and 0 deletions

View File

@ -948,6 +948,7 @@ void kpatch_write_output_elf(struct kpatch_elf *kelf, Elf *elf, char *outfile,
ehout.e_machine = eh.e_machine;
ehout.e_type = eh.e_type;
ehout.e_version = EV_CURRENT;
ehout.e_flags = eh.e_flags;
shstrtab = find_section_by_name(&kelf->sections, ".shstrtab");
if (!shstrtab)