[Bug tools/28928] Wrong dynamic section entry number

2022-04-19 Thread mark at klomp dot org via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28928

Mark Wielaard  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #4 from Mark Wielaard  ---
Thanks. Pushed as:

commit 5b497d8da4920bf7b63a4aa3752cf580b3ad654c (HEAD -> master)
Author: Di Chen 
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 

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

[Bug tools/28873] Implement eu-readelf -D

2022-04-19 Thread mark at klomp dot org via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28873
Bug 28873 depends on bug 28928, which changed state.

Bug 28928 Summary: Wrong dynamic section entry number
https://sourceware.org/bugzilla/show_bug.cgi?id=28928

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

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

[Bug general/29048] Symbols DW_SECT_INFO, DW_SECT_ABBREV, DW_SECT_STR_OFFSETS aren't defined

2022-04-19 Thread mark at klomp dot org via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=29048

--- Comment #5 from Mark Wielaard  ---
(In reply to yuri from comment #4)
> Any chance to make a release with this patch?

A new release is planned for next Monday, 25 April:
https://sourceware.org/pipermail/elfutils-devel/2022q2/004905.html

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

☠ Buildbot (GNU Toolchain): elfutils - failed test (failure) (master)

2022-04-19 Thread builder--- via Elfutils-devel
A new failure has been detected on builder elfutils-debian-armhf while building 
elfutils.

Full details are available at:
https://builder.sourceware.org/buildbot/#builders/6/builds/3

Build state: failed test (failure)
Revision: 5b497d8da4920bf7b63a4aa3752cf580b3ad654c
Worker: debian-armhf
Build Reason: (unknown)
Blamelist: Di Chen 

Steps:

- 0: worker_preparation ( success )

- 1: set package name ( success )

- 2: git checkout ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/6/builds/3/steps/2/logs/stdio

- 3: autoreconf ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/6/builds/3/steps/3/logs/stdio

- 4: configure ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/6/builds/3/steps/4/logs/stdio

- 5: get version ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/6/builds/3/steps/5/logs/stdio
- property changes: 
https://builder.sourceware.org/buildbot/#builders/6/builds/3/steps/5/logs/property_changes

- 6: make ( warnings )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/6/builds/3/steps/6/logs/stdio
- warnings (3): 
https://builder.sourceware.org/buildbot/#builders/6/builds/3/steps/6/logs/warnings__3_

- 7: make check ( failure )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/6/builds/3/steps/7/logs/stdio
- test-suite.log: 
https://builder.sourceware.org/buildbot/#builders/6/builds/3/steps/7/logs/test-suite_log

A new failure has been detected on builder elfutils-debian-i386 while building 
elfutils.

Full details are available at:
https://builder.sourceware.org/buildbot/#builders/17/builds/2

Build state: failed test (failure)
Revision: 5b497d8da4920bf7b63a4aa3752cf580b3ad654c
Worker: debian-i386
Build Reason: (unknown)
Blamelist: Di Chen 

Steps:

- 0: worker_preparation ( success )

- 1: set package name ( success )

- 2: git checkout ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/17/builds/2/steps/2/logs/stdio

- 3: autoreconf ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/17/builds/2/steps/3/logs/stdio

- 4: configure ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/17/builds/2/steps/4/logs/stdio

- 5: get version ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/17/builds/2/steps/5/logs/stdio
- property changes: 
https://builder.sourceware.org/buildbot/#builders/17/builds/2/steps/5/logs/property_changes

- 6: make ( warnings )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/17/builds/2/steps/6/logs/stdio
- warnings (3): 
https://builder.sourceware.org/buildbot/#builders/17/builds/2/steps/6/logs/warnings__3_

- 7: make check ( failure )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/17/builds/2/steps/7/logs/stdio
- test-suite.log: 
https://builder.sourceware.org/buildbot/#builders/17/builds/2/steps/7/logs/test-suite_log



Re: ☠ Buildbot (GNU Toolchain): elfutils - failed test (failure) (master)

2022-04-19 Thread Mark Wielaard
Hi,

On Tue, Apr 19, 2022 at 09:05:22AM +, builder--- via Elfutils-devel wrote:
> A new failure has been detected on builder elfutils-debian-armhf while 
> building elfutils.
> 
> Full details are available at:
> https://builder.sourceware.org/buildbot/#builders/6/builds/3
> 
> Build state: failed test (failure)
> Revision: 5b497d8da4920bf7b63a4aa3752cf580b3ad654c
> Worker: debian-armhf
> Build Reason: (unknown)
> Blamelist: Di Chen 
> [...]
> - 7: make check ( failure )
> Logs:
> - stdio: 
> https://builder.sourceware.org/buildbot/#builders/6/builds/3/steps/7/logs/stdio
> - test-suite.log: 
> https://builder.sourceware.org/buildbot/#builders/6/builds/3/steps/7/logs/test-suite_log
> [...]
> A new failure has been detected on builder elfutils-debian-i386 while 
> building elfutils.
> 
> Full details are available at:
> https://builder.sourceware.org/buildbot/#builders/17/builds/2
> 
> Build state: failed test (failure)
> Revision: 5b497d8da4920bf7b63a4aa3752cf580b3ad654c
> Worker: debian-i386
> Build Reason: (unknown)
> Blamelist: Di Chen 
> [...]
> - 7: make check ( failure )
> Logs:
> - stdio: 
> https://builder.sourceware.org/buildbot/#builders/17/builds/2/steps/7/logs/stdio
> - test-suite.log: 
> https://builder.sourceware.org/buildbot/#builders/17/builds/2/steps/7/logs/test-suite_log

These are interesting failures:

==28027==ERROR: AddressSanitizer: stack-use-after-scope on address 0xbef24d60 
at pc 0x004d9a6f bp 0xbef24c38 sp 0xbef24c3c
READ of size 8 at 0xbef24d60 thread T0
#0 0x4d9a6d in get_dyn_ents 
/var/lib/buildbot/workers/wildebeest/elfutils-debian-armhf/build/src/readelf.c:1787
#1 0x4d9a6d in handle_dynamic 
/var/lib/buildbot/workers/wildebeest/elfutils-debian-armhf/build/src/readelf.c:1810
#2 0x4fcc75 in print_dynamic 
/var/lib/buildbot/workers/wildebeest/elfutils-debian-armhf/build/src/readelf.c:1946
#3 0x4fcc75 in process_elf_file 
/var/lib/buildbot/workers/wildebeest/elfutils-debian-armhf/build/src/readelf.c:1008
#4 0x5001c1 in process_dwflmod 
/var/lib/buildbot/workers/wildebeest/elfutils-debian-armhf/build/src/readelf.c:792
#5 0xb67fd7ad in dwfl_getmodules 
/var/lib/buildbot/workers/wildebeest/elfutils-debian-armhf/build/libdwfl/dwfl_getmodules.c:86
#6 0x4e352f in process_file 
/var/lib/buildbot/workers/wildebeest/elfutils-debian-armhf/build/src/readelf.c:900
#7 0x4d3c2b in main 
/var/lib/buildbot/workers/wildebeest/elfutils-debian-armhf/build/src/readelf.c:372
#8 0xb5fde523 in __libc_start_main 
/build/glibc-RK4xiD/glibc-2.28/csu/libc-start.c:308
Address 0xbef24d60 is located in stack of thread T0 at offset 160 in frame
#0 0x4d8f83 in handle_dynamic 
/var/lib/buildbot/workers/wildebeest/elfutils-debian-armhf/build/src/readelf.c:1795
  This frame has 5 object(s):
[32, 36) 'shstrndx'
[96, 112) 'dynmem'
[160, 176) 'dyn_mem' <== Memory access at offset 160 is inside this variable
[224, 288) 'glink_mem'
[320, 384) 'buf'
HINT: this may be a false positive if your program uses some custom stack 
unwind mechanism or swapcontext
  (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-use-after-scope 
/var/lib/buildbot/workers/wildebeest/elfutils-debian-armhf/build/src/readelf.c:1787
 in get_dyn_ents

I think they are not real bugs, or the valgrind builders would have
picked them up. But the are theoretically issues since a compiler
could optimize its stack usage to make this an issue.

static size_t 
get_dyn_ents (Elf_Data * dyn_data)
{
  GElf_Dyn *dyn;
  GElf_Dyn dyn_mem;
  size_t dyn_idx = 0;
  do
{
  GElf_Dyn dyn_mem;
  dyn = gelf_getdyn(dyn_data, dyn_idx, &dyn_mem);
  if (dyn != NULL)
++dyn_idx;
}
  while (dyn != NULL && dyn->d_tag != DT_NULL);

  return dyn_idx;
}

The issue is dyn pointing to dyn_mem, but dyn_mem being defined inside
the do while loop, while dyn is accessed "outside" it (or more
correctly, in the condition of the do while loop). Technically it
means at that point dyn_mem could have been purged from the
stack. Although unlikely moving the dyn_mem definition outside the
loop should fix it.

I'll push the attached fix.

Cheers,

Mark
>From 21fa92319657ca479ae108967fd41ac523a2f876 Mon Sep 17 00:00:00 2001
From: Mark Wielaard 
Date: Tue, 19 Apr 2022 11:25:42 +0200
Subject: [PATCH] readelf: Define dyn_mem outside the while loop.

The GCC address sanitizer might complain otherwise:
stack-use-after-scope src/readelf.c:1787 in get_dyn_ents

Signed-off-by: Mark Wielaard 
---
 src/ChangeLog | 4 
 src/readelf.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index f563e993..6ef81862 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2022-04-19  Mark Wielaard  
+
+	* readelf.c (get_dyn_ents): Define dyn_mem outside the while loop.
+
 2022-03-01  Di Chen  
 
 	* readelf.c (get_dyn_ents): New function.
diff --git a/src/readelf.c b/src/readelf.c
index 4b2

[Bug tools/29073] New: program header entry 2: unknown program header entry type 0x70000003

2022-04-19 Thread schwab--- via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=29073

Bug ID: 29073
   Summary: program header entry 2: unknown program header entry
type 0x7003
   Product: elfutils
   Version: unspecified
Status: NEW
  Severity: normal
  Priority: P2
 Component: tools
  Assignee: unassigned at sourceware dot org
  Reporter: sch...@linux-m68k.org
CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

FAIL: run-strip-strmerge.sh
===

elflint /home/abuild/rpmbuild/BUILD/elfutils-0.186/tests/elfstrmerge
program header entry 2: unknown program header entry type 0x7003
program header entry 2: file size greater than memory size
section [25] '.riscv.attributes' has unsupported type 1879048195
FAIL run-strip-strmerge.sh (exit status: 1)

FAIL: run-elflint-self.sh
=

program header entry 2: unknown program header entry type 0x7003
program header entry 2: file size greater than memory size
section [26] '.riscv.attributes' has unsupported type 1879048195
*** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.186/src/elflint --quiet
--gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.186/src/addr2line
program header entry 2: unknown program header entry type 0x7003
program header entry 2: file size greater than memory size
section [26] '.riscv.attributes' has unsupported type 1879048195
*** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.186/src/elflint --quiet
--gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.186/src/elfclassify
program header entry 2: unknown program header entry type 0x7003
program header entry 2: file size greater than memory size
section [26] '.riscv.attributes' has unsupported type 1879048195
*** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.186/src/elflint --quiet
--gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.186/src/stack
program header entry 2: unknown program header entry type 0x7003
program header entry 2: file size greater than memory size
section [26] '.riscv.attributes' has unsupported type 1879048195
*** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.186/src/elflint --quiet
--gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.186/src/unstrip
program header entry 0: unknown program header entry type 0x7003
program header entry 0: file size greater than memory size
section [25] '.riscv.attributes' has unsupported type 1879048195
*** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.186/src/elflint --quiet
--gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.186/libelf/libelf.so
program header entry 0: unknown program header entry type 0x7003
program header entry 0: file size greater than memory size
section [25] '.riscv.attributes' has unsupported type 1879048195
*** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.186/src/elflint --quiet
--gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.186/libasm/libasm.so
section [71] '.riscv.attributes' has unsupported type 1879048195
*** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.186/src/elflint --quiet
--gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.186/src/size.o
section [78] '.riscv.attributes' has unsupported type 1879048195
*** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.186/src/elflint --quiet
--gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.186/src/strip.o
FAIL run-elflint-self.sh (exit status: 1)

FAIL: run-reverse-sections-self.sh
==


copy_elf: /home/abuild/rpmbuild/BUILD/elfutils-0.186/src/addr2line ->
addr2line.rev (read,reverse)
setshstrndx: 37
Swapping offsets of section 25 and 26
Swapping offsets of section 28 and 29
Swapping offsets of section 30 and 31
Swapping offsets of section 32 and 33
Swapping offsets of section 36 and 37
program header entry 2: unknown program header entry type 0x7003
program header entry 2: file size greater than memory size
section [26] '.riscv.attributes' has unsupported type 1879048195
FAIL run-reverse-sections-self.sh (exit status: 1)

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

☺ Buildbot (GNU Toolchain): elfutils - build successful (master)

2022-04-19 Thread builder--- via Elfutils-devel
A restored build has been detected on builder elfutils-debian-armhf while 
building elfutils.

Full details are available at:
https://builder.sourceware.org/buildbot/#builders/6/builds/4

Build state: build successful
Revision: 21fa92319657ca479ae108967fd41ac523a2f876
Worker: debian-armhf
Build Reason: (unknown)
Blamelist: Di Chen , Mark Wielaard 

Steps:

- 0: worker_preparation ( success )

- 1: set package name ( success )

- 2: git checkout ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/6/builds/4/steps/2/logs/stdio

- 3: autoreconf ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/6/builds/4/steps/3/logs/stdio

- 4: configure ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/6/builds/4/steps/4/logs/stdio

- 5: get version ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/6/builds/4/steps/5/logs/stdio
- property changes: 
https://builder.sourceware.org/buildbot/#builders/6/builds/4/steps/5/logs/property_changes

- 6: make ( warnings )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/6/builds/4/steps/6/logs/stdio
- warnings (3): 
https://builder.sourceware.org/buildbot/#builders/6/builds/4/steps/6/logs/warnings__3_

- 7: make check ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/6/builds/4/steps/7/logs/stdio
- test-suite.log: 
https://builder.sourceware.org/buildbot/#builders/6/builds/4/steps/7/logs/test-suite_log

A restored build has been detected on builder elfutils-debian-i386 while 
building elfutils.

Full details are available at:
https://builder.sourceware.org/buildbot/#builders/17/builds/3

Build state: build successful
Revision: 21fa92319657ca479ae108967fd41ac523a2f876
Worker: debian-i386
Build Reason: (unknown)
Blamelist: Di Chen , Mark Wielaard 

Steps:

- 0: worker_preparation ( success )

- 1: set package name ( success )

- 2: git checkout ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/17/builds/3/steps/2/logs/stdio

- 3: autoreconf ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/17/builds/3/steps/3/logs/stdio

- 4: configure ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/17/builds/3/steps/4/logs/stdio

- 5: get version ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/17/builds/3/steps/5/logs/stdio
- property changes: 
https://builder.sourceware.org/buildbot/#builders/17/builds/3/steps/5/logs/property_changes

- 6: make ( warnings )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/17/builds/3/steps/6/logs/stdio
- warnings (3): 
https://builder.sourceware.org/buildbot/#builders/17/builds/3/steps/6/logs/warnings__3_

- 7: make check ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/17/builds/3/steps/7/logs/stdio
- test-suite.log: 
https://builder.sourceware.org/buildbot/#builders/17/builds/3/steps/7/logs/test-suite_log



☺ Buildbot (GNU Toolchain): elfutils - build successful (master)

2022-04-19 Thread builder--- via Elfutils-devel
A restored build has been detected on builder elfutils-debian-ppc64 while 
building elfutils.

Full details are available at:
https://builder.sourceware.org/buildbot/#builders/63/builds/3

Build state: build successful
Revision: 21fa92319657ca479ae108967fd41ac523a2f876
Worker: debian-ppc64
Build Reason: (unknown)
Blamelist: Di Chen , Mark Wielaard 

Steps:

- 0: worker_preparation ( success )

- 1: set package name ( success )

- 2: git checkout ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/63/builds/3/steps/2/logs/stdio

- 3: autoreconf ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/63/builds/3/steps/3/logs/stdio

- 4: configure ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/63/builds/3/steps/4/logs/stdio

- 5: get version ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/63/builds/3/steps/5/logs/stdio
- property changes: 
https://builder.sourceware.org/buildbot/#builders/63/builds/3/steps/5/logs/property_changes

- 6: make ( warnings )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/63/builds/3/steps/6/logs/stdio
- warnings (3): 
https://builder.sourceware.org/buildbot/#builders/63/builds/3/steps/6/logs/warnings__3_

- 7: make check ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/63/builds/3/steps/7/logs/stdio
- test-suite.log: 
https://builder.sourceware.org/buildbot/#builders/63/builds/3/steps/7/logs/test-suite_log



[Bug general/29048] Symbols DW_SECT_INFO, DW_SECT_ABBREV, DW_SECT_STR_OFFSETS aren't defined

2022-04-19 Thread yuri at tsoft dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=29048

--- Comment #6 from yuri at tsoft dot com ---
(In reply to Mark Wielaard from comment #5)
> (In reply to yuri from comment #4)
> > Any chance to make a release with this patch?
> 
> A new release is planned for next Monday, 25 April:
> https://sourceware.org/pipermail/elfutils-devel/2022q2/004905.html

Thanks!

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