[PATCH] ld: add --package-metadata

Nick Clifton nickc@redhat.com
Tue May 24 16:28:38 GMT 2022


Hi Luca,

   I have just discovered another problem with the patch.  Compiling
   a toolchain with address sanitization enabled and then running the
   package-note.o test results in:

==2181020==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000007e at pc 0x147930f35e0b bp 0x7fff7bbf1820 sp 0x7fff7bbf0fd0
READ of size 16 at 0x60200000007e thread T0
     #0 0x147930f35e0a in __interceptor_memcpy (/lib64/libasan.so.8+0x49e0a)
     #1 0x8a17df in write_package_metadata /work/sources/binutils/current/ld/ldelf.c:1562
     #2 0x98e92d in _bfd_elf_write_object_contents /work/sources/binutils/current/bfd/elf.c:6790

0x60200000007e is located 0 bytes to the right of 14-byte region [0x602000000070,0x60200000007e)
allocated by thread T0 here:
     #0 0x147930fa668f in __interceptor_malloc (/lib64/libasan.so.8+0xba68f)
     #1 0x1642823 in xmalloc /work/sources/binutils/current/libiberty/xmalloc.c:149
     #2 0x1642a13 in xstrdup /work/sources/binutils/current/libiberty/xstrdup.c:34
     #3 0x85a988 in gldelf_x86_64_handle_option /work/builds/binutils/current/sanitize-address/ld/eelf_x86_64.c:5361

I think that you might be trying to write out too many bytes....

Cheers
   Nick



More information about the Binutils mailing list