public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [Bug tools/28928] New: Wrong dynamic section entry number
@ 2022-02-28 13:15 dichen at redhat dot com
  2022-02-28 13:19 ` [Bug tools/28928] " dichen at redhat dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: dichen at redhat dot com @ 2022-02-28 13:15 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=28928

            Bug ID: 28928
           Summary: Wrong dynamic section entry number
           Product: elfutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tools
          Assignee: unassigned at sourceware dot org
          Reporter: dichen at redhat dot com
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

when using `$ eu-readelf -d {file}` to get the number of dynamic section
entris,
It wrongly counts the padding DT_NULLs as dynamic section entries.
However, DT_NULL Marks end of dynamic section. They should not be counted as
dynamic section entries.

```
$ eu-readelf -d /usr/local/bin/eu-readelf 

Dynamic segment contains 31 entries:
 Addr: 0x0000000000474e00  Offset: 0x073e00  Link to section: [ 7] '.dynstr'
  Type              Value
  NEEDED            Shared library: [libdw.so.1]
  NEEDED            Shared library: [libelf.so.1]
  NEEDED            Shared library: [libc.so.6]
  INIT              0x0000000000404000
  FINI              0x000000000043d4a8
  INIT_ARRAY        0x0000000000474df0
  INIT_ARRAYSZ      8 (bytes)
  FINI_ARRAY        0x0000000000474df8
  FINI_ARRAYSZ      8 (bytes)
  GNU_HASH          0x00000000004003a0
  STRTAB            0x00000000004016b0
  SYMTAB            0x00000000004003f0
  STRSZ             3086 (bytes)
  SYMENT            24 (bytes)
  DEBUG             
  PLTGOT            0x0000000000475000
  PLTRELSZ          4560 (bytes)
  PLTREL            RELA
  JMPREL            0x00000000004026a0
  RELA              0x0000000000402610
  RELASZ            144 (bytes)
  RELAENT           24 (bytes)
  VERNEED           0x0000000000402450
  VERNEEDNUM        3
  VERSYM            0x00000000004022be
  NULL              
  NULL              
  NULL              
  NULL              
  NULL              
  NULL              

```

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tools/28928] Wrong dynamic section entry number
  2022-02-28 13:15 [Bug tools/28928] New: Wrong dynamic section entry number dichen at redhat dot com
@ 2022-02-28 13:19 ` dichen at redhat dot com
  2022-03-30 11:42 ` dichen at redhat dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dichen at redhat dot com @ 2022-02-28 13:19 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=28928

Di Chen <dichen at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |dichen at redhat dot com
             Status|NEW                         |ASSIGNED

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tools/28928] Wrong dynamic section entry number
  2022-02-28 13:15 [Bug tools/28928] New: Wrong dynamic section entry number dichen at redhat dot com
  2022-02-28 13:19 ` [Bug tools/28928] " dichen at redhat dot com
@ 2022-03-30 11:42 ` dichen at redhat dot com
  2022-03-30 11:48 ` dichen at redhat dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dichen at redhat dot com @ 2022-03-30 11:42 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=28928

Di Chen <dichen at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dichen at redhat dot com

--- Comment #1 from Di Chen <dichen at redhat dot com> ---
Created attachment 14042
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14042&action=edit
[PATCH] readelf: Don't consider padding DT_NULL as dynamic section

when using `$ eu-readelf -d {FILE}` to get the number of dynamic
section entris, it wrongly counts the padding DT_NULLs as dynamic
section entries. However, DT_NULL Marks end of dynamic section.
They should not be considered as dynamic section entries.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tools/28928] Wrong dynamic section entry number
  2022-02-28 13:15 [Bug tools/28928] New: Wrong dynamic section entry number dichen at redhat dot com
  2022-02-28 13:19 ` [Bug tools/28928] " dichen at redhat dot com
  2022-03-30 11:42 ` dichen at redhat dot com
@ 2022-03-30 11:48 ` dichen at redhat dot com
  2022-04-15 15:22 ` mark at klomp dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dichen at redhat dot com @ 2022-03-30 11:48 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=28928

Di Chen <dichen at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |28873


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=28873
[Bug 28873] Implement eu-readelf -D
-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tools/28928] Wrong dynamic section entry number
  2022-02-28 13:15 [Bug tools/28928] New: Wrong dynamic section entry number dichen at redhat dot com
                   ` (2 preceding siblings ...)
  2022-03-30 11:48 ` dichen at redhat dot com
@ 2022-04-15 15:22 ` mark at klomp dot org
  2022-04-15 15:46 ` dichen at redhat dot com
  2022-04-19  8:18 ` mark at klomp dot org
  5 siblings, 0 replies; 7+ messages in thread
From: mark at klomp dot org @ 2022-04-15 15:22 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=28928

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #14042|0                           |1
        is obsolete|                            |
                 CC|                            |mark at klomp dot org

--- Comment #2 from Mark Wielaard <mark at klomp dot org> ---
Created attachment 14064
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14064&action=edit
readelf: Don't consider padding DT_NULL as dynamic section

Good find. And binutils readelf does get this right.

I see you made this block PR28873. And you are right that we should first get
this correct before doing the the -D dance going through the dynamic segment
showing information.

But for -d we don't have to go through the phdrs and the dynamic segment, we
can just use the section data directly.

I made that adjustment and added some ChangeLog entries.
See attached and at:
https://code.wildebeest.org/git/user/mjw/elfutils/commit/?h=pr14042

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tools/28928] Wrong dynamic section entry number
  2022-02-28 13:15 [Bug tools/28928] New: Wrong dynamic section entry number dichen at redhat dot com
                   ` (3 preceding siblings ...)
  2022-04-15 15:22 ` mark at klomp dot org
@ 2022-04-15 15:46 ` dichen at redhat dot com
  2022-04-19  8:18 ` mark at klomp dot org
  5 siblings, 0 replies; 7+ messages in thread
From: dichen at redhat dot com @ 2022-04-15 15:46 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=28928

--- Comment #3 from Di Chen <dichen at redhat dot com> ---
Thanks Mark, attachment 14064 looks good to me. You are right, we should let
patch for "-d --use-dynamic" (part of Bug 28873) take care of using
phdr(PT_DYNAMIC) to get the section data.
Because I was considering "-d --use-dynamic", so I mixed this fix with dynamic
phdr -> section data, I agree with using section data directly for this fix.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tools/28928] Wrong dynamic section entry number
  2022-02-28 13:15 [Bug tools/28928] New: Wrong dynamic section entry number dichen at redhat dot com
                   ` (4 preceding siblings ...)
  2022-04-15 15:46 ` dichen at redhat dot com
@ 2022-04-19  8:18 ` mark at klomp dot org
  5 siblings, 0 replies; 7+ messages in thread
From: mark at klomp dot org @ 2022-04-19  8:18 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=28928

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from Mark Wielaard <mark at klomp dot org> ---
Thanks. Pushed as:

commit 5b497d8da4920bf7b63a4aa3752cf580b3ad654c (HEAD -> master)
Author: Di Chen <dichen@redhat.com>
Date:   Tue Mar 1 20:44:38 2022 +0800

    readelf: Don't consider padding DT_NULL as dynamic section entry

    when using `$ eu-readelf -d {FILE}` to get the number of dynamic
    section entris, it wrongly counts the padding DT_NULLs as dynamic
    section entries. However, DT_NULL Marks end of dynamic section.
    They should not be considered as dynamic section entries.

    https://sourceware.org/bugzilla/show_bug.cgi?id=28928

    Signed-off-by: Di Chen <dichen@redhat.com>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-04-19  8:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-28 13:15 [Bug tools/28928] New: Wrong dynamic section entry number dichen at redhat dot com
2022-02-28 13:19 ` [Bug tools/28928] " dichen at redhat dot com
2022-03-30 11:42 ` dichen at redhat dot com
2022-03-30 11:48 ` dichen at redhat dot com
2022-04-15 15:22 ` mark at klomp dot org
2022-04-15 15:46 ` dichen at redhat dot com
2022-04-19  8:18 ` mark at klomp dot org

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).