public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: luca.boccassi@gmail.com, binutils@sourceware.org
Subject: Re: [PATCH] ld: add --package-metadata
Date: Tue, 24 May 2022 17:28:38 +0100	[thread overview]
Message-ID: <60f4baf9-bfc7-dbc3-3ed2-52153e33df07@redhat.com> (raw)
In-Reply-To: <20220515191846.114257-1-luca.boccassi@gmail.com>

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


  parent reply	other threads:[~2022-05-24 16:28 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-15 19:18 luca.boccassi
2022-05-16 16:40 ` Fangrui Song
2022-05-17  6:03   ` Florian Weimer
2022-05-17 14:44     ` Luca Boccassi
2022-05-25  6:56       ` Fangrui Song
2022-05-25  7:53         ` Florian Weimer
2022-05-23 11:26 ` Luca Boccassi
2022-05-24  9:34   ` Jose E. Marchesi
2022-05-24 11:26     ` Luca Boccassi
2022-05-24 16:23 ` Nick Clifton
2022-05-24 18:38   ` Luca Boccassi
2022-05-25  8:45     ` Florian Weimer
2022-05-25 13:53       ` Luca Boccassi
2022-05-30 14:08         ` Florian Weimer
2022-05-24 16:28 ` Nick Clifton [this message]
2022-05-24 21:15 ` [PATCH v2] " luca.boccassi
2022-05-25  4:30   ` Alan Modra
2022-05-25  6:02     ` Alan Modra
2022-05-25 13:42       ` Luca Boccassi
2022-05-25 13:41 ` [PATCH v3] " luca.boccassi
2022-05-26  3:55   ` Alan Modra
2022-05-26 10:46     ` Luca Boccassi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60f4baf9-bfc7-dbc3-3ed2-52153e33df07@redhat.com \
    --to=nickc@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=luca.boccassi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).