This is the mail archive of the
mailing list for the binutils project.
Re: [PATCH] PR binutils/18218: bad handling of .debug_str_offsets section
- From: Doug Evans <dje at google dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Fri, 10 Apr 2015 11:31:54 -0700
- Subject: Re: [PATCH] PR binutils/18218: bad handling of .debug_str_offsets section
- Authentication-results: sourceware.org; auth=none
- References: <20150409135922 dot GA31308 at gmail dot com> <CADPb22RHuML1i+L8mz2cJ8SV_h=Jsw=XGbdTq1B+4T0JF+ZqNg at mail dot gmail dot com> <CAMe9rOoG8r7JEk4f_cPeb=MqNOQk=5qGHhOsjZ4nXh1-2ZA4qA at mail dot gmail dot com> <CADPb22QZ7qOt-=AoTY7M9=gOSdnX3orUN+HcV_5HAgqwxxUC5Q at mail dot gmail dot com> <CAMe9rOpbod4KCUBtYbhDF+1CVpq=acS2GsjMTPA3q_Dk4vtKtw at mail dot gmail dot com> <21798 dot 54407 dot 761598 dot 212898 at ruffy2 dot mtv dot corp dot google dot com> <CAMe9rOq9yxkpZKFJ6NGTxSipatVEK4L-7kozvepBdFXiB5WCQA at mail dot gmail dot com>
On Thu, Apr 9, 2015 at 1:29 PM, H.J. Lu <email@example.com> wrote:
> On Thu, Apr 9, 2015 at 12:35 PM, Doug Evans <firstname.lastname@example.org> wrote:
>> H.J. Lu writes:
>> > On Thu, Apr 9, 2015 at 11:03 AM, Doug Evans <email@example.com> wrote:
>> > > On Thu, Apr 9, 2015 at 10:41 AM, H.J. Lu <firstname.lastname@example.org> wrote:
>> > >>> Even better, treat the "sec" argument to load_specific_debug_section
>> > >>> as "const Elf_Internal_Shdr * sec".
>> > >>> Modifying sec->sh_size to be the size of the now-uncompressed section
>> > >>> is fragile and what led to this bug. Leave this data be the
>> > >>> representation of what's actually on disk, and build on it, not modify
>> > >>> it.
>> > >>
>> > >> We need to update sh_size to get readelf to work right.
>> > >
>> > > I don't understand.
>> > > There are lots of ways to make readelf work right.
>> > > Some better than others.
>> > Patches are welcome.
>> I would have expected a more technical explanation of why
>> the proposed patch is ok.
>> How about this?
>> [I can imagine there's more work to do along these lines.
>> At least this headed in a good direction.
>> Ultimately, I can imagine adding a backlink from
>> dwarf_section to Elf_Internal_Shdr, though a more sound
>> proposal would need more research.]
>> 2015-04-09 Doug Evans <email@example.com>
>> PR binutils/18218
>> * readelf.c (printable_section_name): Constify sec argument.
>> (apply_relocations): Ditto. New arg "size". All callers updated.
>> (load_specific_debug_section): Constify sec argument.
>> Remove side-effect of modifying sec->sh_size.
> It looks good to me. Does it pass "make check"?
On amd64-linux, yes.