Re: [PATCH v2] doc: Update elf_begin.3

2025-06-06 Thread Aaron Merey
On Fri, Jun 6, 2025 at 8:49 AM Mark Wielaard wrote: > > Hi Aaron, > > On Thu, 2025-06-05 at 17:12 -0400, Aaron Merey wrote: > > Signed-off-by: Aaron Merey > > --- > > > > v2: Address Mark's suggestions > > https://patchwork.sourceware.org/pro

[PATCH v2] doc: Update elf_begin.3

2025-06-05 Thread Aaron Merey
Signed-off-by: Aaron Merey --- v2: Address Mark's suggestions https://patchwork.sourceware.org/project/elfutils/patch/20250603012245.411580-1-ame...@redhat.com/ doc/elf_begin.3 | 118 ++-- 1 file changed, 93 insertions(+), 25 deletions(-) diff

[PATCH] doc: Update elf_begin.3

2025-06-02 Thread Aaron Merey
Signed-off-by: Aaron Merey --- doc/elf_begin.3 | 104 1 file changed, 79 insertions(+), 25 deletions(-) diff --git a/doc/elf_begin.3 b/doc/elf_begin.3 index 6a1d0c27..cddd181f 100644 --- a/doc/elf_begin.3 +++ b/doc/elf_begin.3 @@ -1,37 +1,91

Re: ☠ Buildbot (Sourceware): elfutils - failed test (failure) (main)

2025-06-02 Thread Aaron Merey
On Mon, Jun 2, 2025 at 5:29 PM wrote: > > A new failure has been detected on builder elfutils-debian-amd64 while > building elfutils. > > Full details are available at: > https://builder.sourceware.org/buildbot/#/builders/52/builds/518 > > Build state: failed test (failure) > Revision: 06f052

Re: [PATCH] libdw: Make __libdw_fde_by_offset static in libdw/fde.c

2025-06-02 Thread Aaron Merey
Hi Mark, On Sat, May 31, 2025 at 6:17 PM Mark Wielaard wrote: > > __libdw_fde_by_offset is marked as an extern internal function in > libdw/cfi.h (a not public header file). But it is (now) only used in > libdw/fde.c, called from __libdw_find_fde. It was originally used for > dwarf_cfi_validate_f

Re: [PATCH v3] libdwfl: resolve all paths relative to sysroot

2025-06-02 Thread Aaron Merey
On Mon, Jun 2, 2025 at 8:47 AM Michal Sekletar wrote: > > Whenever possible, resolve all symlinks as if the sysroot path were a > chroot environment. This prevents potential interactions with files from > the host filesystem. > > Signed-off-by: Michal Sekletar > --- > configure.ac

Re: [PATCH] backends/ppc_attrs.c: Add PPC long double tags

2025-05-30 Thread Aaron Merey
Hi Anna, On Thu, May 29, 2025 at 11:43 PM A. Wilcox wrote: > > Unfortunately, the only reference I am aware of for GNU attributes is > the GCC compiler source itself; these constants are defined in > gcc/config/rs6000/rs6000.cc in rs6000_elf_file_end. LGTM, I've pushed this patch. Thanks, Aaron

[PATCH v3] libdw: Fix eu_search_tree TOCTOU bugs

2025-05-29 Thread Aaron Merey
eclare new mutex. libdw_findcu.c (__libdw_intern_next_unit): Initialize intern_lock. (__libdw_findcu): Adjust locking so that the first eu_tfind can be done without extra lock overhead. Signed-off-by: Aaron Merey v3: Implement _nolock functions as inline functions a

Re: [PATCH v2] libdwfl: resolve all paths relative to sysroot

2025-05-28 Thread Aaron Merey
Hi Michal, On Wed, May 28, 2025 at 8:30 AM Michal Sekletar wrote: > > I finally got back to this patchset but I am wondering how to address your > nitpick. Difference is that in one case $sysroot/usr/bin/bash is an actual > binary and in another case it is a symlink. Hence it can't be both at t

[PATCH 2/3 v3] src/readelf.c: Support concurrency for -w, --debug-dump

2025-05-27 Thread Aaron Merey
* function pointers and args to schedule_job. Also call run_jobs if thread safety is enabled. Signed-off-by: Aaron Merey --- v3: Replace assert before run_jobs with a conditional. src/readelf.c | 153 -- 1 file changed, 149

[PATCH 2/3 v2] src/readelf.c: Support concurrency for -w, --debug-dump

2025-05-22 Thread Aaron Merey
* function pointers and args to schedule_job. Also call run_jobs if thread safety is enabled. Signed-off-by: Aaron Merey --- v2: Replace max_worker_threads with max_threads for clarity. Avoid creating threads when max_threads is set to 1. src/readelf.c | 152

[PATCH 1/3 v2] src: Add threadlib library for parallel job execution

2025-05-22 Thread Aaron Merey
. * src/threadlib.h: New file. Declares functions add_job and run_jobs. Signed-off-by: Aaron Merey --- v2: Remove unnecessary thread_LDADD variable in src/Makefile.am. Minor comment rewordings. src/Makefile.am | 16 +++ src/threadlib.c | 252

[PATCH v2] libdw: Fix eu_search_tree TOCTOU bugs

2025-05-19 Thread Aaron Merey
eclare new mutex. libdw_findcu.c (__libdw_intern_next_unit): Initialize intern_lock. (__libdw_findcu): Adjust locking so that the first eu_tfind can be done without extra lock overhead. Signed-off-by: Aaron Merey --- v2: _nolock variants of eu_t* functions have bee

[PATCH v2] src/readelf.c: Access symbol and version data only if available

2025-05-19 Thread Aaron Merey
gi?id=32864 Suggested-by: Constantine Bytensky Signed-off-by: Aaron Merey --- v2: Verify that verneed_data and verdef_data sizes are sufficient. src/readelf.c | 96 +-- 1 file changed, 63 insertions(+), 33 deletions(-) diff --git a/src/readel

Re: [PATCH 6/6 v2] doc: Add elf_kind.3

2025-05-14 Thread Aaron Merey
On Wed, May 14, 2025 at 10:16 AM Mark Wielaard wrote: > > Hi Aaron, > > On Mon, 2025-05-12 at 20:33 -0400, Aaron Merey wrote: > > v2: Mention ar(1) and that elfutils libelf does not support COFF object > > files. > > > > On Thu, May 1, 2025 at 1:17 PM Mark Wie

Re: [RFC] tests/run-stack-live-test.sh: prototype 'live' eu-stack testing

2025-05-14 Thread Aaron Merey
On Thu, May 8, 2025 at 6:28 PM Serhei Makarov wrote: > > Missing a few pieces, but worth sharing as an RFC. My idea is to > ensure better test coverage for eu-stack and then > eu-stacktrace+libdwfl_stacktrace by running against a live process > with known content, stopped at a known location, and

[PATCH 5/6 v2] doc: Add elf_hash.3

2025-05-12 Thread Aaron Merey
Signed-off-by: Aaron Merey --- v2: Mention use with SHT_HASH and clarify that only the lower 32 bits of the return value are used. doc/Makefile.am | 1 + doc/elf_hash.3 | 51 + 2 files changed, 52 insertions(+) create mode 100644 doc/elf_hash

[PATCH 3/6 v2] doc: Add elf_fill.3

2025-05-12 Thread Aaron Merey
Signed-off-by: Aaron Merey --- v2: Mention fill value only applies to new gaps and set Thread Safety atrribute to 'MT-Unsafe race' doc/Makefile.am | 1 + doc/elf_fill.3 | 53 + 2 files changed, 54 insertions(+) create mode 100644 do

[PATCH 6/6 v2] doc: Add elf_kind.3

2025-05-12 Thread Aaron Merey
Signed-off-by: Aaron Merey v2: Mention ar(1) and that elfutils libelf does not support COFF object files. --- On Thu, May 1, 2025 at 1:17 PM Mark Wielaard wrote: > > > +.SH SEE ALSO > > +.BR libelf (3), > > +.BR elf (5) > > elf.5 doesn't describe the ar format,

[PATCH 4/6] doc: Add elf_getbase.3

2025-05-12 Thread Aaron Merey
Signed-off-by: Aaron Merey --- v2: mention that base offset returned is always 0 for non ELF_K_AR kinds. Also mention elf_getaroff and elf_rawelf. doc/Makefile.am | 1 + doc/elf_getbase.3 | 59 +++ 2 files changed, 60 insertions(+) create mode

[PATCH 2/6 v2] doc: Add elf_end.3

2025-05-12 Thread Aaron Merey
Signed-off-by: Aaron Merey --- v2: Mention elf arg may be NULL. On Wed, Apr 30, 2025 at 1:18 PM Mark Wielaard wrote: > > So we do have a tiny elf_begin.3 man page, but it doesn't really > describe anything. The above seems a technically correct description of > ELF de

[PATCH 1/6] doc/Makefile.am: Sort manpages in alphabetical order

2025-05-12 Thread Aaron Merey
Signed-off-by: Aaron Merey --- doc/Makefile.am | 50 - 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/doc/Makefile.am b/doc/Makefile.am index c95369e9..b75711ca 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -27,37 +27,37

Re: [PATCH] PR32930 backends/: guard asm/perf_regs.h include

2025-05-06 Thread Aaron Merey
Hi Serhei, On Mon, May 5, 2025 at 12:26 PM Serhei Makarov wrote: > > asm/perf_regs.h is an arch-specific linux include, not present on > architectures like hppa and m68k that lack perf_events support. > > Only one place we need to fix; others already guard the include by > architecture, or use ar

[PATCH v2] src/readelf.c: Access symbol and version data only if available

2025-05-05 Thread Aaron Merey
gi?id=32864 Suggested-by: Constantine Bytensky Signed-off-by: Aaron Merey --- v2 changes: Added checks for unset addrs and missing symbol version data. src/readelf.c | 82 ++- 1 file changed, 49 insertions(+), 33 deletions(-) diff --git a/src/read

elfutils 0.193 released

2025-04-25 Thread Aaron Merey
: Improved handling of corrupt ELF data. --section-headers output now includes a "Key to Flags" explaining section flag meanings. * GIT SHORTLOG * Aaron Merey (22): configure.ac: Fix ENABLE_IMA_VERIFICATION conditional tests/.gitignore: Add newzdata strip: Ignore --reloc

Re: [PATCH v6 01/12] libebl [1/12]: api for perf register handling, start with x86_64

2025-04-25 Thread Aaron Merey
On Fri, Apr 25, 2025 at 10:56 AM Serhei Makarov wrote: > > Changes for v6: > > - Minor fixes as requested. > > Changes for v2: > > - Merged commit 11 into commit 1 (both sample_base_addr/sample_pc and > set_initial_registers_sample make sense to introduce in the same > commit). > > - Added i38

Re: [PATCH v5 06/12] libdwfl_stacktrace [6/12]: Elf* caching via dwflst_process_tracker

2025-04-25 Thread Aaron Merey
On Fri, Apr 25, 2025 at 9:56 AM Serhei Makarov wrote: > > > > On Fri, Apr 25, 2025, at 1:57 AM, Aaron Merey wrote: > > Also if you haven't done so already, please run any manual tests under > > valgrind memcheck (and helgrind if you are able to test this with

Re: [PATCH v5 12/12] eu-stacktrace [12/12]: use dwflst_perf_sample_getframes

2025-04-24 Thread Aaron Merey
On Thu, Apr 24, 2025 at 5:52 PM Serhei Makarov wrote: > > Changes for v4: > > - Separate out libdwfl_stacktrace, as requested. > > Changes for v3: > > - Fix initialization of elf in sysprof_init_dwfl > (previously triggered -Wmaybe-uninitialized). > > * * * > > Remove the code from src/stacktrac

Re: [PATCH v5 11/12] libdwfl_stacktrace [11/12]: add dwflst_perf_sample_getframes

2025-04-24 Thread Aaron Merey
On Thu, Apr 24, 2025 at 5:53 PM Serhei Makarov wrote: > > Changes for v4: > > - Separate out libdwfl_stacktrace, as requested. > > Changes for v3: > > - use const void *stack, not void *, to allow users > to pass a const stack sample > > Changes for v2: > > - use renamed __libdwfl_set_initial_re

Re: [PATCH v5 10/12] eu-stacktrace [10/12]: use dwflst_tracker_find_pid

2025-04-24 Thread Aaron Merey
On Thu, Apr 24, 2025 at 5:49 PM Serhei Makarov wrote: > > Changes for v4: > > - Separate out libdwfl_stacktrace, as requested. > > * * * > > Initial minimal change to ensure dwflst_tracker_find_pid is > tested. For now, we keep the additional dwfltab implementation in > stacktrace.c, since it's be

Re: [PATCH v5 09/12] libdwfl_stacktrace [9/12]: add dwflst_tracker_find_pid

2025-04-24 Thread Aaron Merey
On Thu, Apr 24, 2025 at 5:49 PM Serhei Makarov wrote: > > Changes for v4: > > - Separate out libdwfl_stacktrace, as requested. > > Changes for v2: > > - Add locking for dwfltab. > > * * * > > New function that retrieves the Dwfl for a particular PID, or, > if the Dwfl is absent, creates it via a p

Re: [PATCH v5 08/12] libdwfl_stacktrace [8/12]: Dwfl* caching via Dwflst_Process_Tracker

2025-04-24 Thread Aaron Merey
On Thu, Apr 24, 2025 at 5:52 PM Serhei Makarov wrote: > > Changes for v4: > > - Separate out libdwfl_stacktrace, as requested. > > Changes for v3: > > - Handle dwfl->process == NULL case in __libdwfl_remove_dwfl_from_tracker. > > * * * > > The Dwflst_Process_Tracker also includes a dynamicsizehash

Re: [PATCH v5 07/12] eu-stacktrace [7/12]: use Dwflst_Process_Tracker for Elf * caching

2025-04-24 Thread Aaron Merey
On Thu, Apr 24, 2025 at 5:50 PM Serhei Makarov wrote: > > Changes for v4: > > - Separate out libdwfl_stacktrace, as requested. > > * * * > > * src/Makefile.am (AM_CPPFLAGS): Include headers from > ../libdwfl_stacktrace. > * src/stacktrace.c (tracker): New global variable. > (sample_callbacks):

Re: [PATCH v5 06/12] libdwfl_stacktrace [6/12]: Elf* caching via dwflst_process_tracker

2025-04-24 Thread Aaron Merey
On Thu, Apr 24, 2025 at 5:52 PM Serhei Makarov wrote: > > Changes for v5: > > - Bugfixes in dwflst_tracker_find_elf.c. > > Changes for v4: > > - Separate out libdwfl_stacktrace, as requested. > > - dwfl_module_getdwarf.c now uses the dwflst_tracker_cache_elf() > interface instead of editing the

Re: [PATCH v5 05/12] libdwfl_stacktrace [5/12]: introduce Dwflst_Process_Tracker

2025-04-24 Thread Aaron Merey
On Thu, Apr 24, 2025 at 5:48 PM Serhei Makarov wrote: > > Changes for v4: > > - Separate out libdwfl_stacktrace, as requested. > > * * * > > New data structure to coordinate caching Elf data among multiple Dwfl > structs attached to different processes. Meant to reduce the overhead > for profilers

Re: [PATCH v5 04/12] libdwfl_stacktrace [4/12]: intro library, add dwflst_perf_sample_preferred_regs_mask

2025-04-24 Thread Aaron Merey
On Thu, Apr 24, 2025 at 5:50 PM Serhei Makarov wrote: > > Changes for v5: > > - Separate ELFUTILS_0.193_EXPERIMENTAL namespace, mark library experimental. > > Changes for v4: > > - Separate out libdwfl_stacktrace, as requested. > > Changes for v2: > > - guard the linux/perf_events.h include proper

Re: [PATCH v5 03/12] libebl [3/12]: eu-stacktrace: use new register handling api

2025-04-24 Thread Aaron Merey
On Thu, Apr 24, 2025 at 5:48 PM Serhei Makarov wrote: > > Changes for v4: > > - Since __libdwfl_set_initial_registers_thread is now private to > libdwfl, the modified code in this patch has been disabled. > > * * * > > Dummy commit to show how the sample_set_initial_registers callback in > eu-st

Re: [PATCH v5 02/12] libdwfl [2/12]: expose setfunc callback for libdwflP+libebl clients

2025-04-24 Thread Aaron Merey
On Thu, Apr 24, 2025 at 5:48 PM Serhei Makarov wrote: > > Changes for v2: > > - No longer exposing this in public libdwfl.h api. > > * * * > > Renaming pid_set_initial_registers to > __libdwfl_set_initial_registers_thread and adding to libdwflP.h. > > This callback was private to one file, but now

Re: [PATCH v5 01/12] libebl [1/12]: api for perf register handling, start with x86_64

2025-04-24 Thread Aaron Merey
On Thu, Apr 24, 2025 at 5:49 PM Serhei Makarov wrote: > > Changes for v2: > > - Merged commit 11 into commit 1 (both sample_base_addr/sample_pc and > set_initial_registers_sample make sense to introduce in the same > commit). > > - Added i386 backend and factored out common code. > > * * * > >

Re: [PATCH 04/13] libdwfl [4/13]: add dwfl_perf_sample_preferred_regs_mask

2025-04-22 Thread Aaron Merey
On Tue, Apr 22, 2025 at 10:24 AM Serhei Makarov wrote: > > On Tue, Apr 22, 2025, at 10:17 AM, Aaron Merey wrote: > >> One question this raises re: the Dwfl_Process_Tracker structure and where > >> its implementation should be located. In the patches, the Dwfl struct >

Re: [PATCH 04/13] libdwfl [4/13]: add dwfl_perf_sample_preferred_regs_mask

2025-04-22 Thread Aaron Merey
On Tue, Apr 22, 2025 at 9:53 AM Serhei Makarov wrote: > On Tue, Apr 22, 2025, at 9:45 AM, Aaron Merey wrote: > > > > Let's move the process_tracker interface as well for additional > > flexibility to modify if needed. As for a name, I like > > libdwfl_stacktr

Re: [PATCH 04/13] libdwfl [4/13]: add dwfl_perf_sample_preferred_regs_mask

2025-04-22 Thread Aaron Merey
Hi Serhei, On Tue, Apr 22, 2025 at 9:27 AM Serhei Makarov wrote: > > On Mon, Apr 21, 2025, at 12:29 AM, Aaron Merey wrote:. > > > > I know we're close to the next release and I do want this work to be > > included. My proposal is to move the current API out of libdw

Re: [PATCH 04/13] libdwfl [4/13]: add dwfl_perf_sample_preferred_regs_mask

2025-04-20 Thread Aaron Merey
Hi Serhei, On Thu, Mar 20, 2025 at 9:24 AM Serhei Makarov wrote: > > On Wed, Mar 19, 2025, at 5:36 PM, Mark Wielaard wrote: > > > > On Sun, Mar 16, 2025 at 07:14:11PM -0400, Serhei Makarov wrote: > >> Since libebl is a private interface, subsequent patches in the series > >> introduce another api

[PATCH] libdw: Fix eu_search_tree TOCTOU bugs

2025-04-15 Thread Aaron Merey
f): Update macro_lock comment. (struct Dwarf_CU): Declare new mutex. libdw_findcu.c (__libdw_intern_next_unit): Initialize intern_lock. (__libdw_findcu): Adjust locking so that the first eu_tfind can be done without extra lock overhead. Signed-off-by: Aaron Merey

Re: [PATCH] libdw: Add Nim language and dwarf_srclang tests

2025-04-10 Thread Aaron Merey
Hi Mark, On Wed, Apr 2, 2025 at 8:50 AM Mark Wielaard wrote: > > DW_LANG_Nim and DW_LNAME_Nim were added to the DWARF languages. > > While adding them, and the default lower bounds, I noticed DW_LANG_V > and DW_LANG_Algol68 where missing in srclang_to_language an internal > helper function. > > T

Re: [PATCH v2] libdwfl: resolve all paths relative to sysroot

2025-04-10 Thread Aaron Merey
Hi Michal, On Tue, Apr 1, 2025 at 2:56 PM Michal Sekletar wrote: > > Whenever possible, resolve all symlinks as if the sysroot path were a > chroot environment. This prevents potential interactions with files from > the host filesystem. > > Signed-off-by: Michal Sekletar > --- > configure.ac

[PATCH] src/readelf.c: Access symbol and version data only if available

2025-04-10 Thread Aaron Merey
ed-by: Constantine Bytensky Signed-off-by: Aaron Merey --- src/readelf.c | 50 +++--- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/src/readelf.c b/src/readelf.c index 5b0e7b47..0452977f 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -30

[PATCH 3/5] doc: Add elf_getbase.3

2025-04-05 Thread Aaron Merey
Signed-off-by: Aaron Merey --- doc/Makefile.am | 3 ++- doc/elf_getbase.3 | 55 +++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 doc/elf_getbase.3 diff --git a/doc/Makefile.am b/doc/Makefile.am index 0dec1fc7..56c56b7b

Preparing for the 0.193 release on Friday April 25

2025-04-01 Thread Aaron Merey
Hi everyone, We are planning to do the 0.193 release on Friday April 25. Since the 0.192 release last October there have been 66 commits. Among these are some important bug fixes and new features. If your patch is still under review [1] or you have other patches you'd like merged before the rel

Re: [PATCH 2/3] src/readelf.c: Support concurrency for -w, --debug-dump

2025-03-31 Thread Aaron Merey
Hi Frank, On Mon, Mar 31, 2025 at 6:29 PM Frank Ch. Eigler wrote: > > > Due to significant lock contention, running eu-readelf when configured > > with --enable-thread-safety causes a major performance degradation. > > Currently, concurrency may double the runtime of eu-readelf. > > > However I t

[PATCH 4/5] doc: Add elf_hash.3

2025-03-31 Thread Aaron Merey
Signed-off-by: Aaron Merey --- doc/Makefile.am | 3 ++- doc/elf_hash.3 | 49 + 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 doc/elf_hash.3 diff --git a/doc/Makefile.am b/doc/Makefile.am index 56c56b7b..260a3f09 100644

[PATCH 5/5] doc: Add elf_kind.3

2025-03-31 Thread Aaron Merey
Signed-off-by: Aaron Merey --- doc/Makefile.am | 3 ++- doc/elf_kind.3 | 71 + 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 doc/elf_kind.3 diff --git a/doc/Makefile.am b/doc/Makefile.am index 260a3f09..8028acb0 100644

[PATCH 1/5] doc: Add elf_end.3

2025-03-31 Thread Aaron Merey
Signed-off-by: Aaron Merey --- doc/Makefile.am | 3 ++- doc/elf_end.3 | 71 + 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 doc/elf_end.3 diff --git a/doc/Makefile.am b/doc/Makefile.am index c95369e9..36f1855f 100644

[PATCH 2/5] doc: Add elf_fill.3

2025-03-31 Thread Aaron Merey
Signed-off-by: Aaron Merey --- doc/Makefile.am | 3 ++- doc/elf_fill.3 | 53 + 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 doc/elf_fill.3 diff --git a/doc/Makefile.am b/doc/Makefile.am index 36f1855f..0dec1fc7 100644

[PATCH 2/3] src/readelf.c: Support concurrency for -w, --debug-dump

2025-03-29 Thread Aaron Merey
* function pointers and args to schedule_job. Also call run_jobs if thread safety is enabled. Signed-off-by: Aaron Merey --- Due to significant lock contention, running eu-readelf when configured with --enable-thread-safety causes a major performance degradation. Currently

[PATCH 1/3] src: Add threadlib library for parallel job execution

2025-03-29 Thread Aaron Merey
. * src/threadlib.h: New file. Declares functions add_job and run_jobs. Signed-off-by: Aaron Merey --- src/Makefile.am | 17 src/threadlib.c | 253 src/threadlib.h | 34 +++ 3 files changed, 304 insertions(+) create mode

Re: [COMMITTED] libdw/libdw_findcu.c: Fix TOCTOU race condition in __libdw_findcu

2025-03-27 Thread Aaron Merey
Hi Mark, On Thu, Mar 27, 2025 at 4:51 AM Mark Wielaard wrote: > > Hi Aaron, > > On Thu, Mar 27, 2025 at 12:07:18AM -0400, Aaron Merey wrote: > > Ensure that dwarf_lock is held before accessing next_tu_offset and > > next_cu_offset. > > > > This fixes a TOCT

[COMMITTED] tests/.gitignore: Add dwarf_language_lower_bound, test-manyfuncs

2025-03-26 Thread Aaron Merey
Signed-off-by: Aaron Merey --- tests/.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/.gitignore b/tests/.gitignore index f8869b40..6ae12adb 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -41,6 +41,7 @@ /dwarf_default_lower_bound /dwarfcfi

[COMMITTED] libdw/libdw_findcu.c: Fix TOCTOU race condition in __libdw_findcu

2025-03-26 Thread Aaron Merey
Ensure that dwarf_lock is held before accessing next_tu_offset and next_cu_offset. This fixes a TOCTOU bug in __libdw_findcu that causes NULL to be incorrectly returned. Signed-off-by: Aaron Merey --- libdw/libdw_findcu.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff

Re: [PATCH 3/4] libdw: Make dwarf_srclang forward compatible with DW_AT_language_name

2025-03-26 Thread Aaron Merey
Hi Mark, On Tue, Mar 11, 2025 at 6:00 AM Mark Wielaard wrote: > > For programs which use dwarf_srclang it might be useful to translate a > DW_LNAME (plus version) into a DW_LANG constant if there is no > DW_AT_language constant, but there is a DW_AT_language_name (and > DW_AT_language_version). >

Re: [PATCH 4/4] readelf: Add support for printing DW_AT_language_name DW_LNAMEs

2025-03-26 Thread Aaron Merey
Hi Mark, On Tue, Mar 11, 2025 at 6:01 AM Mark Wielaard wrote: > > Add a testfile using GCC 15 (experimental). > > * libdw/dwarf.h: Add DW_LNAME_lo_user and DW_LNAME_hi_user. > * src/readelf.c (dwarf_lname_string): New function. > (dwarf_lname_name): Likewise. >

Re: [PATCH 2/4] libdw: Add dwarf_language and dwarf_language_lower_bound functions.

2025-03-26 Thread Aaron Merey
Hi Mark, On Tue, Mar 11, 2025 at 5:59 AM Mark Wielaard wrote: > > dwarf_language returns a DW_LNAME constant for a CU Die. If the CU Die > has a DW_AT_language_name attribute dwarf_language will return it and > the DW_AT_language_version attribute value. Otherwise dwarf_language > will lookup the

Re: [PATCH 1/4] dwarf.h: Add DWARF v6 langauge attributes and DW_LNAME constants

2025-03-26 Thread Aaron Merey
Hi Mark, On Tue, Mar 11, 2025 at 5:59 AM Mark Wielaard wrote: > > https://dwarfstd.org/languages-v6.html defines the DWARF v6 language > attributes, DW_AT_language_name, DW_AT_language_version and DW_LNAME > constants as usable by pre-DWARF v6 producers and consumers. > > Also add new DW_LANG_V a

Re: [PATCH] libdwfl: resolve all paths relative to sysroot

2025-03-25 Thread Aaron Merey
Hi Michal, On Wed, Mar 19, 2025 at 2:33 PM Michal Sekletar wrote: > > Whenever possible, resolve all symlinks as if the sysroot path were a > chroot environment. This prevents potential interactions with files from > the host filesystem. > > Signed-off-by: Michal Sekletar > --- > configure.ac

[PATCH 3/9 v4] libdwP.h: Add locking to str_offsets_base_off

2025-03-17 Thread Aaron Merey
: Aaron Merey --- v3: https://patchwork.sourceware.org/project/elfutils/patch/20250220043644.2058519-3-ame...@redhat.com/ v4: simplify unlocking in str_offsets_base_off. libdw/dwarf_end.c| 1 + libdw/libdwP.h | 17 +++-- libdw/libdw_findcu.c | 1 + 3 files changed, 17

[PATCH 2/9 v4] libdw: Add locking to dwarf_getsrcfiles, dwarf_getsrclines, dwarf_macro_getsrcfiles

2025-03-16 Thread Aaron Merey
. * libdw/dwarf_macro_getsrclines.c (dwarf_macro_getsrclines): Use macro_lock. * libdw/libdwP.h (struct Dwarf): Define macro_lock. (struct Dwarf_CU): Define src_lock. * libdw/libdw_findcu.c (__libdw_intern_next_unit): Init src_lock. Signed-off-by: Aaron Merey

Re: [patch] PR31862: debuginfod client should cache received x-debuginfod-* headers

2025-03-05 Thread Aaron Merey
On Mon, Mar 3, 2025 at 10:02 PM Frank Ch. Eigler wrote: > > Hi - > > Thanks for the review! > > > On my machine memcheck reports leaks due to target_cachehdr_path > > missing a free. [...] > > Sorry! I must have sent an immediately prior version of the patch; > the following one has the missing

Re: [PATCH] libelf: Rewrite elf_scnshndx, extended index table handling

2025-02-28 Thread Aaron Merey
Hi Mark, On Sun, Feb 23, 2025 at 6:31 PM Mark Wielaard wrote: > > elf_scnshndx is a elfutils extension to libelf that given a SHT_SYMTAB > section returns the index to the corresponding SHT_SYMTAB_SHNDX > section, if it exists. This is needed when there are more than 64K > sections and there are

Re: [patch] PR31862: debuginfod client should cache received x-debuginfod-* headers

2025-02-27 Thread Aaron Merey
Hi Frank, On Fri, Feb 21, 2025 at 3:07 PM Frank Ch. Eigler wrote: > > > commit 082c0a94eed6706753e8019ce348be095deb72f9 (HEAD -> main) > Author: Frank Ch. Eigler > Date: Fri Feb 21 14:33:49 2025 -0500 > > PR31862: debuginfod: client to cache x-debuginfod-* headers > > This feature allo

[PATCH 9/9 v6] Add tests/run-eu-search-die.sh

2025-02-19 Thread Aaron Merey
From: Heather McIntyre * tests/.gitignore: Add eu_search_die. * tests/Makefile.am: Add eu_search_die, run-eu-search-die.sh. * tests/eu_search_die.c: New file. * tests/run-eu-search-die.sh: New file. Signed-off-by: Heather S. McIntyre Signed-off-by: Aaron Merey

[PATCH 8/9 v6] Add tests/run-eu-search-lines.sh

2025-02-19 Thread Aaron Merey
-by: Aaron Merey Signed-off-by: Mark Wielaard --- No changes in v6. tests/.gitignore | 1 + tests/Makefile.am| 9 +- tests/eu_search_lines.c | 211 +++ tests/run-eu-search-lines.sh | 31 + 4 files changed, 249 insertions(+), 3

[PATCH 7/9 v6] Add tests/run-eu-search-macros.sh

2025-02-19 Thread Aaron Merey
Signed-off-by: Aaron Merey Signed-off-by: Mark Wielaard --- No changes in v6. tests/.gitignore | 1 + tests/Makefile.am | 8 +- tests/eu_search_macros.c | 175 ++ tests/run-eu-search-macros.sh | 28 ++ 4 files changed, 209

[PATCH 3/9 v3] libdwP.h: Add locking to str_offsets_base_off

2025-02-19 Thread Aaron Merey
: Aaron Merey --- v3 changes: This patch replaces v2 04/10. 04/10 added a lock to dwarf_offdie that was unnecessary but happened to prevent the reporting of a race condition in str_offsets_base_off. This patch addresses the source of the race condition. libdw/dwarf_end.c| 1 + libdw/libdwP.h

[PATCH 1/9 v3] Change type of dwarf_lock from rwlock to mutex

2025-02-19 Thread Aaron Merey
: Aaron Merey --- v3 changes: More specific comment for dwarf_lock declaration. lib/locks.h | 16 libdw/dwarf_begin_elf.c | 2 +- libdw/dwarf_end.c | 2 +- libdw/dwarf_formref_die.c | 4 ++-- libdw/dwarf_getalt.c | 10 +- libdw/dwarf_setalt.c

[PATCH 6/9 v6] Add tests/run-eu-search-cfi.sh

2025-02-19 Thread Aaron Merey
From: Heather McIntyre * tests/.gitignore: Add eu_search_cfi. * tests/Makefile.am: Add eu_search_cfi, run-eu-search-cfi.sh. * tests/eu_search_cfi.c: New file. * tests/run-eu-search-cfi.sh: New file. Signed-off-by: Heather S. McIntyre Signed-off-by: Aaron Merey

[PATCH 4/9 v3] Add configure option --enable-helgrind

2025-02-19 Thread Aaron Merey
USE_HELGRIND is true, then include --tool=helgrind in the valgrind command that tests are run under. Signed-off-by: Aaron Merey --- v3 changes: Add --track-fds to valgrind_cmd when USE_HELGRIND is true. configure.ac | 16 ++-- tests/Makefile.am | 4 2 files

[PATCH 2/9 v3] libdw: Add locking to dwarf_getsrcfiles, dwarf_getsrclines, dwarf_macro_getsrcfiles

2025-02-19 Thread Aaron Merey
* libdw/dwarf_getsrcfiles.c (dwarf_getsrcfiles): Use dwarf_lock. * libdw/dwarf_getsrclines.c (dwarf_getsrclines): Ditto. * libdw/dwarf_macro_getsrclines.c (dwarf_macro_getsrclines): Ditto. Signed-off-by: Aaron Merey --- v3 changes: This patch replaces v2 02/10

[PATCH 5/9 v3] Add tests/thread-safety-subr.sh

2025-02-19 Thread Aaron Merey
thread-safety-subr.sh contains subroutine check_thread_safety_enabled which skips further testing when USE_LOCKS is false. * tests/Makefile.am (EXTRA_DIST): Add thread-safety-subr.sh. * tests/thread-safety-subr.sh: New file. Signed-off-by: Aaron Merey --- No changes in v3

Re: [PATCH] libdw: Simplify __libdw_getabbrev and fix dwarf_offabbrev issue

2025-02-13 Thread Aaron Merey
Hi Mark, On Mon, Feb 10, 2025 at 10:49 AM Mark Wielaard wrote: > > __libdw_getabbrev could crash on reading a bad abbrev by trying to > deallocate memory it didn't allocate itself. This could happen because > dwarf_offabbrev would supply its own memory when calling > __libdw_getabbrev. No other c

Re: [PATCH] strip: Verify symbol table is a real symbol table

2025-02-13 Thread Aaron Merey
Hi Mark, On Thu, Feb 13, 2025 at 9:04 AM Mark Wielaard wrote: > > We didn't check the symbol table referenced from the relocation table > was a real symbol table. This could cause a crash if that section > happened to be an SHT_NOBITS section without any data. Fix this by > adding an explicit che

Re: [PATCH] libelf: Handle elf_strptr on section without any data

2025-02-13 Thread Aaron Merey
Hi Mark, On Wed, Feb 12, 2025 at 6:16 PM Mark Wielaard wrote: > > In the unlikely situation that elf_strptr was called on a section with > sh_size already set, but that doesn't have any data yet we could crash > trying to verify the string to return. > > This could happen for example when a new s

Re: [PATCH] readelf: Skip trying to uncompress sections without a name

2025-02-13 Thread Aaron Merey
Hi Mark, On Mon, Feb 10, 2025 at 1:37 PM Mark Wielaard wrote: > > When combining eu-readelf -z with -x or -p to dump the data or strings > in an (corrupted ELF) unnamed numbered section eu-readelf could crash > trying to check whether the section name starts with .zdebug. Fix this > by skipping s

Re: [PATCH] readelf: Handle NULL phdr in handle_dynamic_symtab

2025-02-13 Thread Aaron Merey
Hi Mark, On Mon, Feb 10, 2025 at 1:32 PM Mark Wielaard wrote: > > A corrupt ELF file can have broken program headers, in which case > gelf_getphdr returns NULL. This could crash handle_dynamic_symtab > while searching for the PT_DYNAMIC phdr. Fix this by checking whether > gelf_phdr returns NULL.

Re: [PATCH] libelf, readelf: Use validate_str also to check dynamic symstr data

2025-02-13 Thread Aaron Merey
Hi Mark, On Mon, Feb 10, 2025 at 1:27 PM Mark Wielaard wrote: > > When dynsym/str was read through eu-readelf --dynamic by readelf > process_symtab the string data was not validated, possibly printing > unallocated memory past the end of the symstr data. Fix this by > truning the elf_strptr valid

[PATCH 06/10 v2] Add tests/thread-safety-subr.sh

2025-02-04 Thread Aaron Merey
thread-safety-subr.sh contains subroutine check_thread_safety_enabled which skips further testing when USE_LOCKS is false. * tests/Makefile.am (EXTRA_DIST): Add thread-safety-subr.sh. * tests/thread-safety-subr.sh: New file. Signed-off-by: Aaron Merey --- v2 changes: Removed

[PATCH 05/10 v2] Add configure option --enable-helgrind

2025-02-04 Thread Aaron Merey
USE_HELGRIND is true, then include --tool=helgrind in the valgrind command that tests are run under. Signed-off-by: Aaron Merey --- v2 changes: Enabing helgrind now requires enabling annotations configure.ac | 16 ++-- tests/Makefile.am | 6 +- 2 files

Re: [PATCH 4/5] tests/test-elf_cntl_gelf_getshdr.c: Close fd unconditionally

2025-02-04 Thread Aaron Merey
Hi Mark, On Mon, Feb 3, 2025 at 8:36 AM Mark Wielaard wrote: > > I think this subtly changes what is being tested here. If I remember > correctly this tests that gelf_getshdr works correctly even when the > underlying fd is closed and the file is either mmapped or elf_cntl > with ELF_C_FDREAD is

Re: [PATCH 09/10 v5] Add tests/run-eu-search-lines.sh

2025-02-04 Thread Aaron Merey
Hi Mark, On Mon, Feb 3, 2025 at 7:40 AM Mark Wielaard wrote: > > Found the issue with the patches not showing up on the list. > They were sent to elfutils-patches@ which doesn't exists... > Add elfutils-devel to the CC now. Apologies, I mixed up elfutils-devel@ and gdb-patches@. I've reposted th

[PATCH 09/10 v5] Add tests/run-eu-search-lines.sh

2025-02-04 Thread Aaron Merey
* tests/.gitignore: Add eu_search-lines. * tests/Makefile.am: Add eu_search_lines, run-eu-search-lines.sh. * tests/eu_search_lines.c: New file. tests/run-eu-search-lines.sh: New file. Signed-off-by: Heather S. McIntyre Signed-off-by: Aaron Merey Signed

[PATCH 08/10 v5] Add tests/run-eu-search-macros.sh

2025-02-04 Thread Aaron Merey
* tests/.gitignore: Add eu_search_macros.sh * tests/Makefile.am: Add eu_search_macros, run-eu-search-macros.sh. * tests/eu_search_macros.c: New file. * tests/run-eu-search-macros.sh: New file. Signed-off-by: Heather S. McIntyre Signed-off-by: Aaron Merey

[PATCH 07/10 v5] Add tests/run-eu-search-cfi.sh

2025-02-04 Thread Aaron Merey
From: Heather McIntyre * tests/.gitignore: Add eu_search_cfi. * tests/Makefile.am: Add eu_search_cfi, run-eu-search-cfi.sh. * tests/eu_search_cfi.c: New file. * tests/run-eu-search-cfi.sh: New file. Signed-off-by: Heather S. McIntyre Signed-off-by: Aaron Merey

[PATCH 10/10 v5] Add tests/run-eu-search-die.sh

2025-02-04 Thread Aaron Merey
* tests/.gitignore: Add eu_search_die. * tests/Makefile.am: Add eu_search_die, run-eu-search-die.sh. * tests/eu_search_die.c: New file. * tests/run-eu-search-die.sh: New file. Signed-off-by: Heather S. McIntyre Signed-off-by: Aaron Merey Signed-off-by: Mark

[PATCH 03/10 v2] libdw: Add locking to dwarf_getsrcfiles and dwarf_getsrclines

2025-02-04 Thread Aaron Merey
* libdw/dwarf_getsrcfiles.c (dwarf_getsrcfiles): Use dwarf_lock. * libdw/dwarf_getsrclines.c (dwarf_getsrclines): Use dwarf_lock. Signed-off-by: Aaron Merey --- v2 changes: Combined from v1 patches 04/15 and 05/15. libdw/dwarf_getsrcfiles.c | 11 +++ libdw

[PATCH 04/10 v2] dwarf_offdie.c: Add locking

2025-02-04 Thread Aaron Merey
* libdw/dwarf_offdie.c (__libdw_offdie): Use dwarf_lock. Signed-off-by: Aaron Merey --- v2 changes: Lock only for the duration of __libdw_findcu. libdw/dwarf_offdie.c | 4 1 file changed, 4 insertions(+) diff --git a/libdw/dwarf_offdie.c b/libdw/dwarf_offdie.c index 883720de

[PATCH 01/10 v2] Change type of dwarf_lock from rwlock to mutex

2025-02-04 Thread Aaron Merey
/libdw_findcu.c (__libdw_findcu): Ditto. Signed-off-by: Aaron Merey --- v2 changes: Add comments to libdwP.h locks describing which functions they're intended to cover. lib/locks.h | 16 libdw/dwarf_begin_elf.c | 2 +- libdw/dwarf_end.c | 2 +-

[PATCH 02/10 v2] dwarf_filesrc.c: Add locking

2025-02-04 Thread Aaron Merey
* libdw/dwarf_getsrclines.c (read_srcfiles): Initialize Dwarf member. * libdw/dwarf_filesrc.c (dwarf_filesrc): Use dwarf_lock. * libdw/libdwP.h (struct Dwarf_Files_s): Add Dwarf member. Signed-off-by: Aaron Merey --- v2 changes: Combined v1 patches 03/15 and 06/15

[PATCH 1/5] tests/Makefile.am: Add --track-fds=yes to valgrind_cmd

2025-01-30 Thread Aaron Merey
`valgrind --track-fds=yes` will report errors for file descriptor leaks and attempts at closing invalid file descriptors. Signed-off-by: Aaron Merey --- tests/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 8f087798

[PATCH 5/5] tests: Avoid leaking file descriptors

2025-01-30 Thread Aaron Merey
Add calls to close for all test programs that leak file descriptors in order to prevent test failures when run under valgrind --track-fds=yes. Signed-off-by: Aaron Merey --- tests/all-dwarf-ranges.c| 2 ++ tests/alldts.c | 1 + tests/dwarf-getmacros.c | 3 ++- tests/dwarf

[PATCH 3/5] tests/backtrace-subr.sh: Avoid valgrind track-fds in check_native_core

2025-01-30 Thread Aaron Merey
valgrind --track-fds=yes might incorrectly report an error due to the use of inherited file descriptors in check_native_core. Prevent this false positive by temporarily removing "--track-fds=yes" from $VALGRIND_CMD for the duration of the testrun in check_native_core. Signed-off-by: A

[PATCH 4/5] tests/test-elf_cntl_gelf_getshdr.c: Close fd unconditionally

2025-01-30 Thread Aaron Merey
test-elf_cntl_gelf_getshdr conditionally closes a file descriptor depending on a command line argument. This causes an error when run under valgrind --track-fds=yes. Fix this by unconditionally closing the fd. Signed-off-by: Aaron Merey --- tests/test-elf_cntl_gelf_getshdr.c | 20

  1   2   3   4   >