Re: [PATCH 2/3] elf_begin.c: Use relative offset in archive size check

2025-09-11 Thread Mark Wielaard
Hi Aaron, On Sun, Sep 07, 2025 at 10:17:28PM -0400, Aaron Merey wrote: > Before creating an elf descriptor for an archive member, dup_elf > verifies that the size of an archive is large enough to contain the > member. This check uses the member's offset relative to the map_address > of the top-le

Re: [PATCH] libdwfl_stacktrace: fix non-Linux build dep on PERF_SAMPLE_REGS_ABI

2025-09-11 Thread Mark Wielaard
Hi Serhei, On Mon, 2025-09-08 at 12:23 -0400, Serhei Makarov wrote: > Reported on a GNU Hurd build of elfutils. This is a quick fix pending > my more complex patch to reduce dependency on linux perf concepts for > the libdwfl_stacktrace code. > > * libdwfl_stacktrace/dwflst_perf_frame.c (perf_sam

Re: [PATCH 1/3] elf_getarhdr.c: Return correct header for archive within an archive

2025-09-09 Thread Mark Wielaard
Hi Aaron, On Sun, 2025-09-07 at 22:17 -0400, Aaron Merey wrote: > If elf_getarhdr is called on a descriptor that refers to an archive that > is itself a member of an outer archive, it may return the Elf_Arhdr of > the current member of the inner archive instead of Elf_Arhdr of the inner > archive

Re: [PATCH 3/3] readelf.c: Close dwfl if dwfl_report_offline fails

2025-09-08 Thread Mark Wielaard
Hi Aaron, On Sun, Sep 07, 2025 at 10:17:29PM -0400, Aaron Merey wrote: > Within create_dwfl, if dwfl_begin is successful but dwfl_report_offline > fails, the dwfl * pointer being reported is reset to NULL without calling > dwfl_end, causing a memory leak. > > Update create_dwfl to call dwfl_end i

Re: [PATCH 11/13 v2] doc: Add elf_rand.3

2025-09-07 Thread Mark Wielaard
Hi Aaron, On Mon, Aug 04, 2025 at 11:24:41PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > v2: Some rewording. Also remove comment about elf_rand affecting > subsequent calls to elf_next. I will post a patch that prevents this > behavior. Thanks, that patch is now in. commit cc

Re: [PATCH] libelf: Check ELF parent size can contain ar member

2025-09-06 Thread Mark Wielaard
Hi Evgeny, On Sat, Sep 06, 2025 at 05:18:57PM +0300, Evgeny wrote: > On Sat, 6 Sept 2025 at 13:50, Mark Wielaard wrote: > > This, plus Aaron's fix for libdw_open_elf, should resolve the ossfuzz > > issues. > > I can confirm that this patch (combined with the patch

[PATCH] libelf: Check ELF parent size can contain ar member

2025-09-06 Thread Mark Wielaard
call read_file if the offset isn't past the end and with a maximum_size not too large. Signed-off-by: Mark Wielaard --- This, plus Aaron's fix for libdw_open_elf, should resolve the ossfuzz issues. libelf/elf_begin.c | 13 ++--- 1 file changed, 10 insertions(+), 3 d

Re: [PATCH] libdw_open_elf: Avoid invalid free

2025-09-05 Thread Mark Wielaard
Hi Aaron, On Fri, Sep 05, 2025 at 03:41:53PM -0400, Aaron Merey wrote: > If libdw_open_elf detects an invalid ELF file, it may attempt to > temporarily treat it as an ELF archive in order to check if there's > a valid ELF file following a header. > > When doing this, the elf descriptor for the in

Re: [PATCH v2] __libdw_dieabbrev: Replace rwlock with __atomic builtins

2025-09-05 Thread Mark Wielaard
Hi Frank, On Thu, 2025-09-04 at 14:30 -0400, Frank Ch. Eigler wrote: > > > > Maybe we just have to say that you cannot share Dwarf_Die references > > > > between threads? So if you want to use a Dwarf_Die from another thread > > > > you have to copy it instead by passing it by reference? [...] > >

Re: [PATCH v2] __libdw_dieabbrev: Replace rwlock with __atomic builtins

2025-09-05 Thread Mark Wielaard
Hi Aaron, On Thu, 2025-09-04 at 14:10 -0400, Aaron Merey wrote: > On Thu, Sep 4, 2025 at 10:40 AM Mark Wielaard wrote: > > On Mon, 2025-09-01 at 20:31 -0400, Aaron Merey wrote: > > > __libdw_dieabbrev uses the abbrev_lock rwlock to synchronize access to the > > > Dwa

Re: [PATCH] elf_getdata_rawchunk.c: Fix dummy chunk insertion race condition

2025-09-05 Thread Mark Wielaard
Hi Aaron, I did a quick check for this unlock read lock, aqcuire write lock pattern in the code which we should double check/document/fix if necessary: https://sourceware.org/bugzilla/show_bug.cgi?id=33382 On Thu, 2025-09-04 at 14:24 -0400, Aaron Merey wrote: > When elf_getdata_rawchunk aquires a

Re: [PATCH 10/13 v2] doc: Add elf_newscn.3

2025-09-04 Thread Mark Wielaard
Hi Aaron, On Mon, Aug 04, 2025 at 11:24:40PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > v2: fix function declaration in SYNOPSIS. Clarify that the null > section is added automatically if absent and never returned. > Remove comment about requiring ELF_C_WRITE or ELF_C_RDWR. >

Re: [PATCH 13/13 v4] doc: Add elf_next.3

2025-09-04 Thread Mark Wielaard
Hi Aaron, On Mon, Aug 04, 2025 at 11:24:43PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > v4: Minor rewording in DESCRIPTION and code comment in EXAMPLES > > doc/Makefile.am | 1 + > doc/elf_next.3 | 120 > 2 files changed, 1

Re: [PATCH 12/13 v2] doc: Add elf_rawdata.3

2025-09-04 Thread Mark Wielaard
Hi Aaron, On Mon, Aug 04, 2025 at 11:24:42PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > v2: Some rewording. Describe differences between elf_rawdata and > elf_getdata. Also mention that the returned Elf_Data is owned by > libelf and should not be manually freed. > > doc/Mak

Re: [PATCH 09/13 v2] doc: Add elf_newdata.3

2025-09-04 Thread Mark Wielaard
Hi Aaron, On Mon, Aug 04, 2025 at 11:24:39PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > v2: Describe default field values of Elf_Data returned by elf_newdata. > Minor rewording changes > > doc/Makefile.am | 1 + > doc/elf_newdata.3 | 92 +++

Re: [PATCH 08/13 v2] doc: Add elf_gnu_hash.3

2025-09-04 Thread Mark Wielaard
Hi Aaron, On Mon, Aug 04, 2025 at 11:24:38PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > v2: Minor rewording in description and synopsis > > doc/Makefile.am| 1 + > doc/elf_gnu_hash.3 | 1 + > doc/elf_hash.3 | 19 --- > 3 files changed, 18 insertions

Re: [PATCH 07/13 v2] doc: Add elf_getshdrstrndx.3 and elf_getshstrndx.3

2025-09-04 Thread Mark Wielaard
Hi Aaron, On Mon, Aug 04, 2025 at 11:24:37PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > v2: Mark elf_getshstrndx as deprecated in SYNOPSIS. > Add note to HISTORY about reason for introducing elf_getshdrndx. > Explain how to use with elf_strptr and Elf{32,64}_getshdr. > > doc

Re: [PATCH 06/13 v2] doc: Add elf_getshdrnum.3 and elf_getshnum.3

2025-09-04 Thread Mark Wielaard
Hi Aaron, On Mon, Aug 04, 2025 at 11:24:36PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > v2: mark elf_getshnum as obsolete in SYNOPSIS. Describe extended section > headers breifly. Clarify that elf can be NULL, dst cannot be NULL. > Mention reason for elf_getshnum deprication a

Re: [RFC] updated api for libdwfl_stacktrace

2025-09-04 Thread Mark Wielaard
Hi Serhei, On Wed, 2025-09-03 at 10:14 -0400, Serhei Makarov wrote: > Initial response from what I know, pending being actually sure about the > answers. > > On Wed, Sep 3, 2025, at 9:51 AM, Mark Wielaard wrote: > > Could you explain again why we have the first set of arg

Re: [PATCH 05/13 v2] doc: Add elf_getphdrnum.3

2025-09-04 Thread Mark Wielaard
Hi Aaron, On Mon, 2025-08-04 at 23:24 -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > v2: Clarify that return value will not exceed bounds of > elf32_getphdr/elf64_getphdr array when used as an index. > > doc/Makefile.am | 1 + > doc/elf_getphdrnum.3 | 81 ++

Re: [PATCH 04/13 v2] doc: Add elf_getident.3

2025-09-04 Thread Mark Wielaard
Hi Aaron, On Mon, 2025-08-04 at 23:24 -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > v2: some minor rewording. mention EI_* macros by name. > > doc/Makefile.am| 1 + > doc/elf_getident.3 | 95 ++ > 2 files changed, 96 insertions(+

Re: [PATCH 03/13 v2] doc: Add elf_getdata_rawchunk.3

2025-09-04 Thread Mark Wielaard
Mon, Jul 7, 2025 at 1:26 PM Mark Wielaard wrote: > > > > Nice overview of ELF data types. But might there be a better place for > > this? I would assume elf_data, but that man page is currently very bare > > bones. > > When I update the bare bones man pages incl

Re: [PATCH 02/13 v2] doc: Add elf_flag*.3

2025-09-04 Thread Mark Wielaard
Hi Aaron, On Mon, 2025-08-04 at 23:24 -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > v2: Mention that ELF_F_LAYOUT and ELF_F_PERMISSIVE are used with > elf_flagelf only and mention which fields may be manually modified. > Clarify when an error code is set. Explain exactly which ch

Re: [PATCH 01/13 v2] doc: Add elf_memory.3

2025-09-04 Thread Mark Wielaard
Hi Aaron, On Mon, 2025-08-04 at 23:24 -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > v2: replace "open memory buffer" with "open file descriptor". Clarify > behavior when image is NULL as well as the minimum size of the image. > > doc/Makefile.am | 1 + > doc/elf_memory.3 | 85

Re: [PATCH v2] __libdw_dieabbrev: Replace rwlock with __atomic builtins

2025-09-04 Thread Mark Wielaard
Hi Aaron, On Mon, 2025-09-01 at 20:31 -0400, Aaron Merey wrote: > __libdw_dieabbrev uses the abbrev_lock rwlock to synchronize access to the > Dwarf_Die abbrev field as well as its lazy loading. Calls to rwlock_wrlock > and unlock incur significant performance overhead even in single-threaded > c

Re: [RFC] updated api for libdwfl_stacktrace

2025-09-03 Thread Mark Wielaard
Hi Serhei, On Wed, 2025-08-20 at 18:12 -0400, Serhei Makarov wrote: > The header-only patch below illustrates the planned API change. > The base solution is for dwflst_sample_getframes() to take a pointer > to regs_mapping, which, for each item in regs[] array, specifies its > position in the full

Re: Issue 442253757: elfutils:fuzz-libdwfl: Heap-buffer-overflow in __libelf_set_data_list_rdlock

2025-09-02 Thread Mark Wielaard
Hi Google Buganizer, On Tue, Sep 02, 2025 at 11:10:34AM -0700, buganizer-sys...@google.com wrote: > Replying to this email means your email address will be shared with the > team that works on this product. > https://issues.oss-fuzz.com/issues/442253757 > > Changed > > re...@gmail.com added comm

[COMMITTED] elfclassify: Use (void) for no-argument static functions, not ()

2025-08-30 Thread Mark Wielaard
style definition for older standards So just always use (void) instead of () for an empty argument list. * src/elfclassify.c (check_checks): Define as check_checks (void). (check_ar_members): Define as check_ar_members (void). Signed-off-by: Mark Wielaard --- src/elfclassify.c | 4 ++

Re: [PATCH 1/2] elfclassify: Add --any-ar-member option to classify archive member

2025-08-30 Thread Mark Wielaard
Hi Aaron, On Thu, Aug 28, 2025 at 08:25:52PM -0400, Aaron Merey wrote: > On Thu, Aug 28, 2025 at 12:44 PM Mark Wielaard wrote: > > > > To determine whether an ELF archive contains a member of a particular > > type add a new input option to eu-elfclassify --any-ar-member. &g

[PATCH 2/2] elfclassify: Add --has-debug-sections classification option

2025-08-28 Thread Mark Wielaard
-section and --debug-only). * tests/run-elfclassify.sh: Add various --has-debug-sections tests. Signed-off-by: Mark Wielaard --- src/elfclassify.c| 25 + tests/run-elfclassify.sh | 25 + 2 files changed, 50 insertions

[PATCH 1/2] elfclassify: Add --any-ar-member option to classify archive member

2025-08-28 Thread Mark Wielaard
. Signed-off-by: Mark Wielaard --- src/elfclassify.c| 236 --- tests/run-elfclassify.sh | 27 + 2 files changed, 198 insertions(+), 65 deletions(-) diff --git a/src/elfclassify.c b/src/elfclassify.c index 25fe9a652ea4..311530d74dd8 100644 --- a/src

Re: [RFC] elfclassify: Add --ar-member option to classify archive member

2025-08-28 Thread Mark Wielaard
Hi Aaron, On Wed, Aug 27, 2025 at 06:51:36PM -0400, Aaron Merey wrote: > On Tue, Aug 26, 2025 at 6:46 PM Frank Ch. Eigler wrote: > > > RFC: Is the option name --ar-member clear? Do we also want a variant > > > (--all-ar-members) that checks whether all members match? Do we want > > > this to work

Re: [RFC] elfclassify: Add --ar-member option to classify archive member

2025-08-28 Thread Mark Wielaard
Hi Frank, On Tue, Aug 26, 2025 at 06:46:04PM -0400, Frank Ch. Eigler wrote: > > This can be used for example to check whether an ELF archive file > > contains ELF members that can be stripped by using: > > eu-classify --ar-member --unstripped > > So one could immediately put this into debugedi

[RFC] elfclassify: Add --ar-member option to classify archive member

2025-08-26 Thread Mark Wielaard
To determine whether an ELF archive contains a member of a particular type add a new input option to eu-classify --ar-member. eu-classify will match if a given file is an ELF archive and at the classification options apply to at least one of the members. This can be used for example to check wheth

Re: Issue 440144412: elfutils:fuzz-libdwfl: Check failed in CheckUnwind

2025-08-23 Thread Mark Wielaard
Hi, On Thu, Aug 21, 2025 at 01:14:38AM -0700, buganizer-sys...@google.com wrote: > Replying to this email means your email address will be shared with the > team that works on this product. > https://issues.oss-fuzz.com/issues/440144412 This (and the similar emails sent recently) isn't really eno

Re: gz or xz archive

2025-08-19 Thread Mark Wielaard
Hi, On Thu, Aug 14, 2025 at 12:34:29PM -0400, Frank Ch. Eigler wrote: > Sorry, I don't know of a way. We disabled the git/https servers' direct > archive service capability some time ago because of abuse. Also those would miss the signatures for official releases. So if you change the compressi

Re: [PATCH v2] elf_getarhdr: Replace per-archive Elf_Arhdr storage with per-member storage

2025-08-19 Thread Mark Wielaard
ying that each Elf_Arhdr has a unique > ar_name and ar_rawname. > > On Tue, Jul 15, 2025 at 12:19 PM Mark Wielaard wrote: > > > +  /* Per-descriptor copy of the structure returned by 'elf_getarhdr'.  */ > > > +  Elf_Arhdr elf_ar_hdr; > > > + > &g

Re: [PATCH] drop executable bits from **/*.bz2

2025-08-11 Thread Mark Wielaard
Hi Matthias, On Mon, 2025-08-11 at 14:46 +, Matthias Männich wrote: > Archives are usually not meant to be executable and hence should not > need the executable bit set. Drop it consistently to avoid unintential > (and potentially harmful) execution. > > Note, no binary in this repository has

Re: Cybersecurity Risk Assessment Request from Emerson for elfutils

2025-08-11 Thread Mark Wielaard
Hi Saurabh, On Mon, 2025-08-11 at 11:11 +, KATARE, SAURABH [EMR/MSOL/PUNE] wrote:  > As part of our ongoing efforts to comply with theEU Cyber Resilience > Act (CRA), we are currently conducting a cybersecurity risk assessment > of third-party software vendors whose products or components are

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

2025-08-05 Thread Mark Wielaard
single threaded. > Restore static qualifier for sort_listptr_name Ack. > On Wed, Jul 2, 2025 at 5:21 PM Mark Wielaard wrote: > > > > > +  unsigned fn = 0; > > > > > +#ifdef HAVE_GETRLIMIT > > > > > +  { > > > > > +    struct rlim

Re: [PATCH 2/3 v5] src/readelf.c: Add support for print_debug_* output buffering

2025-08-05 Thread Mark Wielaard
Hi Aaron, On Mon, Aug 04, 2025 at 11:20:53PM -0400, Aaron Merey wrote: > Safely handle stdout output during concurrent calls to print_debug_* > functions. > > For any print_debug_* function and any function that could be called > from print_debug_* which also prints to stdout: add a FILE * argume

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

2025-08-05 Thread Mark Wielaard
Hi Aaron, On Mon, Aug 04, 2025 at 11:20:52PM -0400, Aaron Merey wrote: > Add new internal static library libthread.a that provides infrastructure > for eu-* tools to run functions concurrently using pthreads. > > threadlib.c manages per-job threads as well as per-job buffers for stdout > output.

Sourceware infrastructure updates for Q2 2025

2025-07-29 Thread Mark Wielaard
Sourceware infrastructure community updates for Q2 2025 Sourceware has provided the infrastructure for core toolchain and developer tools projects for more than 25 years. https://sourceware.org/sourceware-25-roadmap.html Keep Sourceware worry-free, friendly and independent by donating https:/

Re: [PATCH 6/7 v3] doc: Add elf_cntl.3

2025-07-17 Thread Mark Wielaard
Hi Aaron, On Tue, 2025-07-15 at 00:25 -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > > --- > v3: Clarify that future operations might fail after ELF_C_FDDONE > unless ELF_C_FDREAD is used first. Looks good. Thanks, Mark

Re: [PATCH 5/7 v3] doc: Add elf_getarhdr.3

2025-07-17 Thread Mark Wielaard
Hi Aaron, On Tue, 2025-07-15 at 00:25 -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > > --- > v3: Remove mention of elf_rand and elf_next invalidating Elf_Arhdr. > Change thread safety attribute to MT-safe. Yes, looks correct to me. I am not sure your patch "elf_getarhdr: Replace per-

Re: [PATCH 4/7 v3] doc: Add elf_getaroff.3

2025-07-17 Thread Mark Wielaard
Hi Aaron, On Tue, 2025-07-15 at 00:25 -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > > --- > v3 changes: > > Update return value description to reflect that elf_getaroff returns > -1 if there's an error, not ELF_C_NULL (0). Yes, looks good. Thanks, Mark

Re: [PATCH 3/7 v3] doc: Add elf_next.3

2025-07-17 Thread Mark Wielaard
Hi Aaron, On Tue, 2025-07-15 at 00:25 -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > > --- > v3 changes: Use .B for EXAMPLES. > > On Fri, Jun 27, 2025 at 6:36 PM Mark Wielaard wrote: > > > +  /* Get the members of the archive one after the other.

Re: [PATCH 2/7] elf_getarhdr: Replace per-archive Elf_Arhdr storage with per-member storage

2025-07-15 Thread Mark Wielaard
Hi Aaron, On Tue, 2025-07-15 at 00:25 -0400, Aaron Merey wrote: > Currently each archive descriptor maintains a single Elf_Arhdr for the > current archive member (as determined by elf_next or elf_rand) which is > returned by elf_getarhdr. > > A single per-archive Elf_Arhdr is not ideal since elf_

Re: [PATCH 1/7] elf_getaroff: Fix elf_getaroff error return value

2025-07-15 Thread Mark Wielaard
Hi Aaron, On Tue, 2025-07-15 at 00:25 -0400, Aaron Merey wrote: > elf_getaroff currently returns ELF_C_NULL (0) to indicate that an error > occured (ex. the Elf descriptor is not associated with an archive). > > However elf_getaroff is intended to return -1 if an error occurs. > eu-ar assumes -1

Re: [PATCH 16/16] doc: Add elf_strptr.3

2025-07-10 Thread Mark Wielaard
Hi Aaron, On Mon, 2025-06-30 at 23:12 -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > doc/Makefile.am | 1 + > doc/elf_strptr.3 | 72 > 2 files changed, 73 insertions(+) > create mode 100644 doc/elf_strptr.3 > > diff --git a/doc

Re: [PATCH 15/16] doc: Add elf_scnshndx.3

2025-07-10 Thread Mark Wielaard
Hi Aaron, On Mon, 2025-06-30 at 23:12 -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > doc/Makefile.am| 1 + > doc/elf_scnshndx.3 | 68 ++ > 2 files changed, 69 insertions(+) > create mode 100644 doc/elf_scnshndx.3 > > diff --git a

Re: [PATCH 14/16] doc: Add elf_rawfile.3

2025-07-10 Thread Mark Wielaard
Hi Aaron, Funny, I had no idea this existed. But it is actually used by readelf (for showing the program interpreter) and there is one test case (that does the same). On Mon, 2025-06-30 at 23:12 -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > doc/Makefile.am | 1 + > doc/elf_r

Re: [PATCH 13/16] doc: Add elf_rawdata.3

2025-07-09 Thread Mark Wielaard
Hi Aaron, On Mon, Jun 30, 2025 at 11:12:30PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > doc/Makefile.am | 1 + > doc/elf_rawdata.3 | 97 +++ > 2 files changed, 98 insertions(+) > create mode 100644 doc/elf_rawdata.3 > > diff --

Re: [PATCH 12/16] doc: Add elf_rand.3

2025-07-09 Thread Mark Wielaard
Hi Aaron, On Mon, Jun 30, 2025 at 11:12:29PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > doc/Makefile.am | 1 + > doc/elf_rand.3 | 68 + > 2 files changed, 69 insertions(+) > create mode 100644 doc/elf_rand.3 > > diff --git a

Re: [PATCH 11/16] doc: Add elf_nextscn.3

2025-07-08 Thread Mark Wielaard
Hi Aaron, On Mon, Jun 30, 2025 at 11:12:28PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > doc/Makefile.am | 1 + > doc/elf_nextscn.3 | 65 +++ > 2 files changed, 66 insertions(+) > create mode 100644 doc/elf_nextscn.3 > > diff --

Re: [PATCH 10/16] doc: Add elf_newscn.3

2025-07-08 Thread Mark Wielaard
Hi Aaron, On Mon, Jun 30, 2025 at 11:12:27PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > doc/Makefile.am | 1 + > doc/elf_newscn.3 | 70 > 2 files changed, 71 insertions(+) > create mode 100644 doc/elf_newscn.3 > > diff --gi

Re: [PATCH 09/16] doc: Add elf_newdata.3

2025-07-08 Thread Mark Wielaard
Hi Aaron, On Mon, Jun 30, 2025 at 11:12:26PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > doc/Makefile.am | 1 + > doc/elf_newdata.3 | 75 +++ > 2 files changed, 76 insertions(+) > create mode 100644 doc/elf_newdata.3 > > diff --

Re: [PATCH 08/16] doc: Add elf_gnu_hash.3

2025-07-08 Thread Mark Wielaard
Hi Aaron, On Mon, Jun 30, 2025 at 11:12:25PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > doc/Makefile.am| 1 + > doc/elf_gnu_hash.3 | 1 + > doc/elf_hash.3 | 20 +--- > 3 files changed, 19 insertions(+), 3 deletions(-) > create mode 100644 doc/elf_gn

Re: [PATCH 07/16] doc: Add elf_getshdrstrndx.3 and elf_getshstrndx.3

2025-07-08 Thread Mark Wielaard
Hi Aaron, On Mon, 2025-06-30 at 23:12 -0400, Aaron Merey wrote: > diff --git a/doc/Makefile.am b/doc/Makefile.am > index cf60a271..129c612d 100644 > --- a/doc/Makefile.am > +++ b/doc/Makefile.am > @@ -71,7 +71,9 @@ notrans_dist_man3_MANS= elf32_checksum.3 \ > elf_getphdrnum.3

Re: [PATCH 06/16] doc: Add elf_getshdrnum.3 and elf_getshnum.3

2025-07-08 Thread Mark Wielaard
Hi Aaron, On Mon, 2025-06-30 at 23:12 -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > doc/Makefile.am | 2 ++ > doc/elf_getshdrnum.3 | 76 > doc/elf_getshnum.3 | 1 + > 3 files changed, 79 insertions(+) > create mode 100644 do

Re: [PATCH 05/16] doc: Add elf_getphdrnum.3

2025-07-08 Thread Mark Wielaard
Hi Aaron, On Mon, 2025-06-30 at 23:12 -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > doc/Makefile.am | 1 + > doc/elf_getphdrnum.3 | 74 > 2 files changed, 75 insertions(+) > create mode 100644 doc/elf_getphdrnum.3 > > diff --g

Re: [PATCH 04/16] doc: Add elf_getident.3

2025-07-07 Thread Mark Wielaard
Hi Aaron, On Mon, Jun 30, 2025 at 11:12:21PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > doc/Makefile.am| 1 + > doc/elf_getident.3 | 89 ++ > 2 files changed, 90 insertions(+) > create mode 100644 doc/elf_getident.3 > > diff

Re: [PATCH 03/16] doc: Add elf_getdata_rawchunk.3

2025-07-07 Thread Mark Wielaard
Hi Aaron, On Mon, 2025-06-30 at 23:12 -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > doc/Makefile.am| 1 + > doc/elf_getdata_rawchunk.3 | 133 + > 2 files changed, 134 insertions(+) > create mode 100644 doc/elf_getdata_rawchunk.3

Re: [PATCH 02/16] doc: Add elf_flag*.3

2025-07-04 Thread Mark Wielaard
Hi Aaron, On Mon, Jun 30, 2025 at 11:12:19PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > doc/Makefile.am| 6 ++ > doc/elf_flagdata.3 | 1 + > doc/elf_flagehdr.3 | 1 + > doc/elf_flagelf.3 | 145 + > doc/elf_flagphdr.3 |

Re: [PATCH 01/16] doc: Add elf_memory.3

2025-07-04 Thread Mark Wielaard
Hi Aaron, On Mon, Jun 30, 2025 at 11:12:18PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > doc/Makefile.am | 1 + > doc/elf_memory.3 | 84 > 2 files changed, 85 insertions(+) > create mode 100644 doc/elf_memory.3 > > diff --gi

Re: [PATCH] libdwP.h: Remove abbrev_lock

2025-07-03 Thread Mark Wielaard
Hi Aaron, On Sun, 2025-06-22 at 20:00 -0400, Aaron Merey wrote: > Improve __libdw_dieabbrev performance by removing abbrev_lock. This > lock protects the Dwarf_Die abbrev member due to lazy loading. > > Instead, eagerly load abbrev during Dwarf_Die initialization so that > the member is readonly

Re: [PATCH 6/6] doc: Add elf_compress.3 and elf_compress_gnu.3

2025-07-03 Thread Mark Wielaard
Hi Aaron, On Sun, 2025-06-22 at 19:02 -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > doc/Makefile.am| 2 + > doc/elf_compress.3 | 183 + > doc/elf_compress_gnu.3 | 1 + > 3 files changed, 186 insertions(+) > create mode 100

Re: [PATCH 5/6] doc: Add elf_cntl.3

2025-07-03 Thread Mark Wielaard
Hi Aaron, On Sun, 2025-06-22 at 19:02 -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > doc/Makefile.am | 1 + > doc/elf_cntl.3 | 66 + > 2 files changed, 67 insertions(+) > create mode 100644 doc/elf_cntl.3 > > diff --git a/doc/Ma

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

2025-07-02 Thread Mark Wielaard
Hi Aaron, On Sun, Jun 29, 2025 at 11:51:58PM -0400, Aaron Merey wrote: > Implement concurrent execution of print_debug_* functions during handling > of -w, --debug-dump using libthread.a. > > A new `-C, --concurrency=NUM` command line option controls the maximum > number of threads that may be us

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

2025-07-02 Thread Mark Wielaard
Hi Aaron, On Sun, 2025-06-29 at 23:51 -0400, Aaron Merey wrote: > Add new internal static library libthread.a that provides infrastructure > for eu-* tools to run functions concurrently using pthreads. > > threadlib.c manages per-job threads as well as per-job buffers for stdout > output. Output

Re: [PATCH] readelf.c: Avoid repeating calls to gettext _() in hotpath

2025-07-02 Thread Mark Wielaard
Hi Aaron, On Sun, 2025-06-29 at 23:51 -0400, Aaron Merey wrote: > Calls to the gettext _() macro in hotpaths cause many runtime lookups > of the same translation strings. This patch introduces macro __() > which caches the result of _() at each call site where __() is used. > > When a cached tra

Re: [PATCH 2/3 v3] src/readelf.c: Add support for print_debug_* output buffering

2025-07-02 Thread Mark Wielaard
On Sun, 2025-06-29 at 23:51 -0400, Aaron Merey wrote: > Safely handle stdout output during concurrent calls to print_debug_* > functions. > > For any print_debug_* function and any function that could be called > from print_debug_* which also prints to stdout: add a FILE * argument > and replace a

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

2025-06-27 Thread Mark Wielaard
Hi Aaron, On Sun, Jun 22, 2025 at 07:02:06PM -0400, Aaron Merey wrote: > v2: Clarify that narsyms can be NULL and that the end of the > archive symbol table contains a special NULL entry. Looks good to me. Thanks, Mark>

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

2025-06-27 Thread Mark Wielaard
Hi Aaron, On Sun, Jun 22, 2025 at 07:02:05PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > > --- > v2 changes: clarify when changes to the parent archive descriptor > invalidate the return value. Change thread safety attribute to > MT-Unsafe race. So I think this describes the curren

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

2025-06-27 Thread Mark Wielaard
Hi Aaron, On Sun, Jun 22, 2025 at 07:02:04PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > > --- > v2: Clarify that the offset refers to the archive member header. > > > > +.SH RETURN VALUE > > > +Return the file offset, in bytes, of the archive member referred to by > > > +.IR elf .

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

2025-06-27 Thread Mark Wielaard
Hi Aaron, On Sun, Jun 22, 2025 at 07:02:03PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > > --- > v2: Clarify that elf_next is called with an archive member in order > to update the descriptor for the parent archive. Added a code example. Looks nice. Just two small questions below.

[COMMITTED] libdw: Add DEFAULT_INCLUDES to CHECK_DEF_FLAGS

2025-06-26 Thread Mark Wielaard
DEFAULT_INCLUDES includes -I. which is needed for compiling the testcases with -DMAIN_CHECK=1. This fixes make check after commit 76bd5f6bea9b "config: Adjust AM_CPPFLAGS for srcdir and .. path includes" * libdw/Makefile.am (CHECK_DEF_FLAGS): Add DEFAULT_INCLUDES. Signed-of

[COMMITTED] config: Adjust AM_CPPFLAGS for srcdir and .. path includes

2025-06-26 Thread Mark Wielaard
ed header files. * config/eu.am (AM_CPPFLAGS): Use -iquote for $(srcdir) and replace -I.. with -I$(abs_top_builddir). * libdw/libdwP.h: Include "libdw.h" and "dwarf.h" instead of the system headers and . https://sourceware.org/bugzilla/show_bu

[PATCH] libdwl: Add validate_strdata to limit Elf_Data d_size to valid strings.

2025-06-22 Thread Mark Wielaard
(validate_strdata): New function taking Elf_Data and restricting d_size to last zero char. (translate_offs): Call validate_strdata. (find_symtab): Likewise for both symstrdata and aux_symstrdata. https://sourceware.org/bugzilla/show_bug.cgi?id=33099 Signed-off-by: Mark

Re: [PATCH 4/4] doc: Add elf_getarsym.3

2025-06-17 Thread Mark Wielaard
Hi Aaron, On Mon, Jun 09, 2025 at 12:24:39PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > doc/Makefile.am| 1 + > doc/elf_getarsym.3 | 91 ++ > 2 files changed, 92 insertions(+) > create mode 100644 doc/elf_getarsym.3 > > diff

Re: [PATCH 3/4] doc: Add elf_getarhdr.3

2025-06-17 Thread Mark Wielaard
Hi Aaron, On Mon, Jun 09, 2025 at 12:24:38PM -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > doc/Makefile.am| 1 + > doc/elf_getarhdr.3 | 76 ++ > 2 files changed, 77 insertions(+) > create mode 100644 doc/elf_getarhdr.3 > > diff

Re: [PATCH 2/4] doc: Add elf_getaroff.3

2025-06-17 Thread Mark Wielaard
Hi Aaron, On Mon, 2025-06-09 at 12:24 -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > doc/Makefile.am| 1 + > doc/elf_getaroff.3 | 55 ++ > 2 files changed, 56 insertions(+) > create mode 100644 doc/elf_getaroff.3 > > diff --git a

Re: [PATCH 1/4] doc: Add elf_next.3

2025-06-17 Thread Mark Wielaard
Hi Aaron, On Mon, 2025-06-09 at 12:24 -0400, Aaron Merey wrote: > diff --git a/doc/Makefile.am b/doc/Makefile.am > index 1ced7858..fbfebfe0 100644 > --- a/doc/Makefile.am > +++ b/doc/Makefile.am > @@ -61,6 +61,7 @@ notrans_dist_man3_MANS= elf32_checksum.3 \ > elf_hash.3 \ >

Re: [PATCH 3/3 v2] src/readelf.c: Add support for print_debug_* output buffering

2025-06-06 Thread Mark Wielaard
Hi Aaron, On Thu, 2025-05-22 at 18:28 -0400, Aaron Merey wrote: > Safely handle stdout output during concurrent calls to print_debug_* > functions. > > For any print_debug_* function and any function that could be called > from print_debug_* which also prints to stdout: add a FILE * argument > an

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

2025-06-06 Thread Mark Wielaard
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/project/elfutils/patch/20250603012245.411580-1-ame...@redhat.com/ It does indeed. Thanks. Just one nitpick, feel free to igno

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

2025-06-05 Thread Mark Wielaard
Hi Aaron, On Tue, May 27, 2025 at 10:04:20AM -0400, Aaron Merey wrote: > Implement concurrent execution of print_debug_* functions during handling > of -w, --debug-dump using libthread.a. Do you intend to also enable this for other sections? > A new `-C, --concurrency=NUM` command line option co

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

2025-06-05 Thread Mark Wielaard
Hi Aaron, Part 2... On Thu, May 22, 2025 at 06:28:52PM -0400, Aaron Merey wrote: > +typedef enum { > + /* pthread_create has not been called. */ > + NOT_STARTED, > + > + /* pthread_create has been called. */ > + STARTED, > + > + /* The thread has finished running the job but has not been j

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

2025-06-05 Thread Mark Wielaard
Hi Aaron, On Thu, 2025-05-22 at 18:28 -0400, Aaron Merey wrote: > Add new internal static library libthread.a that provides infrastructure > for eu-* tools to run functions concurrently using pthreads. > > threadlib.c manages per-job threads as well as per-job buffers for stdout > output. Output

Re: [PATCH] doc: Update elf_begin.3

2025-06-04 Thread Mark Wielaard
Hi Aaron, On Mon, 2025-06-02 at 21:22 -0400, Aaron Merey wrote: > 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..c

[COMMITTED] elfutils_debian_amd64_builder use elfutils_factory_mua

2025-06-04 Thread Mark Wielaard
Debian stable only has valgrind 3.19.0 which doesn't have an openat2 syscall wrapper. This makes some elfutils tests fail under valgrind since it uses openat2 explicitly now. So switch the build factory to not use valgrind, but the gcc address (and undefined) sanitizer. --- builder/master.cfg | 2

[COMMITTED] unstrip: update unstripped_shnum when adding a new section

2025-06-03 Thread Mark Wielaard
If some section doesn't match between the stripped and unstripped file we invent a new one. Make sure to also update the shnum value. * src/unstrip.c (copy_elided_sections): Update unstripped_shnum. Signed-off-by: Mark Wielaard --- src/unstrip.c | 1 + 1 file changed, 1 insertion(+)

[COMMITTED] libcpu: riscv_disasm use 50 char mnebuf

2025-06-03 Thread Mark Wielaard
ions. Without we just use a few extra bytes on the stack (which aren't used afterwards, without any issue, even though it is technically UB). * libcpu/riscv_disasm.c (riscv_disasm): Extend char mnebuf array to 50. Signed-off-by: Mark Wielaard --- libcpu/riscv_disasm.c | 5 -

[COMMITTED] unstrip: exit early if there are no sections in the stripped file

2025-06-01 Thread Mark Wielaard
If there is only section zero that shouldn't count. Then we would still try to work on an empty set of sections and give an obscure error later. * src/unstrip.c (copy_elided_sections): Check stripped_shnum <= 1. Signed-off-by: Mark Wielaard --- src/unstrip.c | 2 +- 1 file ch

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

2025-05-31 Thread Mark Wielaard
__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_fde, but that function was deleted and never made public. So simplify thing

Re: [PATCH v3] libdw: Fix eu_search_tree TOCTOU bugs

2025-05-30 Thread Mark Wielaard
Hi Aaron, On Thu, May 29, 2025 at 05:44:32PM -0400, Aaron Merey wrote: > eu_tfind is used to facilitate lazy loading throughout libdw. > If a result is not found via eu_tfind, work is done to load > the result and cache it in an eu_search_tree. > > Some calls to eu_tfind allow for TOCTOU bugs. M

Re: [PATCH v2] libdw: Fix eu_search_tree TOCTOU bugs

2025-05-27 Thread Mark Wielaard
Hi Aaron, On Mon, May 19, 2025 at 03:10:30PM -0400, Aaron Merey wrote: > eu_tfind is used to facilitate lazy loading throughout libdw. > If a result is not found via eu_tfind, work is done to load > the result and cache it in an eu_search_tree. > > Some calls to eu_tfind allow for TOCTOU bugs. M

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

2025-05-27 Thread Mark Wielaard
Hi, On Tue, 2025-05-27 at 00:05 -0500, A. Wilcox wrote: > When an explicit type of long double is specified in the ELF > GNU_Power_ABI_FP attribute, elflint and friends were erroring out: > > section [36] '.gnu.attributes': offset 15: unrecognized GNU_Power_ABI_FP > attribute value 9 > > Ad

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

2025-05-20 Thread Mark Wielaard
Hi Aaron, On Mon, May 19, 2025 at 03:02:07PM -0400, Aaron Merey wrote: > handle_dynamic_symtab can attempt to read symbol and version data from > file offset of 0 or address of 0 if the associated DT_ tags aren't found. > > Fix this by only reading symbol and version data when non-zero file > off

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

2025-05-15 Thread Mark Wielaard
Hi Serhei, On Wed, 2025-05-14 at 16:35 -0400, Serhei Makarov wrote: > There's also the possibility of awk being powerful enough to make > me want to use it. Do you know if awk is considered sufficiently > standard for the testsuite to depend on it? We already check for GNU awk in configure for ma

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

2025-05-14 Thread Mark Wielaard
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 Wielaard wrote: > > > > > +.SH SEE ALSO > > > +.BR libelf (3), >

  1   2   3   4   5   6   7   8   9   10   >