Sourceware infrastructure updates for Q1 2025

2025-04-22 Thread Mark Wielaard
Sourceware infrastructure community updates for Q1 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 Over the last couple of years, Sourceware has transformed from a purely volu

scraperbot protection - Patchwork and Bunsen behind Anubis

2025-04-21 Thread Mark Wielaard
Hi hackers, TLDR; When using https://patchwork.sourceware.org or Bunsen https://builder.sourceware.org/testruns/ you might now have to enable javascript. This should not impact any scripts, just browsers (or bots pretending to be browsers). If it does cause trouble, please let us know. If this wor

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

2025-04-15 Thread Mark Wielaard
Hi Aaron, Hi Constantine, On Thu, 2025-04-10 at 10:52 -0400, Aaron Merey wrote: > handle_dynamic_symtab can attempt to read symbol and version data from > file offset 0 if the associated DT_ tags aren't found. > > Fix this by only reading symbol and version data when non-zero file > offsets have

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

2025-04-08 Thread Mark Wielaard
Hi Aaron, On Tue, Apr 08, 2025 at 01:34:28PM -0400, Aaron Merey wrote: > LGTM. The optional main function approach opens up a lot of > possibilities for testing static functions throughout all elfutils > libraries. I hope to use the same mechanism to write some fuzzing wrappers so you don't have

Re: [PATCH] Avoid double-including config.h

2025-04-06 Thread Mark Wielaard
Hi Dmitry, On Fri, Apr 04, 2025 at 04:07:26PM +0300, Dmitry V. Levin wrote: > On Fri, Apr 04, 2025 at 01:55:48PM +0200, Mark Wielaard wrote: > > So to be (pedantically) correct should we include the attached? > > Yes, this should be fine, along with > > --- a/lib/crc32.

Re: [PATCH 1/3] Add some supporting framework for C11-style atomics.

2025-04-06 Thread Mark Wielaard
Hi Dmitry, On Fri, Apr 04, 2025 at 04:04:21PM +0300, Dmitry V. Levin wrote: > On Fri, Apr 04, 2025 at 01:38:01PM +0200, Mark Wielaard wrote: > > But maybe we should just use AC_CHECK_HEADERS([stdatomic.h]) and drop > > the AC_COMPILE_IFELSE trick? > > Sure. And if we want

Re: [PATCH 1/1] debuginfod: add --http-addr option

2025-04-05 Thread Mark Wielaard
Hi Michael, On Thu, 2025-03-13 at 12:05 +0100, Michael Trapp wrote: > Use MHD_OPTION_SOCK_ADDR to bind the http listen socket to a single address. > The address can be any IPv4 or IPv6 address configured on the system: > --http-addr=127.0.0.1 > --http-addr=::1 > --http-addr='ANY_ACTIVE

Re: [PATCH 1/3] Add some supporting framework for C11-style atomics.

2025-04-04 Thread Mark Wielaard
Hi Dmitry, On Thu, 2025-04-03 at 19:09 +0300, Dmitry V. Levin wrote: > On Thu, Aug 29, 2019 at 03:16:12PM +0200, Mark Wielaard wrote: > > From: Jonathon Anderson > > > > Uses the stdatomic.h provided by FreeBSD when GCC doesn't (ie. GCC < 4.9) > > &

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

2025-04-04 Thread Mark Wielaard
Hi, On Fri, 2025-04-04 at 12:39 +, buil...@sourceware.org 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/403 > > Build state: failed tes

Re: [PATCH] Avoid double-including config.h

2025-04-04 Thread Mark Wielaard
> of including config.h twice for all files that include both > and "system.h". So to be (pedantically) correct should we include the attached? Thanks, Mark From f14c00adb24bf15059821ca972e5d20a58b893fa Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 4 Apr 2025 13:50:04 +02

Re: [PATCH v2] Add 'Key to Flags' to eu-readelf output [bz 29571]

2025-04-04 Thread Mark Wielaard
Hi Samuel, On Thu, 2025-04-03 at 17:24 +1000, Samuel Zeter wrote: > When printing section headers, also include a key to what each flag > is at the end of the section header output. > > Signed-off-by: Samuel Zeter Thanks, looks good. Committed with a slightly tweaked commit message: commit ef1

[PATCH] libdw: Add Nim language and dwarf_srclang tests

2025-04-02 Thread Mark Wielaard
CHECK. (main): Likewise. Signed-off-by: Mark Wielaard --- libdw/Makefile.am | 11 libdw/dwarf.h | 2 + libdw/dwarf_default_lower_bound.c | 2 + libdw/dwarf_srclang.c | 87 ++- 4 files changed, 101 insertions(

Re: [PATCH] debuginfod: add --listen-address option

2025-03-28 Thread Mark Wielaard
Hi Michael, On Thu, 2025-03-27 at 17:06 +0100, Michael Trapp wrote: > Use MHD_OPTION_SOCK_ADDR to bind the http listen socket to a single address. > The address should be an IPv4 or IPv6 address configured on the system: > --listen-address=127.0.0.1 > --listen-address=::1 > --listen-ad

Re: Sourceware Survey 2025

2025-03-28 Thread Mark Wielaard
On Fri, Mar 14, 2025 at 01:40:42AM +0100, Mark Wielaard wrote: > The Sourceware Project Leadership Committee would like to know who our > users are, which hosted projects they feel part of, what services they > rely on and what the priorities should be for new initiatives. &

Re: [PATCH] debuginfod: add --listen-address option

2025-03-27 Thread Mark Wielaard
Hi Michael, On Thu, Mar 27, 2025 at 04:43:49PM +0100, Michael Trapp wrote: > Use MHD_OPTION_SOCK_ADDR to bind the http listen socket to a single address. > The address should be an IPv4 or IPv6 address configured on the system: > --listen-address=127.0.0.1 > --listen-address=::1 > --li

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

2025-03-27 Thread Mark Wielaard
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 TOCTOU bug in __libdw_findcu that causes NULL to be > incorrectly returned. Could you explain what the issue is in a few

[COMMITTED] tests/thread-safety-subr.sh: Change if [[ ]] to if [ ]

2025-03-26 Thread Mark Wielaard
Using [[ is a bashism. We can just use [ since this is a simple comparision. * tests/thread-safety-subr.sh: Use if [ instead of if [[. Signed-off-by: Mark Wielaard --- tests/thread-safety-subr.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/thread-safety

Re: [PATCH 1/1] debuginfod: add --http-addr option

2025-03-26 Thread Mark Wielaard
Hi Michael, On Thu, Mar 20, 2025 at 02:58:34PM +, Trapp, Michael wrote: > > Am 19.03.2025 um 13:35 schrieb Mark Wielaard : > > The code itself does look ok, although I think it could be simplified a > > little if we go for something like --listen-local only (assuming th

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

2025-03-26 Thread Mark Wielaard
Hi Aaron, On Sun, 2025-03-16 at 21:51 -0400, Aaron Merey wrote: > * libdw/dwarf_end.c (cu_free): Free str_off_base_lock. > * libdw/libdwP.h (struct Dwarf_CU): Add str_off_base_lock member. > (str_offsets_base_off): Add locking. > * libdw/libdw_findcu.c (__libdw_intern_next_

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

2025-03-26 Thread Mark Wielaard
Hi Aaron, On Sun, 2025-03-16 at 21:51 -0400, Aaron Merey wrote: > * libdw/dwarf_begin_elf.c (dwarf_begin_elf): Init macro_lock. > * libdw/dwarf_end.c (cu_free): Free src_lock. > (dwarf_end): Free macro_lock. > * libdw/dwarf_getsrcfiles.c (dwarf_getsrcfiles): Use src_lock. >

Re: [PATCH 05/13] libdwfl [5/13]: introduce Dwfl_Process_Tracker

2025-03-20 Thread Mark Wielaard
Hi Serhei, On Sun, 2025-03-16 at 19:14 -0400, Serhei Makarov wrote: > New data structure to coordinate caching Elf data among multiple Dwfl > structs attached to different processes. Meant to reduce the overhead > for profilers that use elfutils for unwinding. > > The caching is well-justified, a

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

2025-03-20 Thread Mark Wielaard
Hi Serhei, On Sun, Mar 16, 2025 at 07:13:00PM -0400, Serhei Makarov wrote: > Renaming to dwfl_set_initial_registers_thread. > > This callback was private to one file, but now that other > tools (eu-stacktrace, sysprof via the dwfl_perf_sample_getframes) are > invoking the ebl set_initial_register

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

2025-03-19 Thread Mark Wielaard
Hi Serhei, 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 wrapping the libebl perf register handling. In > this patch, add an interface to access the preferred set of registers > that

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

2025-03-19 Thread Mark Wielaard
Hi Serhei, On Sun, Mar 16, 2025 at 07:13:41PM -0400, Serhei Makarov wrote: > Change the sample_set_initial_registers callback in eu-stacktrace to > use the proper libebl ebl_set_initial_registers_sample function. > > * src/Makefile.am (stacktrace_LDADD): Add libebl. > * src/stacktrace.c (sample_r

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

2025-03-19 Thread Mark Wielaard
Hi Serhei, On Sun, 2025-03-16 at 19:12 -0400, Serhei Makarov wrote: > First patch of a series that reworks eu-stacktrace functionality > into a library interface for other profiling tools. > > * * * > > As it happens, Linux perf_events and DWARF can prescribe completely > different layouts for t

Re: Question about elf symbol's file offset

2025-03-19 Thread Mark Wielaard
Hi Hengqi, On Tue, 2025-03-11 at 13:27 +0800, Hengqi Chen wrote: > I want to ask you a question regarding elf internals. > How to calculate a symbol's file offset (which is kernel uprobe expects) > in an elf (executable or shared object)? Could you point me to a description of what uprobe expects

Re: [PATCH] Add 'Key to Flags' to eu-readelf output [bz 29571]

2025-03-19 Thread Mark Wielaard
Hi Samuel, On Mon, 2025-03-17 at 17:39 +1000, Samuel Zeter wrote: > When printing section headers, also include a key to what each flag > is at the end of the section header output. Did you run make check after your patch? It seems various tests fail because they aren't expecting the new flag inf

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

2025-03-18 Thread Mark Wielaard
Hi Serhei, On Mon, 2025-03-17 at 10:22 -0400, Serhei Makarov wrote: > On Sun, Mar 16, 2025, at 7:12 PM, Serhei Makarov wrote: > > +bool > > +x86_64_set_initial_registers_sample (const Dwarf_Word *regs, uint32_t > > n_regs, > > +uint64_t regs_mask, uint32_t abi, > >

Sourceware Survey 2025

2025-03-15 Thread Mark Wielaard
The Sourceware Project Leadership Committee would like to know who our users are, which hosted projects they feel part of, what services they rely on and what the priorities should be for new initiatives. https://nextcloud.sfconservancy.org/apps/forms/s/xmGgmJFzSb2FZNd58cXMtAZp The survey will ru

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

2025-03-15 Thread Mark Wielaard
. * tests/Makefile.am (check_PROGRAMS): Add dwarf_language_lower_bound. (TESTS): Likewise. (dwarf_language_lower_bound_LDADD): New variable. Signed-off-by: Mark Wielaard --- NEWS | 2 + libdw/dwarf_aggregate_size.c | 8 +- libdw

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

2025-03-11 Thread Mark Wielaard
. (dwarf_srclang): If there is no DW_AT_language, try DW_AT_language_name and DW_AT_language_version, use language_to_srclang. Signed-off-by: Mark Wielaard --- libdw/dwarf_srclang.c | 221 +- 1 file changed, 218 insertions(+), 3 deletions

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

2025-03-11 Thread Mark Wielaard
dwarf_lname_name. * run-readelf-lnames.sh: New test. * testfile-lnames.bz2: New testfile. * tests/Makefile.am (TESTS): Add run-readelf-lnames.sh. (EXTRA_DIST): Add run-readelf-lnames.sh and testfile-lnames.bz2. Signed-off-by: Mark Wielaard --- libdw/dwarf.h

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

2025-03-11 Thread Mark Wielaard
-dwarf.awk: Handle DW_LNAME. * libdw/dwarf.h: Add DW_AT_language_name and DW_AT_language_version plus all currently defined DW_LNAME constants. Add DW_LANG_V and DW_LANG_Algol68. * libdw/dwarf_default_lower_bound.c: Add DW_LANG_V and DW_LANG_Algol68. Signed-off-by: Mark Wielaard

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

2025-02-28 Thread Mark Wielaard
Hi Aaron, On Wed, Feb 19, 2025 at 11:36:39PM -0500, Aaron Merey wrote: > Like --enable-valgrind but uses helgrind instead of memcheck. > > If both --enable-valgrind and --enable-helgrind are given then > helgrind takes priority. > > --enable-helgrind requires --enable-valgrind-annotations. > >

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

2025-02-28 Thread Mark Wielaard
Hi Frank, On Thu, 2025-02-27 at 18:47 -0500, Frank Ch. Eigler wrote: > > We should make dwarf_getsrcfiles and dwarf_getsrclines independent so > > callers that onle need the file table don't need to "pay" for parsing > > the whole line table. (I thought we had a bug for that, but cannot > > find i

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

2025-02-27 Thread Mark Wielaard
Hi Aaron, On Wed, Feb 19, 2025 at 11:36:38PM -0500, Aaron Merey wrote: > * libdw/dwarf_end.c (cu_free): Free str_off_base_lock. > * libdw/libdwP.h (struct Dwarf_CU): Add str_off_base_lock member. > (str_offsets_base_off): Add locking. > * libdw/libdw_findcu.c (__libdw_inter

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

2025-02-27 Thread Mark Wielaard
e dwarf_macro_getsrclines locking added in this patch. That makes sense. > On Wed, Feb 12, 2025 at 8:17 AM Mark Wielaard wrote: > > > > Hi Aaron, > > > > On Tue, 2025-02-04 at 16:50 -0500, Aaron Merey wrote: > > >       * libdw/dwarf_getsrcfiles.

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

2025-02-27 Thread Mark Wielaard
Hi Aaron, On Wed, Feb 19, 2025 at 11:36:36PM -0500, Aaron Merey wrote: > Change type of dwarf_lock to mutex in order to take advantage of > built-in support for recursive locking. > > * lib/locks.h: Add macros for locking, unlocking, initializing > and destroying mutexes. > * li

Re: [PATCH] src: fix DEREF_OF_NULL.RET.STAT in unstrip.c

2025-02-27 Thread Mark Wielaard
Hi Anton, On Thu, Feb 13, 2025 at 08:19:44PM +0300, Anton Moryakov wrote: > Static analyzer reported: > Return value of a function 'elf_getdata' is dereferenced at unstrip.c:1977 > without checking for NULL, but it is usually checked for this function > (97/101). > > Corrections explained: > - A

Re: [PATCH] src: fix DEREF_OF_NULL.RET.STAT in readelf.c in

2025-02-27 Thread Mark Wielaard
Hi Anton, On Thu, Feb 13, 2025 at 07:52:00PM +0300, Anton Moryakov wrote: > Static analyzer reported: > Return value of a function 'gelf_getehdr' is dereferenced at readelf.c:12443 > without checking for NULL, but it is usually checked for this function > (53/54). I can see how a static analyzer

Re: [PATCH] src: fix DEREF_OF_NULL.RET.STAT in readelf.c in

2025-02-27 Thread Mark Wielaard
rk >From dfa7b2c23ddabcba2a4972fa67d3c670ae31f1ee Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 27 Feb 2025 21:22:49 +0100 Subject: [PATCH] readelf: Use section_name instead of elf_strptr in print_debug_frame_section All other print_debug_* functions use section_name (ebl, shdr) t

Re: [PATCH] src: fix DEREF_OF_NULL.RET in readelf.c

2025-02-27 Thread Mark Wielaard
Hi Anton, On Thu, 2025-02-13 at 18:57 +0300, Anton Moryakov wrote: > Report of the static analyzer: > DEREF_OF_NULL.RET Pointer, returned from function 'elf_getarhdr' at > readelf.c:13551, > may be NULL and is dereferenced at readelf.c:13553. > > Corrections explained: > - Added a NULL check fo

Re: [PATCH] scr: fix DEREF_OF_NULL.RET.STAT in ar.c

2025-02-27 Thread Mark Wielaard
Hi Anton, The subject isn't super helpful unless you know the specific terminology of the statuc analyzer you are using. It would be better to say something like: ar: check whether elf_getarhdr returns NULL On Thu, 2025-02-13 at 18:00 +0300, Anton Moryakov wrote: > Report of the static analyze

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

2025-02-23 Thread Mark Wielaard
st-manyfuncs.sh: Likewise. * tests/test-manyfuncs.c: New test. Signed-off-by: Mark Wielaard --- libelf/elf32_getshdr.c | 14 -- libelf/elf_begin.c | 26 --- libelf/elf_scnshndx.c| 52 - libelf/libelf.h | 9 +- libelf/libelfP.h

Re: [PATCH] aarch64: define struct user_pac_mask if needed

2025-02-23 Thread Mark Wielaard
Hi Markus, On Fri, Feb 21, 2025 at 11:19:34AM -0800, Markus Mayer wrote: > On Aarch64, Linux is using Pointer Authentication Code (PAC) for pointer > authentication.[1] The struct "user_pac_mask" has been part of the Linux > kernel since version 5.0 as part of this feature. However, older kernels

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

2025-02-23 Thread Mark Wielaard
Hi, On Thu, Feb 20, 2025 at 08:18:15PM +, buil...@sourceware.org wrote: > A new failure has been detected on builder elfutils-snapshots-coverage while > building elfutils. > > Full details are available at: > https://builder.sourceware.org/buildbot/#/builders/250/builds/210 > > Build st

Re: [obv] [patch] debuginfod-client memory hygiene

2025-02-23 Thread Mark Wielaard
Hi Frank, On Thu, Feb 20, 2025 at 02:18:04PM -0500, Frank Ch. Eigler wrote: > > [...] > > This does sounds like a bug in glibc sscanf. I cannot find a > > description of what exactly happens with 'm' modifier allocated > > buffers on error. So I can imagine a double free if sscanf frees the > > bu

[COMMITTED] elfutils_[try_]fedora_s390x_builder: Don't use valgrind factory

2025-02-22 Thread Mark Wielaard
One of the (libcurl) libraries tries to close invalid file descriptors on fedora s390. Skip running the testsuite under valgrind for now. --- builder/master.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builder/master.cfg b/builder/master.cfg index 0ccd23df9800..7a55e

Re: [obv] [patch] debuginfod-client memory hygiene

2025-02-19 Thread Mark Wielaard
Hi Frank, On Tue, Feb 18, 2025 at 10:30:44PM -0500, Frank Ch. Eigler wrote: > Planning to commit this shortly: > > commit a71bac67f4705b84368b71f5ece54deedaa1abf1 (HEAD -> master1) > Author: Frank Ch. Eigler > Date: Tue Feb 18 22:09:12 2025 -0500 > > debuginfod-client: correct invalid fre

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

2025-02-14 Thread Mark Wielaard
Hi Aaron, On Thu, Feb 13, 2025 at 03:35:03PM -0500, Aaron Merey wrote: > 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 > > un

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

2025-02-13 Thread Mark Wielaard
kes a message string to display. (INTERNAL_ERROR): Use INTERNAL_ERROR_MSG with elf_errmsg (-1). (remove_debug_relocations): Check the sh_link referenced section is real and isn't a SHT_NOBITS section. https://sourceware.org/bugzilla/show_bug.cgi?id=32673 Signed-of

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

2025-02-12 Thread Mark Wielaard
d yet. * libelf/elf_strptr.c (elf_strptr): Check strscn->rawdata_base is not NULL. https://sourceware.org/bugzilla/show_bug.cgi?id=32672 Signed-off-by: Mark Wielaard --- libelf/elf_strptr.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libelf/elf_

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

2025-02-12 Thread Mark Wielaard
Hi Aaron, On Tue, 2025-02-04 at 16:50 -0500, Aaron Merey wrote: > 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.

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

2025-02-12 Thread Mark Wielaard
Hi Aaron, On Tue, 2025-02-04 at 16:50 -0500, Aaron Merey wrote: > Like --enable-valgrind but uses helgrind instead of memcheck. > > If both --enable-valgrind and --enable-helgrind are given then > helgrind takes priority. > > --enable-helgrind requires --enable-valgrind-annotations. > > *

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

2025-02-12 Thread Mark Wielaard
Hi Aaron, On Tue, 2025-02-04 at 16:50 -0500, Aaron Merey wrote: > * 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_findcu already has internal locking. Isn't that enough? > l

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

2025-02-12 Thread Mark Wielaard
Hi Aaron, On Tue, 2025-02-04 at 16:50 -0500, Aaron Merey wrote: > * 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

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

2025-02-12 Thread Mark Wielaard
Hi Aaron, On Tue, 2025-02-04 at 16:50 -0500, Aaron Merey wrote: > * 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-

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

2025-02-12 Thread Mark Wielaard
On Tue, 2025-02-04 at 16:50 -0500, Aaron Merey wrote: > Change type of dwarf_lock to mutex in order to take advantage of > built-in support for recursive locking. > > * lib/locks.h: Add macros for locking, unlocking, initializing > and destroying mutexes. > * libdw/dwarf_begin_el

Re: [PATCH] src: fix DEREF_AFTER_NULL.EX in elflint.c

2025-02-11 Thread Mark Wielaard
Hi Anton, On Mon, 2025-02-03 at 14:45 +0100, Mark Wielaard wrote: > So the code path where prefix != NULL also implies suffix != NULL. > > Maybe the code needs a comment, check or assert to verify this? I added an assert. Pushed, Mark From 316077dd4b34c90f7e4c4228395a580e99239347 M

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

2025-02-10 Thread Mark Wielaard
x27;t try to gnu decompress a section without a name. (print_string_section): Likewise. https://sourceware.org/bugzilla/show_bug.cgi?id=32656 Signed-off-by: Mark Wielaard --- src/readelf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/readelf.c b/src/readelf.c

[PATCH] readelf: Handle NULL phdr in handle_dynamic_symtab

2025-02-10 Thread Mark Wielaard
gelf_getphdr returns NULL. https://sourceware.org/bugzilla/show_bug.cgi?id=32655 Signed-off-by: Mark Wielaard --- src/readelf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/readelf.c b/src/readelf.c index c43fda35075a..21b92a08a6b6 100644 --- a/src/readelf.c +++ b

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

2025-02-10 Thread Mark Wielaard
://sourceware.org/bugzilla/show_bug.cgi?id=32654 Signed-off-by: Mark Wielaard --- lib/system.h| 27 +++ libelf/elf_strptr.c | 18 -- src/readelf.c | 18 +++--- 3 files changed, 42 insertions(+), 21 deletions(-) diff --git a/lib/system.h b/lib

[PATCH] libdw: Simplify __libdw_getabbrev and fix dwarf_offabbrev issue

2025-02-10 Thread Mark Wielaard
abbrev into abbrevp on success. * libdw/libdw.h (dwarf_offabbrev): Document return values. * libdw/libdwP.h (__libdw_getabbrev): Don't take Dwarf_Abbrev result argument. https://sourceware.org/bugzilla/show_bug.cgi?id=32650 Signed-off-by: Mark Wielaard --- libdw/dw

Re: [PATCH] libelf: fix DEREF_OF_NULL.RET in objdump.c

2025-02-07 Thread Mark Wielaard
Hi Anton, I changed the indention from using spaces to tabs and rewrote the subject line to better explain the change. Pushed as attached. Thanks, Mark >From 6c76ce7331e82a6fc6c2004e8e6ae51ca91f51d7 Mon Sep 17 00:00:00 2001 From: Anton Moryakov Date: Wed, 5 Feb 2025 00:50:23 +0300 Subject: [P

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

2025-02-07 Thread Mark Wielaard
Hi Aaron, On Tue, Feb 04, 2025 at 05:00:21PM -0500, Aaron Merey wrote: > On Mon, Feb 3, 2025 at 8:36 AM Mark Wielaard wrote: > > So I don't think close should be called unconditionally. Maybe the > > correct solution is to do if (!close_fd) close (fd); after elf_end?

Re: [PATCH] libelf: fix DEREF_OF_NULL.RET in objdump.c

2025-02-03 Thread Mark Wielaard
Hi Anton, On Sat, Feb 01, 2025 at 02:21:24AM +0300, Anton Moryakov wrote: > Report of the static analyzer: > Pointer, returned from function 'elf_getarhdr' at > objdump.c:314, may be NULL and is dereferenced at > objdump.c:317. (CWE476, CWE690) Nice catch. > Corrections explained: > When process

Re: [PATCH] libdwfl: fix DEREF_OF_NULL.EX in dwfl_segment_report_module.c

2025-02-03 Thread Mark Wielaard
Hi Anton, On Sat, Feb 01, 2025 at 02:10:03AM +0300, Anton Moryakov wrote: > Report of the static analyzer: > After having been assigned to a NULL value at > dwfl_segment_report_module.c:187, pointer 'retval' is > dereferenced at dwfl_segment_report_module.c:195 by > calling function 'strcmp'. (CWE

Re: [PATCH] libdw: fix DEREF_AFTER_NULL.EX in dwarf_ranges.c

2025-02-03 Thread Mark Wielaard
Hi Anton, On Sat, Feb 01, 2025 at 01:56:34AM +0300, Anton Moryakov wrote: > Report of the static analyzer: > After having been compared to a NULL value at > dwarf_ranges.c:492, pointer 'd' is dereferenced at > dwarf_ranges.c:531. (CWE476) But there is a lot of code between those points. On line

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

2025-02-03 Thread Mark Wielaard
Hi Aaron, On Thu, Jan 30, 2025 at 09:35:54PM -0500, Aaron Merey wrote: > 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. These all look correct to me. Could you commit this before enabling valgrind

Re: [PATCH] src: fix DEREF_AFTER_NULL.EX in elflint.c

2025-02-03 Thread Mark Wielaard
Hi Anton, On Sat, Feb 01, 2025 at 01:43:44AM +0300, Anton Moryakov wrote: > Report of the static analyzer: > After having been compared to a NULL value at > elflint.c:252, pointer 'suffix' is dereferenced at elflint.c:260 > by calling function 'stpcpy' > > Corrections explained: > When processing

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

2025-02-03 Thread Mark Wielaard
Hi Aaron, On Thu, Jan 30, 2025 at 09:35:53PM -0500, Aaron Merey wrote: > 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. I thi

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

2025-02-03 Thread Mark Wielaard
Hi Aaron, On Thu, Jan 30, 2025 at 09:35:52PM -0500, Aaron Merey wrote: > valgrind --track-fds=yes might incorrectly report an error due to the use > of inherited file descriptors in check_native_core. Note that this fixed upstream by commit 9f0e4107c140b47ea2a9c097afcac73a8454e17f https://bugs.kd

Re: [PATCH 2/5] libdwfl/offline.c: Avoid closing invalid fd

2025-02-03 Thread Mark Wielaard
Hi Aaron, On Thu, Jan 30, 2025 at 09:35:51PM -0500, Aaron Merey wrote: > process_archive may be called with an fd argument of -1, which > libelf interprets as "no file opened". However when closing > the fd process_archive does not check whether the fd is valid > and may attempt to close an fd of

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

2025-02-03 Thread Mark Wielaard
Hi Aaron, On Thu, Jan 30, 2025 at 09:35:50PM -0500, Aaron Merey wrote: > `valgrind --track-fds=yes` will report errors for file descriptor leaks > and attempts at closing invalid file descriptors. This looks good to me, but could we apply the patches in "reverse" order so we don't get test failur

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

2025-02-03 Thread Mark Wielaard
.c: New file. > * tests/run-eu-search-macros.sh: New file. > > Signed-off-by: Heather S. McIntyre > Signed-off-by: Aaron Merey > Signed-off-by: Mark Wielaard > --- > v5 changes: pthread added to eu_search_macros_LDFLAGS unconditionally. > Add missing error exit to thread_work. Looks good. Thanks, Mark

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

2025-02-03 Thread Mark Wielaard
d-off-by: Heather S. McIntyre > Signed-off-by: Aaron Merey > Signed-off-by: Mark Wielaard > --- > v5 changes: pthread added to eu_search_cfi_LDFLAGS unconditionally. This looks good. Thanks, Mark

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

2025-02-03 Thread Mark Wielaard
-off-by: Heather S. McIntyre > Signed-off-by: Aaron Merey > Signed-off-by: Mark Wielaard > --- > v5 changes: pthread added to eu_search_die_LDFLAGS unconditionally. Looks good. Thanks, Mark

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

2025-02-03 Thread Mark Wielaard
* 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-off-by: Mark Wielaard >

Re: [PATCH] stacktrace: Add missing locale.h

2025-01-30 Thread Mark Wielaard
On Thu, Jan 30, 2025 at 11:05:20AM +, parona wrote: > > Could you show the configure/build flags and the error the compiler > > gives? I think the patch is correct, but I have trouble replicating > > the issue. > > export CFLAGS="-O0 -pipe" > autoreconf -fi > ./configure --enable-stacktrace --

Re: [PATCH] stacktrace: Add missing locale.h

2025-01-30 Thread Mark Wielaard
Hi, On Thu, Jan 30, 2025 at 12:05:59AM +, parona wrote: > While building elfutils on musl with different features enabled I > hit this. > > Curiously this also affects glibc if you explicitly build without > optimizations. Could you show the configure/build flags and the error the compiler gi

Re: [PATCH] Link against standalone error library if available

2025-01-29 Thread Mark Wielaard
Hi, On Wed, Jan 29, 2025 at 07:57:37AM +, parona wrote: > On Monday, January 27th, 2025 at 10:40 PM, Mark Wielaard > wrote: > > So maybe our configure check is wrong and it should just test whether > > there is an error.h but also if you can link the result? > > In

Re: [PATCH] Link against standalone error library if available

2025-01-27 Thread Mark Wielaard
Hi, On Mon, Jan 27, 2025 at 05:23:15AM +, parona wrote: > Background for this patch is https://bugs.gentoo.org/948878 where > are user had installed a standalone error implementation for a > different package leading to a build failure. There is also some discussion in this elfutils bug: http

Re: [PATCH] src/readelf.c: Close skel_fd

2025-01-25 Thread Mark Wielaard
Hi Aaron, On Fri, Jan 24, 2025 at 08:32:58PM -0500, Aaron Merey wrote: > skel_fd is passed to create_dwfl, which calls dup() on skel_fd. > create_dwfl handles closing the dup'ed fd but not the original. > > Ensure the original skel_fd is closed after it's passed to create_dwfl. Nice find. We sh

Re: [PATCH] debuginfod-client.c: Avoid freeing uninitialized value

2025-01-25 Thread Mark Wielaard
Hi Aaron, On Fri, Jan 24, 2025 at 08:32:48PM -0500, Aaron Merey wrote: > debuginfod_validate_imasig might call free on an uninitialized sig_buf > due to a goto that can occur before sig_buf is set to NULL. > > Fix this by setting sig_buf to NULL before the goto. The first thing after exit_valida

Re: [PATCH 04/15] dwarf_getsrcfiles.c: Add locking

2025-01-24 Thread Mark Wielaard
Hi Aaron, On Thu, Jan 23, 2025 at 09:15:10PM -0500, Aaron Merey wrote: > > On Sun, Jan 19, 2025 at 10:20:30PM -0500, Aaron Merey wrote: > > > res = __libdw_getsrcfiles (cu->dbg, debug_line_offset, > > >__libdw_getcompdir (cudie), > > > > So is the lock t

Re: [PATCH 15/15 v4] Add tests/run-eu-search-die.sh

2025-01-24 Thread Mark Wielaard
Hi Aaron, On Sun, 2025-01-19 at 22:20 -0500, Aaron Merey wrote: > 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:

Re: [PATCH 02/15] Change type of dwarf_lock from rwlock to mutex

2025-01-24 Thread Mark Wielaard
Hi Aaron, On Thu, 2025-01-23 at 21:13 -0500, Aaron Merey wrote: > > > If performance suffers too much from serializing all accesses to Dwarf > > > objects, we could instead consider using an rwlock with a custom wrapper > > > that implements recursive locking. > > > > We could also use multiple l

Re: [PATCH 14/15 v4] Add tests/run-eu-search-lines.sh

2025-01-24 Thread Mark Wielaard
Hi Aaron, On Sun, 2025-01-19 at 22:20 -0500, Aaron Merey wrote: > From: Heather McIntyre > > * 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

Re: [PATCH 13/15 v4] Add tests/run-eu-search-macros.sh

2025-01-24 Thread Mark Wielaard
Hi Aaron, On Sun, 2025-01-19 at 22:20 -0500, Aaron Merey wrote: > From: Heather McIntyre > > * 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-

Re: [PATCH 12/15 v4] Add tests/run-eu-search-cfi.sh

2025-01-24 Thread Mark Wielaard
Hi Aaron, On Sun, 2025-01-19 at 22:20 -0500, Aaron Merey wrote: > 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 f

Re: [PATCH 11/15] Add tests/thread-safety-subr.sh

2025-01-24 Thread Mark Wielaard
Hi Aaron, On Sun, 2025-01-19 at 22:20 -0500, Aaron Merey wrote: > thread-safety-subr.sh contains subroutine check_thread_safety_enabled > which skips further testing when either USE_LOCKS is false or when > attempting to use valgrind with address or memory sanitizer enabled. > > * tests/Mak

Re: [PATCH 10/15] Add configure option --enable-helgrind

2025-01-24 Thread Mark Wielaard
Hi Aaron, On Sun, 2025-01-19 at 22:20 -0500, Aaron Merey wrote: > Like --enable-valgrind but uses helgrind instead of memcheck. If both > --enable-valgrind and --enable-helgrind are given then helgrind takes > priority. > > * configure.ac: Add --enable-helgrind option. > * tests/Make

Re: [PATCH 09/15] dwarf_onesrcline.c: Add locking

2025-01-22 Thread Mark Wielaard
Hi Aaron, On Sun, Jan 19, 2025 at 10:20:35PM -0500, Aaron Merey wrote: > * libdw/dwarf_onesrcline.c (dwarf_onesrcline): Use dwarf_lock. Is this really necessary? When the user calls dwarf_onesrcline wouldn't they already have a fully setup Dwarf_Lines? Can it still change concurrently? > S

Re: [PATCH 08/15] dwarf_offdie.c: Add locking

2025-01-22 Thread Mark Wielaard
Hi Aaron, On Sun, Jan 19, 2025 at 10:20:34PM -0500, Aaron Merey wrote: > * libdw/dwarf_offdie.c (__libdw_offdie): Use dwarf_lock. What exactly is "protected" here? If it is just the __libdw_findcu call, then it seems the lock is too wide/early. It could just be taken just before that call,

Re: [PATCH 07/15] dwarf_lineaddr.c: Add locking

2025-01-22 Thread Mark Wielaard
Hi Aaron, On Sun, Jan 19, 2025 at 10:20:33PM -0500, Aaron Merey wrote: > * libdw/dwarf_lineaddr.c (dwarf_lineaddr): Use dwarf_lock. Why is this necessary? It seems this function can only be called with a known/setup Dwarf_Line. Can it be concurrently changes at this point? > Signed-off-by

Re: [PATCH 06/15] Add Dwarf member to Dwarf_Lines and Dwarf_Files

2025-01-22 Thread Mark Wielaard
Hi Aaron, On Sun, Jan 19, 2025 at 10:20:32PM -0500, Aaron Merey wrote: > * libdw/dwarf_getsrclines.c (read_srcfiles): Initialize dbg > member. > * libdw/libdwP.h (struct Dwarf_Files_s): Add Dwarf member. > (struct Dwarf_Lines_s): Ditto. Right, this is what you use in earli

Re: [PATCH 04/15] dwarf_getsrcfiles.c: Add locking

2025-01-22 Thread Mark Wielaard
Hi Aaron, On Sun, Jan 19, 2025 at 10:20:30PM -0500, Aaron Merey wrote: > * libdw/dwarf_getsrcfiles.c (dwarf_getsrcfiles): Use dwarf_lock. > > --- > libdw/dwarf_getsrcfiles.c | 11 +++ > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/libdw/dwarf_getsrcfiles.c b/lib

Re: [PATCH 05/15] dwarf_getsrclines.c: Add locking

2025-01-22 Thread Mark Wielaard
On Sun, Jan 19, 2025 at 10:20:31PM -0500, Aaron Merey wrote: > * libdw/dwarf_getsrclines.c (dwarf_getsrclines): Use dwarf_lock. So same lock used for getting/setting Dwarf_Lines. It is a little unfortunate that lines and files table reading is so intertwined. I understand why you use the sa

Re: [PATCH 03/15] dwarf_filesrc.c: Add locking

2025-01-22 Thread Mark Wielaard
On Sun, Jan 19, 2025 at 10:20:29PM -0500, Aaron Merey wrote: > * libdw/dwarf_filesrc.c (dwarf_filesrc): Use dwarf_lock. I didn't got this patch till I saw 06/15 Add Dwarf member to Dwarf_Lines and Dwarf_Files. So this patch should at least come after that. In general I find it a little diff

Re: [PATCH 02/15] Change type of dwarf_lock from rwlock to mutex

2025-01-22 Thread Mark Wielaard
Hi Aaron, On Sun, Jan 19, 2025 at 10:20:28PM -0500, Aaron Merey wrote: > Change type of dwarf_lock to mutex in order to take advantage of > built-in support for recursive locking. When/where do we need recursive locking? > * lib/locks.h: Add macros for locking, unlocking, initializing >

  1   2   3   4   5   6   7   8   9   10   >