Skip to content

symbol load_elf_binary at offset 3536 within section .text.load_elf_binary, expected 0 #700

Description

@joe-lawrence

patch.txt

I'm testing a patch (see attached) for CVE-2015-1593 against RHEL7.3 GA + kernel-3.10.0-200.el7.x86_64 (rebuilt by RHEL7.3 GA toolset) and was running into the following kpatch-build error:

Skipping cleanup
Fedora/Red Hat distribution detected
Downloading kernel source for 3.10.0-200.el7.x86_64
Unpacking kernel source
Testing patch file
checking file arch/x86/mm/mmap.c
checking file fs/binfmt_elf.c
Reading special section data
Building original kernel
Building patched kernel
Extracting new and modified ELF sections
mmap.o: changed function: stack_maxrandom_size
mmap.o: changed function: arch_pick_mmap_layout
binfmt_elf.o: changed function: load_elf_binary
compat_binfmt_elf.o: changed function: load_elf_binary
Patched objects: vmlinux
Building patch module: kpatch-klp.ko
/usr/local/libexec/kpatch/create-kpatch-module: ERROR: tmp_output.o: kpatch_create_symbol_list: 331: symbol load_elf_binary at offset 3536 within section .text.load_elf_binary, expected 0
ERROR: kpatch build failed. Check /root/.kpatch/build.log for more details.

It's interesting to note that kpatch-build reports that both binfmt_elf.o and compat_binfmt_elf.o modify a function called load_elf_binary. (Check out fs/compat_binfmt_elf.c for it #include's binfmt_elf.c!) I think kpatch-build is getting tripped up on these duplicate functions as:

TMP=~/.kpatch/tmp/patch/tmp_output.o
readelf --wide --symbols $TMP | grep load_elf_binary
Symbol table '.symtab' contains 52 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
   ...
    24: 0000000000000000  3523 FUNC    LOCAL  DEFAULT    5 load_elf_binary
    26: 0000000000000dd0  3656 FUNC    LOCAL  DEFAULT    5 load_elf_binary

Note that the first load_elf_binary symbol value is 0 and the second is 0xdd0 = 3536, the found and expected values in the kpatch-build complaint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions