elfutils 0.183 released

2021-02-08 Thread Mark Wielaard
ELFUTILS 0.183 - http://elfutils.org/

A new release of elfutils is available at:
ftp://sourceware.org/pub/elfutils/0.183/
or https://sourceware.org/elfutils/ftp/0.183/

* NEWS *

debuginfod: New thread-busy metric and more detailed error metrics.
New --fdcache-mintmp and tracking of filesystem freespace.
New increased webapi concurrency while grooming.

debuginfod-client: DEBUGINFOD_SONAME macro added to debuginfod.h which
   can be used to dlopen the libdebuginfod.so library.
   New function debuginfod_set_verbose_fd and
   DEBUGINFOD_VERBOSE environment variable.

config: profile.sh and profile.csh won't export DEBUGINFOD_URLS unless
configured --enable-debuginfod-urls[=URLS]

elflint, readelf: Recognize SHF_GNU_RETAIN.
  Handle SHT_X86_64_UNWIND as valid relocation target.

* GIT SHORTLOG *

Andreas Krebbel (1):
  IBM Z: Fix endianess problem in pid_memory_read

Dmitry V. Levin (38):
  config: Conditionalize on LIBDEBUGINFOD instead of DEBUGINFOD
  config: do not define DEBUGINFOD_URLS environment variable
unnecessarily
  Drop $(EXEEXT) suffix from shared libraries
  debuginfod: export DEBUGINFOD_SONAME macro in debuginfod.h
  debuginfod: create libdebuginfod.so.1 before libdebuginfod.so
  libdwfl: switch to DEBUGINFOD_SONAME, remove libdebuginfod.so
fallback
  Fix automake warnings
  Remove unused Makefile variable GCC_INCLUDE
  configure.ac: fix typo in error diagnostics
  configure.ac: simplify argp check
  Remove unused tests/configure.ac
  doc: fix spelling typos
  libdwelf: fix spelling typos in strings returned by
dwelf_elf_e_machine_string
  src: fix spelling typos in argp help text and error diagnostics
  debuginfod: fix spelling typos in error diagnostics and comments
  backends: fix spelling typos in comments
  config: fix spelling typos in comments and %changelog
  libasm: fix spelling typos in comments
  libcpu: fix spelling typos in comments
  libdw: fix spelling typos in comments and ChangeLog
  libdwelf: fix spelling typos in comments
  libdwfl: fix spelling typos in comments and ChangeLog
  libelf: fix spelling typos in comments
  src: fix spelling typos in comments and ChangeLog
  tests: fix spelling typos in error diagnostics and comments
  Fix spelling typos in NEWS, NOTES, TODO, and in comments of
configure.ac
  configure.ac: remove unneeded AC_CONFIG_MACRO_DIR([m4])
  m4: remove unneeded Makefile.am
  po: remove empty translation files
  libebl: consistently use _(Str) instead of gettext(Str)
  Consistently define _(Str) using dgettext ("elfutils", Str)
  lib: consistently use _(Str) instead of gettext(Str)
  libcpu: consistently use _(Str) instead of gettext(Str)
  src: consistently use _(Str) instead of gettext(Str)
  Modernize gettext infrastructure
  .gitignore: update
  Split the top level .gitignore file
  Add coverage target

Frank Ch. Eigler (7):
  debuginfod: add thread-busy metrics to webapi service
  debuginfod: sqlite3 metrics
  debuginfod: use clock_gettime(CLOCK_MONOTONIC) for intervals
  debuginfod: correct prometheus metric typo
  PR27323 debuginfod: improve query concurrency with grooming
  PR27092: debuginfod low-memory handling
  NEWS: add one more debuginfod brag

Mark Wielaard (17):
  tests: Create bogus R/nothing.rpm with cyclic symlink.
  libelf: Use GElf_Ehdr instead of Elf handle in __libelf_data_type
  libelf: Set dst to zero on failure in __elf_getphdrnum_rdlock
  libelf: Check header exists in elf_strptr
  libelf: Update SH_ENTSIZE_HASH comment.
  debuginfod-find: Be a bit less verbose with -v
  backends: Handle SHT_X86_64_UNWIND as valid relocation target
  debuginfod: Handle "/" and report unrecognized operations
  debuginfod-client: Add debuginfod_set_verbose_fd and
 DEBUGINFOD_VERBOSE
  debuginfod-client: Initialize struct handle_data errbuf to the
 empty string.
  libdwfl: Use 64bit GElf_Addr instead of size_t to calculate address.
  elflint: Always print symbol name (if known) in error messages.
  libelf: Make sure we have at least a full ELF header available.
  libelf: Sync elf.h from glibc.
  Handle SHF_GNU_RETAIN in eu-readelf and eu-elflint.
  elflint: Recognize SHF_GNU_RETAIN as extra section flag.
  Prepare for 0.183

Sergei Trofimovich (2):
  src/elflint.c: fix printing of unknown flags
  src/elflint.c: add debug print for GNU_RETAIN and others

Sergei Trofimovich via Elfutils-devel (1):
  tests: use ${CC} instead of 'gcc' in tests

Timm Bäder (32):
  segment_report_module: Get rid of variable-length arrays
  segment_report_module: Remove nested finish() function
  segment_report_module: Get rid of segment_read()
  segment_report_module: Remove nested release_buffer() function
  segment_report_module: Use a struct for build id information
  segment_report_module: Get rid of nested final_read() function
  segment_report_module: Use one loop for p32/p64 arrays
  segment_report_module: Inline r

[Bug general/27367] New: readelf: invalid loclists data with -ffat-lto-objects

2021-02-08 Thread mliska at suse dot cz via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=27367

Bug ID: 27367
   Summary: readelf: invalid loclists data with -ffat-lto-objects
   Product: elfutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: general
  Assignee: unassigned at sourceware dot org
  Reporter: mliska at suse dot cz
CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

Using the GCC 11 (master) I see the following issue:

$ cat size.i
int main_argc_remaining;

int main_argc() {
  int result = 0;
  if (main_argc_remaining)
result = 0;

  return 0;
}

$ gcc -c -flto -O size.i -g -ffat-lto-objects &&
/home/marxin/Programming/elfutils/src/readelf -aw size.o
...
DWARF section [27] '.debug_loclists' at offset 0x747:
Table at Offset 0x0:

 Length:   24
 DWARF version: 5
 Address size:  8
 Segment size:  0
 Offset entries:0
 Not associated with a CU.

  Offset: c, Index: 0
startx_endx 3, 8
  ???..
  ???
(empty)
end_of_list

  Offset: 18, Index: c
startx_endx 30, 1f
  ???..
  ???
/home/marxin/Programming/elfutils/src/readelf: invalid loclists data

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

[Bug general/27367] readelf: invalid loclists data with -ffat-lto-objects

2021-02-08 Thread mliska at suse dot cz via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=27367

--- Comment #1 from Martin Liska  ---
Happens for version 0.182.

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

[Bug general/27367] readelf: invalid loclists data with -ffat-lto-objects

2021-02-08 Thread mliska at suse dot cz via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=27367

Martin Liska  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #2 from Martin Liska  ---
And it's fixed on master.

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

[Bug general/27367] readelf: invalid loclists data with -ffat-lto-objects

2021-02-08 Thread mliska at suse dot cz via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=27367

Martin Liska  changed:

   What|Removed |Added

 Resolution|INVALID |---
 Status|RESOLVED|UNCONFIRMED

--- Comment #3 from Martin Liska  ---
(In reply to Martin Liska from comment #2)
> And it's fixed on master.

I take this back (I used a bad GCC compiler). So it's present even for elfutils
master.

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

[Bug general/27367] readelf: invalid loclists data with -ffat-lto-objects

2021-02-08 Thread mark at klomp dot org via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=27367

Mark Wielaard  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2021-02-08
 Status|UNCONFIRMED |NEW
 CC||mark at klomp dot org

--- Comment #4 from Mark Wielaard  ---
Same for git HEAD/0.183

Without -flto and -ffat-lto-objects this looks like:

DWARF section [ 7] '.debug_loclists' at offset 0xff:
Table at Offset 0x0:

 Length:   24
 DWARF version: 5
 Address size:  8
 Segment size:  0
 Offset entries:0
 CU [ c] base: .text+00 

  Offset: c, Index: 0
view pair 2, 3

  Offset: e, Index: 2
start_length 0x0, 0
  .text+00 ..
  0x
[ 0] lit0
[ 1] stack_value
end_of_list

Note that it starts with a view pair, and in the non-lto variant eu-readelf
does know which CU this is associated with, while in the lto variant it says
"Not associated with a CU."

The issue seems to be that eu-readelf seeing both .debug_info and
.gnu.debuglto_.debug_info (you get both when using -ffat-lto-objects) picks the
.gnu.debuglto_.debug_info and drops/skips the .debug_info.

The following "fixes" it:

diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c
index 757ac4fa..49ec0f22 100644
--- a/libdw/dwarf_begin_elf.c
+++ b/libdw/dwarf_begin_elf.c
@@ -137,10 +137,10 @@ check_section (Dwarf *result, size_t shstrndx, Elf_Scn
*scn, bool inscngrp)
  gnu_compressed = true;
  break;
}
-  else if (scnlen > 14 /* .gnu.debuglto_ prefix. */
-  && strncmp (scnname, ".gnu.debuglto_", 14) == 0
-  && strcmp (&scnname[14], dwarf_scnnames[cnt]) == 0)
-   break;
+//  else if (scnlen > 14 /* .gnu.debuglto_ prefix. */
+//&& strncmp (scnname, ".gnu.debuglto_", 14) == 0
+//&& strcmp (&scnname[14], dwarf_scnnames[cnt]) == 0)
+// break;
 }

   if (cnt >= ndwarf_scnnames)

But of course that breaks showing .gnu.debuglto_ sections...

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

[PATCH] tests/run-debuginfod-find.sh: skip test if cpio isn't available.

2021-02-08 Thread Érico Nogueira via Elfutils-devel
From: Érico Rolim 

Signed-off-by: Érico Rolim 
---
 tests/ChangeLog  | 4 
 tests/run-debuginfod-find.sh | 1 +
 2 files changed, 5 insertions(+)

diff --git a/tests/ChangeLog b/tests/ChangeLog
index 907b6351..e22fa455 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2021-02-08  Érico Nogueira  
+
+   * run-debuginfod-find.sh: Check for cpio availability.
+
 2021-02-04  Frank Ch. Eigler 
 
* run-debuginfod-find.sh: Smoke test --fdcache-mintmp option handling.
diff --git a/tests/run-debuginfod-find.sh b/tests/run-debuginfod-find.sh
index 6340f60e..876f1ab4 100755
--- a/tests/run-debuginfod-find.sh
+++ b/tests/run-debuginfod-find.sh
@@ -20,6 +20,7 @@
 
 type curl 2>/dev/null || (echo "need curl"; exit 77)
 type rpm2cpio 2>/dev/null || (echo "need rpm2cpio"; exit 77)
+type cpio 2>/dev/null || (echo "need cpio"; exit 77)
 type bzcat 2>/dev/null || (echo "need bzcat"; exit 77)
 bsdtar --version | grep -q zstd && zstd=true || zstd=false
 echo "zstd=$zstd bsdtar=`bsdtar --version`"
-- 
2.30.0



[PATCH - RFC] WIP: fix backtrace test to work on musl

2021-02-08 Thread Érico Nogueira via Elfutils-devel
From: Érico Rolim 

---

Currently, the run-backtrace-native.sh test fails on musl systems. As
seen here in the test suite log, this appears to happen because elfutils
expects raise() to be the last function in the stack trace, which it
isn't, because unlike glibc, which uses inline functions for setting and
resetting the signal mask, musl chose to use a normal function.

FAIL: run-backtrace-native.sh
=

0x55c581dbe000  0x55c581dc3000  /builddir/elfutils-0.183/tests/backtrace-child
0x7fb0cfbf8000  0x7fb0cfca5000  /usr/lib/libc.so
0x7fff865be000  0x7fff865bf000  [vdso: 3035]
TID 3035:
# 0 0x7fb0cfc4e3e7  __restore_sigs
# 1 0x7fb0cfc4e590 - 1  raise
# 2 0x55c581dbf240 - 1  main
# 3 0x7fb0cfc166fa - 1  libc_start_main_stage2
# 4 0x55c581dbf329 - 1  _start
TID 3057:
# 0 0x7fb0cfc4e3e7  __restore_sigs
/builddir/elfutils-0.183/tests/backtrace: dwfl_thread_getframes: no matching 
address range
Assertion failed: symname && strcmp (symname, "raise") == 0 (backtrace.c: 
callback_verify: 111)
./test-subr.sh: line 84:  3023 Aborted (core dumped) 
LD_LIBRARY_PATH="${built_library_path}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" 
$VALGRIND_CMD "$@"
# 2 0x55c581dbf240 - 1  main
backtrace-child: neither empty nor just out of DWARF
FAIL run-backtrace-native.sh (exit status: 1)

=

By applying the patch below, which includes some comments from what I
undertstood of the code, I was able to get the test to fail differently,
but I'm not sure I am actually closer to making the test just work.

FAIL: run-backtrace-native.sh
=

0x5572f0661000  0x5572f0666000  /builddir/elfutils-0.183/tests/backtrace-child
0x7ff1dac68000  0x7ff1dad15000  /usr/lib/libc.so
0x7fff70fc1000  0x7fff70fc2000  [vdso: 10694]
TID 10694:
# 0 0x7ff1dacbe3e7  __restore_sigs
# 1 0x7ff1dacbe590 - 1  raise
# 2 0x5572f0662240 - 1  main
# 3 0x7ff1dac866fa - 1  libc_start_main_stage2
# 4 0x5572f0662329 - 1  _start
TID 10697:
# 0 0x7ff1dacbe3e7  __restore_sigs
frameno: 0 symname: __restore_sigs
# 1 0x7ff1dacbe590 - 1  raise
frameno: 0 symname: raise
# 2 0x5572f066251b - 1  sigusr2
frameno: 1 symname: sigusr2
# 3 0x5572f06625bc - 1  stdarg
frameno: 4 symname: stdarg
# 4 0x5572f06625e2 - 1  backtracegen
frameno: 5 symname: backtracegen
# 5 0x5572f06625fb - 1  start
frameno: 6 symname: start
# 6 0x7ff1daccf7ee - 1  start
frameno: 7 symname: start
# 7 0x7ff1dacdc91b - 1  __clone
frameno: 8 symname: __clone
# 8 0x7ff1dacdc91b - 1  __clone
frameno: 9 symname: __clone
# 9 0x7ff1dacdc91b - 1  __clone
frameno: 10 symname: __clone
#10 0x7ff1dacdc91b - 1  __clone
frameno: 11 symname: __clone
#11 0x7ff1dacdc91b - 1  __clone
frameno: 12 symname: __clone
#12 0x7ff1dacdc91b - 1  __clone
frameno: 13 symname: __clone
#13 0x7ff1dacdc91b - 1  __clone
frameno: 14 symname: __clone
#14 0x7ff1dacdc91b - 1  __clone
frameno: 15 symname: __clone
#15 0x7ff1dacdc91b - 1  __clone
frameno: 16 symname: __clone
#16 0x7ff1dacdc91b - 1  __clone
frameno: 17 symname: __clone
/builddir/elfutils-0.183/tests/backtrace: dwfl_thread_getframes: no matching 
address range
/builddir/elfutils-0.183/tests/backtrace: Too many frames: 17

# 2 0x5572f0662240 - 1  main
backtrace-child: neither empty nor just out of DWARF
FAIL run-backtrace-native.sh (exit status: 1)

=

Is my currrent approach somewhat correct? Have I identified the issue
correctly, at least?

I think the trick of making reduce_frameno a global and setting it
before dwfl_thread_getframes isn't really necessary (the output doesn't
change), but it was one of the variables that seemed capable of
affecting the program output, so I tried messing some with it.

I think that this test failing shows this part of the library is working
correctly, but it would be nice to also get the testsuite working
perfectly.

I have also thought about looping through stack frames until symname is
"raise", since other libcs (and possibly even glibc?) could one day add
a function call inside raise(), which would break this test. What do you
think of that solution?

The patch doesn't include a signed off by line because it's not fit for
inclusion (or at least not yet).

 tests/backtrace.c | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/tests/backtrace.c b/tests/backtrace.c
index 36c8b8c4..6bea2859 100644
--- a/tests/backtrace.c
+++ b/tests/backtrace.c
@@ -51,6 +51,7 @@ main (int argc __attribute__ ((unused)), char **argv)
 }
 
 #else /* __linux__ */
+static bool reduce_frameno;
 
 static int
 dump_modules (Dwfl_Module *mod, void **userdata __attribute__ ((unused)),
@@ -94,18 +95,29 @@ callback_verify (pid_t tid, unsigned frameno, Dwarf_Addr pc,
   static bool duplicate_sigusr2 = false;
   if (duplicate_sigusr2)
 frameno--;
-  static bool reduce_frameno = false;
   if (reduce_frameno)
 frameno--;
   if (! use_raise_jmp_patching && frameno >= 2)
 frameno += 2;
   const char *symname2 = NULL;
+  /* it exp

Re: [PATCH] tests/run-debuginfod-find.sh: skip test if cpio isn't available.

2021-02-08 Thread Frank Ch. Eigler via Elfutils-devel
Hi -

> From: Érico Rolim 
> Signed-off-by: Érico Rolim 

Thanks, merged as obvious.

- FChE



Buildbot failure in Wildebeest Builder on whole buildset

2021-02-08 Thread buildbot
The Buildbot has detected a failed build on builder whole buildset while 
building elfutils.
Full details are available at:
https://builder.wildebeest.org/buildbot/#builders/11/builds/667

Buildbot URL: https://builder.wildebeest.org/buildbot/

Worker for this Build: fedora-ppc64le

Build Reason: 
Blamelist: Érico Rolim 

BUILD FAILED: failed test (failure)

Sincerely,
 -The Buildbot