]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
bpf: fix false overflow in eBPF ELF backend linker
authorDavid Faust <david.faust@oracle.com>
Fri, 7 Aug 2020 18:36:47 +0000 (20:36 +0200)
committerJose E. Marchesi <jose.marchesi@oracle.com>
Fri, 7 Aug 2020 18:36:47 +0000 (20:36 +0200)
commitd844f10ac2735da8e5643236d7007a81098cbc2b
tree540b048e134ea051c03c1876ee87340bb1081e0b
parentfe4c3d430b39d4a8760702c4ecc9e4c1803cb077
bpf: fix false overflow in eBPF ELF backend linker

When performing DISP{16,32} relocations, the eBPF ELF backend linker
needs to convert the relocation from an address into a signed number
of 64-bit words (minus one) to jump.

Because of this unsigned-to-signed conversion, special care needs to
be taken when dividing to ensure the sign bits remain correct.
Otherwise, a false relocation overflow error can be triggered.

bfd/ChangeLog

2020-08-07  David Faust  <david.faust@oracle.com>

* elf64-bpf.c (bpf_elf_relocate_section): Ensure signed division for
DISP16 and DISP32 relocations.

ld/ChangeLog

2020-08-07  David Faust  <david.faust@oracle.com>

* testsuite/ld-bpf/call-3.s: New file.
* testsuite/ld-bpf/call-3.d: Likewise.
bfd/ChangeLog
bfd/elf64-bpf.c
ld/ChangeLog