[Bug general/33103] elfutils fails in-tree build due to ./stack binary #included via

2025-06-26 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=33103 --- Comment #6 from Mark Wielaard --- Note that a followup commit was necessary to fix building one testcase that broke make check: commit 65d383a7e653524388ff2ea382be3eac1d04061f (HEAD -> main) Author: Mark Wielaard Date: Thu Jun 26

[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

[Bug general/33103] elfutils fails in-tree build due to ./stack binary #included via

2025-06-26 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=33103 Mark Wielaard changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution

[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

[Bug general/33103] elfutils fails in-tree build due to ./stack binary #included via

2025-06-25 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=33103 --- Comment #3 from Mark Wielaard --- I don't understand why this is only a problem with srcdir == builddir. But maybe we can extend the original solution to use -iquote for srcdir. And only have -I for lib and the top builddir (for )?

[Bug general/33103] elfutils fails in-tree build due to ./stack binary #included via

2025-06-24 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=33103 Mark Wielaard changed: What|Removed |Added CC||mark at klomp dot org --- Comment #1

[Bug libelf/33099] heap overflow in print_dwarf_addr

2025-06-24 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=33099 Mark Wielaard changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution

[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

[Bug libelf/33099] heap overflow in print_dwarf_addr

2025-06-22 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=33099 Mark Wielaard changed: What|Removed |Added Status|NEW |ASSIGNED --- Comment #4 from Mark

[Bug libelf/33099] heap overflow in print_dwarf_addr

2025-06-20 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=33099 Mark Wielaard changed: What|Removed |Added CC||mark at klomp dot org

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 \ >

[Bug tools/33062] speed up readelf default (not -N) symbol resolution

2025-06-06 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=33062 Mark Wielaard changed: What|Removed |Added CC||mark at klomp dot org --- Comment #1

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

2025-06-06 Thread Mark Wielaard
r) > static void > print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest, > unsigned int vers, unsigned int addrsize, unsigned int offset_size, > -struct Dwarf_CU *cu, Dwarf_Word len, const unsigned char *data) > +struct Dwarf_CU *cu, Dwarf_Word len, const unsigned char *data, > +FILE *out) > { > + if (out == NULL) > +out = stdout; > + Or here. I cannot find any invocation of print_ops with out being NULL. Everything else looks obviously correct. Thanks, Mark

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

2025-06-06 Thread Mark Wielaard
next here, but not ... > +.SH SEE ALSO > +.BR mmap (2), > +.BR elf_clone (3), > +.BR elf_end (3), > +.BR elf_rand (3), > +.BR libelf (3), > +.BR elf (5) ... here. Cheers, Mark

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

2025-06-05 Thread Mark Wielaard
then > we must make sure to handle it before handling any other debug > section. Various other sections depend on the CU DIEs being > @@ -12239,15 +12375,24 @@ print_debug (Dwfl_Module *dwflmod, Ebl *ebl, > GElf_Ehdr *ehdr) > && strcmp (&name[14], debug_sections[n].name) == 0) > ) > { > - if ((print_debug_sections | implicit_debug_sections) > - & debug_sections[n].bitmask) > - debug_sections[n].fp (dwflmod, ebl, ehdr, scn, shdr, dbg); > + if (((print_debug_sections | implicit_debug_sections) > +& debug_sections[n].bitmask)) > + schedule_job (jdata, num_jobs++, debug_sections[n].fp, > + dwflmod, ebl, ehdr, scn, shdr, dbg); > + > + assert (num_jobs <= shnum); > break; > } > } > } > } OK. > +#ifdef USE_LOCKS > + /* If max_threads == 1, then jobs were immediately run in schedule_job. */ > + if (max_threads > 1) > +run_jobs (max_threads - 1); > +#endif > + >dwfl_end (skel_dwfl); >free (skel_name); Why max_threads - 1 ? Cheers, Mark

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

2025-06-05 Thread Mark Wielaard
ef _THREADLIB_H > +#define _THREADLIB_H 1 > + > +/* Add a job to the job queue. When the job is run using run_job, it will > + consist of start_routine called with ARG as well as a FILE *. The > + contents of the FILE will be printed to stdout once start_routine > + finishes. */ > +extern void add_job (void *(*start_routine)(void *, FILE *), void *arg); > + > +/* Run all jobs that have been added by add_job. Jobs run concurrently > + using at most MAX_THREADS threads. > + > + run_jobs returns when all jobs have finished and any output from the > + jobs has been printed to stdout. Output from each job is printed in > + the order which jobs were added using add_job. */ > +extern void run_jobs (int max_threads); > + > +#endif /* threadlib.h */ Looks good. Maybe clarify add_job cannot be called after run_jobs has been called? Cheers, Mark

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

2025-06-05 Thread Mark Wielaard
ead_output_stream (output_stream_t *stream) > +{ > + /* fclose may update stream->buf. */ > + if (fclose (stream->file) != 0) > +error (1, 0, _("cannot close thread output stream")); > + > + printf ("%s", stream->buf); > + free (stream->buf); > +} I think it would be slightly more efficient to use fwrite here. printf "%s" has to first look for the end of buf. And you do have the stream- >sizeloc already. Sorry for stopping the review here suddenly. Will continue later, but hopefully this is already helpful. Cheers, Mark

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

[Bug tools/33006] Stack Buffer Overflow in eu-objdump's riscv_disasm Function

2025-06-04 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=33006 Mark Wielaard changed: What|Removed |Added Resolution|--- |FIXED Status|UNCONFIRMED

[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(+)

[Bug tools/33005] Dynamic Stack Buffer Overflow in eu-unstrip's new_shstrtab Function

2025-06-03 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=33005 Mark Wielaard changed: What|Removed |Added CC||mark at klomp dot org --- Comment #3

[Bug tools/33006] Stack Buffer Overflow in eu-objdump's riscv_disasm Function

2025-06-03 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=33006 Mark Wielaard changed: What|Removed |Added CC||mark at klomp dot org --- Comment #2

[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 -

[Bug tools/33004] Stack Buffer Underflow in eu-unstrip's sections_match Function

2025-06-02 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=33004 --- Comment #4 from Mark Wielaard --- (In reply to Xudong Cao from comment #3) > Thanks for the quick fix! > I agree the files are malformed, but any out-of-bounds access caught by ASan > is still considered a memory-safety defect

[Bug tools/33004] Stack Buffer Underflow in eu-unstrip's sections_match Function

2025-06-01 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=33004 Mark Wielaard changed: What|Removed |Added Resolution|--- |NOTABUG Status

[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

[Bug tools/33003] Bus Error Vulnerability in eu-strip due to Invalid Memory Write

2025-06-01 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=33003 Mark Wielaard changed: What|Removed |Added Resolution|--- |NOTABUG Status

[Bug tools/33003] Bus Error Vulnerability in eu-strip due to Invalid Memory Write

2025-06-01 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=33003 --- Comment #3 from Mark Wielaard --- (In reply to Sam James from comment #2) > (In reply to Mark Wielaard from comment #1) > > Sorry, I cannot replicate. > > > > Building with AddressSanitizer seems to

[Bug tools/33004] Stack Buffer Underflow in eu-unstrip's sections_match Function

2025-06-01 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=33004 Mark Wielaard changed: What|Removed |Added CC||mark at klomp dot org --- Comment #1

[Bug tools/33003] Bus Error Vulnerability in eu-strip due to Invalid Memory Write

2025-06-01 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=33003 Mark Wielaard changed: What|Removed |Added CC||mark at klomp dot org --- Comment #1

[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
inline functions and move to eu-search.h. > Simplify locking in is_constant_offset. > In __libdw_findcu use eu_tfind instead of eu_tfind_nolock. Thanks, this addresses all comments I had. I'll see if my suggestion to make __libdw_fde_by_offset static makes sense as a followup patch. Thanks, Mark

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

2025-05-27 Thread Mark Wielaard
calling __libdw_intern_expression with Dwarf_CU members. */ > + mutex_define(, intern_lock); > + >/* Memory boundaries of this CU. */ >void *startp; >void *endp; Ack. > @@ -949,8 +953,9 @@ extern int __libdw_visit_scopes (unsigned int depth, >void *arg) >__nonnull_attribute__ (2, 4) internal_function; > > -/* Parse a DWARF Dwarf_Block into an array of Dwarf_Op's, > - and cache the result (via tsearch). */ > +/* Parse a DWARF Dwarf_Block into an array of Dwarf_Op's, and cache the > + result (via tsearch). The owner of CACHE (typically a Dwarf_CU or > + Dwarf_CFI_s) must hold a lock when calling this function. */ > extern int __libdw_intern_expression (Dwarf *dbg, > bool other_byte_order, > unsigned int address_size, Nice docks. > diff --git a/libdw/libdw_findcu.c b/libdw/libdw_findcu.c > index 0e4dcc37..21c8ed0e 100644 > --- a/libdw/libdw_findcu.c > +++ b/libdw/libdw_findcu.c > @@ -181,6 +181,7 @@ __libdw_intern_next_unit (Dwarf *dbg, bool debug_types) >rwlock_init (newp->split_lock); >mutex_init (newp->src_lock); >mutex_init (newp->str_off_base_lock); > + mutex_init (newp->intern_lock); > >/* v4 debug type units have version == 4 and unit_type == DW_UT_type. */ >if (debug_types) Ack. > @@ -240,8 +241,6 @@ struct Dwarf_CU * > internal_function > __libdw_findcu (Dwarf *dbg, Dwarf_Off start, bool v4_debug_types) > { > - mutex_lock (dbg->dwarf_lock); > - >search_tree *tree = v4_debug_types ? &dbg->tu_tree : &dbg->cu_tree; >Dwarf_Off *next_offset > = v4_debug_types ? &dbg->next_tu_offset : &dbg->next_cu_offset; > @@ -250,6 +249,12 @@ __libdw_findcu (Dwarf *dbg, Dwarf_Off start, bool > v4_debug_types) >struct Dwarf_CU fake = { .start = start, .end = 0 }; >struct Dwarf_CU **found = eu_tfind (&fake, tree, findcu_cb); >struct Dwarf_CU *result = NULL; > + if (found != NULL) > +return *found; > + > + mutex_lock (dbg->dwarf_lock); > + > + found = eu_tfind_nolock (&fake, tree, findcu_cb); >if (found != NULL) > { >mutex_unlock (dbg->dwarf_lock); OK, so the dwarf_lock has to be held to call __libdw_intern_next_unit below. But why is it correct to call eu_tfind_nolock here without holding the tree lock? Thanks, Mark

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

2025-05-27 Thread Mark Wielaard
ment so we can easily look them up in the future. Cheers, Mark > Signed-off-by: A. Wilcox > --- > backends/ppc_attrs.c | 12 > 1 file changed, 12 insertions(+) > > diff --git a/backends/ppc_attrs.c b/backends/ppc_attrs.c > index 48d7129d..6b00bccd 100644 &g

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

2025-05-20 Thread Mark Wielaard
This is actually v3, because I was nitpicking too much. But this version is perfect I have nothing to nitpick anymore. Thanks, Mark

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

2025-05-15 Thread Mark Wielaard
configure for maintainer mode: AC_CHECK_PROG(HAVE_GAWK, gawk, yes, no) if test "$HAVE_GAWK" = "no"; then AC_MSG_ERROR([gawk needed in maintainer mode]) fi I don't think it would be a problem to do that for non-maintainer-mode too. Cheers, Mark

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), >

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

2025-05-14 Thread Mark Wielaard
Hi Aaron, On Mon, 2025-05-12 at 20:33 -0400, Aaron Merey wrote: > v2: Mention use with SHT_HASH and clarify that only the lower 32 bits of > the return value are used. Looks good. Thanks, Mark

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

2025-05-14 Thread Mark Wielaard
Hi Aaron, On Mon, 2025-05-12 at 20:33 -0400, Aaron Merey wrote: > v2: Mention fill value only applies to new gaps and set Thread Safety > atrribute to 'MT-Unsafe race' Looks good. Thanks, Mark

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

2025-05-14 Thread Mark Wielaard
Hi Aaron, On Mon, 2025-05-12 at 20:33 -0400, Aaron Merey wrote: > v2: mention that base offset returned is always 0 for non ELF_K_AR > kinds. Also mention elf_getaroff and elf_rawelf. Looks good. Thanks, Mark

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

2025-05-14 Thread Mark Wielaard
Hi Aaron, On Mon, 2025-05-12 at 20:33 -0400, Aaron Merey wrote: > v2: Mention elf arg may be NULL. Looks good. > 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.

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

2025-05-14 Thread Mark Wielaard
Hi Aaron, Yes, please. Thanks, Mark

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

2025-05-14 Thread Mark Wielaard
ost probably not generically. Especially not the container builders. But you might make some deal with a specific direct hardware worker admin? Cheers, Mark

Re: [PATCH] tests: Create random test_dir name

2025-05-13 Thread Mark Wielaard
Hi, On Tue, May 06, 2025 at 11:50:12AM +0200, Mark Wielaard wrote: > The testsuite relies on there being no files in the test directory > after the test finishes. A test will fail if the test dir cannot be > removed. But the test dir isn't really random, it uses the pid of the >

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

2025-05-06 Thread Mark Wielaard
the verdef_data to include the verdaux. */ > - verdef_data = elf_getdata_rawchunk ( > - ebl->elf, offs[i_verdef], > - (addrs[i_verdefnum] + verdauxnum) * sizeof (GElf_Verdef), ELF_T_VDEF); > + if (offs[i_verdef] != 0 && addrs[i_verdefnum] != 0) > +verdef_data = elf_getdata_rawchunk ( > + ebl->elf, offs[i_verdef], > + (addrs[i_verdefnum] + verdauxnum) * sizeof (GElf_Verdef), ELF_T_VDEF); > >unsigned int nsyms = (unsigned int)syments; >process_symtab (ebl, nsyms, 0, 0, 0, symdata, versym_data, symstrdata, Looks good. Cheers, Mark

[PATCH] tests: Create random test_dir name

2025-05-06 Thread Mark Wielaard
those to define test_dir. Signed-off-by: Mark Wielaard --- tests/test-subr.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test-subr.sh b/tests/test-subr.sh index ea80cbec3bc7..2a956b47de2f 100644 --- a/tests/test-subr.sh +++ b/tests/test-subr.sh @@ -23,7 +23,9 @@ s

[Bug libdw/32929] 0.193 regression: dwarf_srclang_check: error while loading shared libraries: libelf.so.1: cannot open shared object file: No such file or directory

2025-05-02 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=32929 Mark Wielaard changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution

[COMMITTED] libdw: Add RPATH to MAIN_CHECK programs

2025-05-02 Thread Mark Wielaard
We want to test the program against the just build libelf.so not the system installed one. So add an RPATH to ../libelf. * libdw/Makefile.am (CHECK_DEF_FLAGS): Add -Wl,-rpath,../libelf. https://sourceware.org/bugzilla/show_bug.cgi?id=32929 Signed-off-by: Mark Wielaard --- libdw

[Bug libdw/32929] 0.193 regression: dwarf_srclang_check: error while loading shared libraries: libelf.so.1: cannot open shared object file: No such file or directory

2025-05-02 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=32929 Mark Wielaard changed: What|Removed |Added CC||mark at klomp dot org --- Comment #1

[Bug general/32930] New: compile failure in i386_init.c asm/perf_regs.h: No such file or directory

2025-05-02 Thread mark at klomp dot org
: normal Priority: P2 Component: general Assignee: unassigned at sourceware dot org Reporter: mark at klomp dot org CC: elfutils-devel at sourceware dot org Target Milestone: --- elfutils 0.193 fails to build on debian hppa and m68k https

Re: [PATCH] libdw: Fix eu_search_tree TOCTOU bugs

2025-05-02 Thread Mark Wielaard
w_str_offsets_base_off. */ >mutex_define(, str_off_base_lock); > > + /* Synchronize access to is_constant_offset. Should also be held > + when calling __libdw_intern_expression with Dwarf_CU members. */ > + mutex_define(, intern_lock); > + Right. So maybe cross reference doc between here and Dwarf_CFI_s lock? >/* Memory boundaries of this CU. */ >void *startp; >void *endp; > diff --git a/libdw/libdw_findcu.c b/libdw/libdw_findcu.c > index 0e4dcc37..59267343 100644 > --- a/libdw/libdw_findcu.c > +++ b/libdw/libdw_findcu.c > @@ -181,6 +181,7 @@ __libdw_intern_next_unit (Dwarf *dbg, bool debug_types) >rwlock_init (newp->split_lock); >mutex_init (newp->src_lock); >mutex_init (newp->str_off_base_lock); > + mutex_init (newp->intern_lock); > >/* v4 debug type units have version == 4 and unit_type == DW_UT_type. */ >if (debug_types) Ack. > @@ -240,8 +241,6 @@ struct Dwarf_CU * > internal_function > __libdw_findcu (Dwarf *dbg, Dwarf_Off start, bool v4_debug_types) > { > - mutex_lock (dbg->dwarf_lock); > - >search_tree *tree = v4_debug_types ? &dbg->tu_tree : &dbg->cu_tree; >Dwarf_Off *next_offset > = v4_debug_types ? &dbg->next_tu_offset : &dbg->next_cu_offset; > @@ -250,6 +249,12 @@ __libdw_findcu (Dwarf *dbg, Dwarf_Off start, bool > v4_debug_types) >struct Dwarf_CU fake = { .start = start, .end = 0 }; >struct Dwarf_CU **found = eu_tfind (&fake, tree, findcu_cb); >struct Dwarf_CU *result = NULL; > + if (found != NULL) > +return *found; > + > + mutex_lock (dbg->dwarf_lock); > + > + found = eu_tfind (&fake, tree, findcu_cb); >if (found != NULL) > { >mutex_unlock (dbg->dwarf_lock); OK, so in this case you do need the eu_tfind variant because both calls need to be guarded. The second call just has one more extra lock around it (the dwarf_lock) that also covers the possible eu_tsearch call. Thanks, Mark

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

2025-05-01 Thread Mark Wielaard
ar format, should it? Or should we have an ar.5 man page? > + > +.SH ATTRIBUTES > +For an explanation of the terms used in this section, see > +.BR attributes (7). > +.TS > +allbox; > +lbx lb lb > +l l l. > +InterfaceAttribute Value > +T{ > +.na > +.nh > +.BR elf_kind () > +T} Thread safety MT-Safe > +.TE > + > +.SH REPORTING BUGS > +Report bugs to or > https://sourceware.org/bugzilla/. Cheers, Mark

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

2025-05-01 Thread Mark Wielaard
explanation of the terms used in this section, see > +.BR attributes (7). > +.TS > +allbox; > +lbx lb lb > +l l l. > +InterfaceAttribute Value > +T{ > +.na > +.nh > +.BR elf_hash () > +T} Thread safety MT-Safe > +.TE > + > +.SH REPORTING BUGS > +Report bugs to or > https://sourceware.org/bugzilla/. Cheers, Mark

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

2025-05-01 Thread Mark Wielaard
inter to the same offset to read from. > +.SH ATTRIBUTES > +For an explanation of the terms used in this section, see > +.BR attributes (7). > + > +.TS > +allbox; > +lbx lb lb > +l l l. > +InterfaceAttribute Value > +T{ > +.na > +.nh > +.BR elf_getbase () > +T} Thread safety MT-Safe > +.TE > + > +.SH REPORTING BUGS > +Report bugs to or > https://sourceware.org/bugzilla/. Cheers, Mark

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

2025-05-01 Thread Mark Wielaard
TE Are you sure about it being MT-Safe. It is process wide and not bound to any particular ELF. So I would say MT-Unsafe race or MT-Unsafe const maybe? > +.SH REPORTING BUGS > +Report bugs to or > https://sourceware.org/bugzilla/. > + Cheers, Mark

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

2025-04-30 Thread Mark Wielaard
> +.I elf > +is NULL, then > +.B elf_end > +also returns 0. Good. > +.SH SEE ALSO > +.BR elf_begin (3), > +.BR libelf (3), > +.BR elf (5) Yes, but elf_begin (3) is currently somewhat useless. > +.SH ATTRIBUTES > +For an explanation of the terms used in this section, see > +.BR attributes (7). > +.TS > +allbox; > +lbx lb lb > +l l l. > +InterfaceAttribute Value > +T{ > +.na > +.nh > +.BR elf_end () > +T} Thread safety MT-Safe > +.TE > + > +.SH REPORTING BUGS > +Report bugs to or > https://sourceware.org/bugzilla/. > + Cheers, Mark

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

2025-04-29 Thread Mark Wielaard
Hi Anton, On Thu, Feb 27, 2025 at 10:28:20PM +0100, Mark Wielaard wrote: > > diff --git a/src/unstrip.c b/src/unstrip.c > > index d70053de..35c04700 100644 > > --- a/src/unstrip.c > > +++ b/src/unstrip.c > > @@ -1974,6 +1974,9 @@ more sections in stripped file tha

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

2025-04-29 Thread Mark Wielaard
Hi Anton, On Thu, Feb 27, 2025 at 10:02:19PM +0100, Mark Wielaard wrote: > 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 > > witho

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

2025-04-29 Thread Mark Wielaard
Hi Anton, On Thu, Feb 27, 2025 at 06:12:36PM +0100, Mark Wielaard wrote: > 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 retur

Sourceware infrastructure updates for Q1 2025

2025-04-22 Thread Mark Wielaard
ailman/listinfo/overseers Please see https://sourceware.org/donate.html if you want to financially support Sourceware. Sourceware PLC, Frank Ch. Eigler, Christopher Faylor, Ian Kelling, Ian Lance Taylor, Tom Tromey, Jon Turney, Mark J. Wielaard, Elena Zannoni

scraperbot protection - Patchwork and Bunsen behind Anubis

2025-04-21 Thread Mark Wielaard
of their patrons as thank you. https://xeiaso.net/notes/2025/anubis-works/ https://xeiaso.net/patrons/ Cheers, Mark

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

2025-04-15 Thread Mark Wielaard
icitly also check that (or file a bug report to check that in the future)? Thanks, Mark > Suggested-by: Constantine Bytensky > Signed-off-by: Aaron Merey > --- > src/readelf.c | 50 +++--- > 1 file changed, 31 insertions(+), 19 deletion

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

2025-04-08 Thread Mark Wielaard
on't have to create a whole valid ELF/Dwarf file. But that proved trickier than I thought. It does however seem pretty nice for these kind of tests. Cheers, Mark

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
sten-local only (assuming that makes sense). Cheers, Mark > --- > debuginfod/debuginfod.cxx | 115 ++ > doc/debuginfod.8 | 5 ++ > 2 files changed, 84 insertions(+), 36 deletions(-) > > diff --git a/debuginfod/debuginfod.cxx

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
't seen it fail in armhf for a year, but in the last 9 days it has failed 3 times already :{ https://builder.sourceware.org/buildbot/#/builders/elfutils-debian-armhf H, Mark

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

[Bug general/29571] Add 'Key to Flags' to eu-readelf output

2025-04-04 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=29571 Mark Wielaard changed: What|Removed |Added Status|NEW |RESOLVED Resolution

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

2025-04-04 Thread Mark Wielaard
tests/run-readelf-z.sh: Add Key to Flags to expected output. * tests/run-retain.sh: Likewise. * tests/run-strip-remove-keep.sh: Likewise. https://sourceware.org/bugzilla/show_bug.cgi?id=29571 Signed-off-by: Samuel Zeter Cheers, Mark

[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
> doc/debuginfod.8 | 5 ++ > 2 files changed, 84 insertions(+), 36 deletions(-) Looks good, pushed as is. Thanks, Mark

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
d-off-by line to show they have the right to and grand others rights to use their contribution. See the CONTRIBUTING file: https://sourceware.org/cgit/elfutils/tree/CONTRIBUTING#n15 Thanks, Mark

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

2025-03-27 Thread Mark Wielaard
en there are more places that might need extra guarding (or we have to write better eu-search wrappers?) Thanks, Mark > Signed-off-by: Aaron Merey > --- > libdw/libdw_findcu.c | 9 ++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/libdw/libdw_findcu

[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
looks good. I believe that means the whole series is finally fully reviewed and approved. So please do push it. Cheers, Mark

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
it slightly more intuitive to use. Cheers, Mark > * libdwfl/libdwfl.h (Dwfl_Process_Tracker): New struct. > (dwfl_process_tracker_begin): New function. > (dwfl_begin_with_tracker): New function. > (dwfl_process_tracker_end): New function. > * libdw/libdw.map: Add new functions.

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

2025-03-20 Thread Mark Wielaard
libdwfl function with the above changes, but I think it is simpler/less work to just make it an internal libdwflP.h helper function. Cheers, Mark

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
tch 01/13 (it could even be folded into it. Cheers, Mark > --- > src/Makefile.am | 4 ++-- > src/stacktrace.c | 48 +--- > 2 files changed, 15 insertions(+), 37 deletions(-) > > diff --git a/src/Makefile.am b/src/Makefile.am

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

2025-03-19 Thread Mark Wielaard
his is used by some backends, where the > return_address_register actually contains the call address. */ > diff --git a/libebl/libeblP.h b/libebl/libeblP.h > index c408ed97..29c2402d 100644 > --- a/libebl/libeblP.h > +++ b/libebl/libeblP.h > @@ -1,5 +1,5 @@ > /* Internal definitions for interface for libebl. > - Copyright (C) 2000-2009, 2013, 2014 Red Hat, Inc. > + Copyright (C) 2000-2009, 2013, 2014, 2025 Red Hat, Inc. > This file is part of elfutils. > > This file is free software; you can redistribute it and/or modify > @@ -60,6 +60,11 @@ struct ebl > Ebl architecture can unwind iff FRAME_NREGS > 0. */ >size_t frame_nregs; > > + /* Preferred sample_regs_user mask to request from linux perf_events > + to allow unwinding. Ebl architecture supports unwinding from > + perf_events sample data iff PERF_FRAME_REGS_MASK > 0. */ > + uint32_t perf_frame_regs_mask; > + In all other places the mask is an uint64_t Also the libebl interface is very verbose for this mask. Clearly copied from how frame_nregs is done. So fine for now. But we might want to look into something simpler for both of these. Both fetching frame_nregs and perf_frame_regs_mask feel very inefficient. Cheers, Mark

Re: Question about elf symbol's file offset

2025-03-19 Thread Mark Wielaard
located the symbol and/or section addresses (so whether you are reading the values from memory or on disk). Cheers, Mark

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

2025-03-19 Thread Mark Wielaard
(" L (link order), N (extra OS processing required), G (group), T > (TLS),"); > + puts (" C (compressed), O (ordered), R (GNU retain), E (exclude)"); > +} > > /* Print the program header. */ > static void The patch itself does look correct. These are the flags that print_shdr prints if the corresponding shdr->sh_flags are set. Cheers, Mark

[Bug general/29571] Add 'Key to Flags' to eu-readelf output

2025-03-19 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=29571 --- Comment #7 from Mark Wielaard --- (In reply to Sam Zeter from comment #6) > I also noticed in libelf/elf.h that we define these flags but do not print > them in readelf: > > #define SHF_MASKOS 0x0ff0 /*

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

2025-03-18 Thread Mark Wielaard
that coding like this triggers -Werror=unused-parameter on non-x86. > I plan to fix this in the next version of the patch. In some other situations that is "solved" with marking the function arguments with __attribute__ ((unused)) (which isn't true for x86_64, but the compiler is fine with that). Cheers, Mark

Sourceware Survey 2025

2025-03-15 Thread Mark Wielaard
your local timezone: $ date -d "Fri Mar 14 16:00 UTC 2025" Thanks, Frank Ch. Eigler, Christopher Faylor, Ian Kelling, Ian Lance Taylor, Tom Tromey, Jon Turney, Mark J. Wielaard, Elena Zannoni

[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

[Bug debuginfod/31862] debuginfod client should cache received x-debuginfod-* headers

2025-03-09 Thread mark at klomp dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=31862 Mark Wielaard changed: What|Removed |Added Resolution|--- |FIXED CC

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

2025-02-28 Thread Mark Wielaard
v3 changes: Add --track-fds to valgrind_cmd when USE_HELGRIND is true. Looks OK. Once this is in we should add a buildbot with this enabled. Thanks, Mark

  1   2   3   4   5   6   7   8   9   10   >