; + printf ("Error while freeing subELF descriptor: %s\n",
> + elf_errmsg (-1));
> + exit (1);
> + }
> +
> + hdr_list = cur->next;
> + free (cur);
> + }
> +
> + /* Close the archive descriptor. */
> + if (elf_end (elf) != 0)
> {
> printf ("Freeing ELF descriptors failed: %s", elf_errmsg (-1));
> exit (1);
>
> @@ -144,12 +202,6 @@ Failed to get base address for the archive element:
> %s\n",
>
>/* Get next archive element. */
>cmd = elf_next (subelf);
> - if (elf_end (subelf) != 0)
> - {
> - printf ("error while freeing sub-ELF descriptor: %s\n",
> - elf_errmsg (-1));
> - exit (1);
> - }
> }
>
>/* When we reach this point we haven't found the given file in the
Nice test.
Cheers,
Mark
u-ar assumes -1 indicates an error and other libelf implementations
> use -1 to indicate an error in elf_getaroff.
>
> Replace ELF_C_NULL with -1 as elf_getaroff's error return value.
I agree this makes sense given elf_getaroff returns an offset.
Thanks,
Mark
in the string table if successful.
> +Returns
> +.B NULL
> +on error.
> +
> +.SH SEE ALSO
> +.BR elf (3),
> +.BR elf_getscn (3),
> +.BR libelf (3),
> +.BR elf (5)
Maybe add elf32/64_getshdr and gelf_getsym as examples of sh_name
(.shstrtab) or st_name (.strtab) getting name strings?
> +
> +.SH ATTRIBUTES
> +.TS
> +allbox;
> +lbx lb lb
> +l l l.
> +InterfaceAttribute Value
> +T{
> +.na
> +.nh
> +.BR elf_strptr ()
> +T} Thread safety MT-Safe
> +.TE
> +
> +.SH REPORTING BUGS
> +Report bugs to or
> https://sourceware.org/bugzilla/.
OK.
Thanks,
Mark
t; +T} Thread safety MT-Safe
> +.TE
> +
> +.SH REPORTING BUGS
> +Report bugs to or
> https://sourceware.org/bugzilla/.
> +
> +.SH HISTORY
> +.B elf_scnshndx
> +first appeared in elfutils 0.132. This function is a elfutils libelf
> extension and
> +may not be available in other libelf implementations.
OK.
Thanks,
Mark
> +.I *ptr
> +(if non-NULL) is set to 0.
OK.
> +.SH SEE ALSO
> +.BR libelf (3),
> +.BR elf (5)
> +
> +.SH ATTRIBUTES
> +.TS
> +allbox;
> +lbx lb lb
> +l l l.
> +InterfaceAttribute Value
> +T{
> +.na
> +.nh
> +.BR elf_rawfile ()
> +T} Thread safety MT-Safe
> +.TE
> +
> +.SH REPORTING BUGS
> +Report bugs to or
> https://sourceware.org/bugzilla/.
OK.
Thanks,
Mark
ing the raw contents of the section. On failure,
> +.B NULL
> +is returned.
OK.
> +.SH SEE ALSO
> +.BR elf_getdata (3),
> +.BR elf_getscn (3),
> +.BR elf_compress (3),
> +.BR libelf (3),
> +.BR elf (5)
> +
> +.SH ATTRIBUTES
> +.TS
> +allbox;
> +lbx lb lb
> +l l l.
> +InterfaceAttribute Value
> +T{
> +.na
> +.nh
> +.BR elf_rawdata ()
> +T} Thread safety MT-Safe
> +.TE
> +
> +.SH REPORTING BUGS
> +Report bugs to or
> https://sourceware.org/bugzilla/.
OK.
Thanks,
Mark
lf_next (3),
> +.BR libelf (3),
> +.BR elf (5)
Add elf_getarsym.
> +.SH ATTRIBUTES
> +.TS
> +allbox;
> +lbx lb lb
> +l l l.
> +InterfaceAttribute Value
> +T{
> +.na
> +.nh
> +.BR elf_rand ()
> +T} Thread safety MT-Safe
> +.TE
> +
> +.SH REPORTING BUGS
> +Report bugs to or
> https://sourceware.org/bugzilla/.
OK.
Thanks,
Mark
> +.SH ATTRIBUTES
> +.TS
> +allbox;
> +lbx lb lb
> +l l l.
> +InterfaceAttribute Value
> +T{
> +.na
> +.nh
> +.BR elf_nextscn ()
> +T} Thread safety MT-Safe
> +.TE
> +
> +.SH REPORTING BUGS
> +Report bugs to or
> https://sourceware.org/bugzilla/.
OK.
Thanks,
Mark
L, failure is returned and elf_errno
is not (re)set.
> +
> +.SH SEE ALSO
> +.BR elf_getshdr (3),
elf32_getshdr
elf64_getshdr
> +.BR elf_getdata (3),
> +.BR elf_newdata (3),
> +.BR elf_update (3),
> +.BR libelf (3),
> +.BR elf (5)
OK.
> +.SH ATTRIBUTES
> +.TS
> +allbox;
> +lbx lb lb
> +l l l.
> +InterfaceAttribute Value
> +T{
> +.na
> +.nh
> +.BR elf_newscn ()
> +T} Thread safety MT-Safe
> +.TE
> +
> +.SH REPORTING BUGS
> +Report bugs to or
> https://sourceware.org/bugzilla/.
OK.
Thanks,
Mark
wscn (3),
> +.BR elf_update (3),
> +.BR libelf (3),
> +.BR elf (5)
OK.
> +.SH ATTRIBUTES
> +.TS
> +allbox;
> +lbx lb lb
> +l l l.
> +InterfaceAttribute Value
> +T{
> +.na
> +.nh
> +.BR elf_newdata ()
> +T} Thread safety MT-Safe
> +.TE
> +
> +.SH REPORTING BUGS
> +Report bugs to or
> https://sourceware.org/bugzilla/.
OK. Some of the lines are very wide though.
Thanks,
Mark
32 bits of the return value are used.
OK.
> @@ -43,9 +52,14 @@ Interface Attribute Value
> T{
> .na
> .nh
> -.BR elf_hash ()
> +.BR elf_hash (),\~elf_gnu_hash ()
> T} Thread safety MT-Safe
> .TE
>
> .SH REPORTING BUGS
> Report bugs to or
> https://sourceware.org/bugzilla/.
> +
> +.SH HISTORY
> +.B elf_gnu_hash
> +first appeared in elfutils 0.122. This function is a elfutils libelf
> extension and
> +may not be available in other libelf implementations.
OK.
Thanks,
Mark
GETSHDRSTRNDX 3 2025-06-30 "Libelf" "Libelf Programmer's Manual"
> +
> +.SH NAME
> +elf_getshdrstrndx, elf_getshstrndx \- retrieve the section header string
> table index
> +.SH SYNOPSIS
> +.nf
> +#include
> +
> +.B int elf_getshdrstrndx("Elf
uot;Libelf Programmer's Manual"
> +
> +.SH NAME
> +elf_getshdrnum, elf_getshnum \- retrieve the number of section headers in an
> ELF file
> +.SH SYNOPSIS
> +.nf
> +#include
> +
> +.B int elf_getshdrnum("Elf *elf", "size_t *dst");
> +.
f
> +is NULL.
OK.
> +.SH SEE ALSO
> +.BR libelf (3),
> +.BR elf (5)
elf32_getphdr/elf64_getphdr?
> +.SH ATTRIBUTES
> +.TS
> +allbox;
> +lbx lb lb
> +l l l.
> +InterfaceAttribute Value
> +T{
> +.na
> +.nh
> +.BR elf_getphdrnum ()
> +T} Thread safety MT-Safe
> +.TE
> +
> +.SH REPORTING BUGS
> +Report bugs to or
> https://sourceware.org/bugzilla/.
OK.
Cheers,
Mark
index part confused me.
> +.SH SEE ALSO
> +.BR libelf (3),
> +.BR elf (5)
OK.
> +.SH ATTRIBUTES
> +.TS
> +allbox;
> +lbx lb lb
> +l l l.
> +InterfaceAttribute Value
> +T{
> +.na
> +.nh
> +.BR elf_getident ()
> +T} Thread safety MT-Safe
> +.TE
> +
> +.SH REPORTING BUGS
> +Report bugs to or
> https://sourceware.org/bugzilla/.
OK.
Thanks,
Mark
t;lock. Checks whether it can find an
existing Elf_Data_Chunk. If yes, it returns that one. Which seems fine.
But if not it inserts the dummy chunk without actually data,
allocates/creates the data, drops the rdlock (!), takes a write lock
and overwrites the dummy chunk with the real data, drops the lock again
and returns the data.
What if at (!) another call gets the read lock first before the current
thread can (re)take the write lock? That other thread could find the
existing dummy key already in the cache and return the dummy data?
> +.SH REPORTING BUGS
> +Report bugs to or
> https://sourceware.org/bugzilla/.
> +
> +.SH HISTORY
> +.B elf_getdata_rawchunk
> +first appeared in elfutils 0.130. This function is a elfutils libelf
> extension and
> +may not be available in other libelf implementations.
Yes.
Thanks,
Mark
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 |
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
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
f_compress ()
> +and
> +.BR elf_compress_gnu ()
> +modify the contents of a section in an ELF descriptor by compressing or
> +decompressing the section data and adjusting the section header. These
> changes
> +take effect when the ELF descriptor is written with
> +.BR elf_upda
errmsg (3),
> +.BR elf (5)
> +
> +.SH ATTRIBUTES
> +.TS
> +allbox;
> +lbx lb lb
> +l l l.
> +Interface Attribute Value
> +T{
> +.na
> +.nh
> +.BR elf_cntl ()
> +T} Thread safety MT-Safe
> +.TE
> +
> +.SH REPORTING BUGS
> +Report bugs to or
> https://sourceware.org/bugzilla/.
Looks good,
Mark
en print_debug_unit has:
const bool silent = !(print_debug_sections & section_info) && !debug_types;
And even when silent it then does various notice_listptr calls.
Confusing :)
I wonder if it still makes sense to have this extra notice_listptr
pass inside print_debug_unit and whether we shouldn't just have a
dedicated pass for it that then can run before the printing of any
other debug section (if needed).
But yes, I see now. That is for later.
Getting back to the actual change:
> /* To store the name used in compare_listptr */
> -static const char *sort_listptr_name;
> +_Thread_local const char *sort_listptr_name;
Should it still be static?
Should we maybe include and use thread_local instead?
I read over the whole patch and don't have any other comments. Looks
good.
Thanks,
Mark
gt;
> Yes exit will terminate the whole program in this case.
OK. Then we should make sure that they output their warning/error
message to stderr and not their current stream (because that will be
lost). I think that happens automatically when using error() to exit.
Cheers,
Mark
> + fputs (__("\nFile name table:\n"), out);
>if (version > 4)
> {
> struct encpair { uint16_t desc; uint16_t form; };
> struct encpair enc[256];
>
> - fprintf (out, _(" ["));
> + fprintf (out, " [");
> if ((size_t) (lineendp - linep) < 1)
> goto invalid_data;
> unsigned char file_name_format_count = *linep++;
Likewise.
> @@ -9528,11 +9602,11 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl
> *ebl, GElf_Ehdr *ehdr,
>
>if (linep == lineendp)
> {
> - fputs (_("\nNo line number statements.\n"), out);
> + fputs (__("\nNo line number statements.\n"), out);
> continue;
> }
>
> - fputs (_("\nLine number statements:\n"), out);
> + fputs (__("\nLine number statements:\n"), out);
>Dwarf_Word address = 0;
>unsigned int op_index = 0;
>size_t line = 1;
> @@ -9581,15 +9655,25 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl
> *ebl, GElf_Ehdr *ehdr,
> line += line_increment;
> advance_pc ((opcode - opcode_base) / line_range);
>
> - fprintf (out, _(" special opcode %u: address+%u = "),
> + IGNORE_FMT_NONLITERAL_BEGIN
> + fprintf (out, __(" special opcode %u: address+%u = "),
> opcode, op_addr_advance);
> + IGNORE_FMT_NONLITERAL_END
> print_dwarf_addr (dwflmod, 0, address, address, out);
> if (op_index > 0)
> - fprintf (out, _(", op_index = %u, line%+d = %zu\n"),
> - op_index, line_increment, line);
> + {
> + IGNORE_FMT_NONLITERAL_BEGIN
> + fprintf (out, __(", op_index = %u, line%+d = %zu\n"),
> +op_index, line_increment, line);
> + IGNORE_FMT_NONLITERAL_END
> + }
> else
> - fprintf (out, _(", line%+d = %zu\n"),
> - line_increment, line);
> + {
> + IGNORE_FMT_NONLITERAL_BEGIN
> + fprintf (out, __(", line%+d = %zu\n"),
> +line_increment, line);
> + IGNORE_FMT_NONLITERAL_END
> + }
> }
"line" can probably be translated, but "op_index" is how it is called
in the spec.
Similar comments for the rest of the patch.
I really don't like the macros and the __ very much.
If at all possible I would just do this with explicit
static char *frob_str = _("frob"); strings.
Cheers,
Mark
me (so those can
be parallelized too). The attrcb_args callback support already seems
ready for that.
But that is all for some future.
Cheers,
Mark
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>
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
and return -1 on error.
> +.SH SEE ALSO
> +.BR elf_begin (3),
> +.BR elf_next (3),
> +.BR elf_rand (3),
> +.BR libelf (3),
> +.BR elf (5)
> +
> +.SH ATTRIBUTES
> +.TS
> +allbox;
> +lbx lb lb
> +l l l.
> +InterfaceAttribute Value
> +T{
> +.na
> +.nh
> +.BR elf_getaroff ()
> +T} Thread safety MT-Safe
> +.TE
> +
> +.SH REPORTING BUGS
> +Report bugs to or
> https://sourceware.org/bugzilla/.
> +
> +.SH HISTORY
> +.B elf_getaroff
> +first appeared in elfutils 0.114. This elfutils libelf function may not be
> +found in other libelf implementations.
Looks good otherwise.
Thanks,
Mark
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.
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
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
https://sourceware.org/bugzilla/show_bug.cgi?id=33103
Mark Wielaard changed:
What|Removed |Added
Status|UNCONFIRMED |RESOLVED
Resolution
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
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 )?
https://sourceware.org/bugzilla/show_bug.cgi?id=33103
Mark Wielaard changed:
What|Removed |Added
CC||mark at klomp dot org
--- Comment #1
https://sourceware.org/bugzilla/show_bug.cgi?id=33099
Mark Wielaard changed:
What|Removed |Added
Status|ASSIGNED|RESOLVED
Resolution
(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
https://sourceware.org/bugzilla/show_bug.cgi?id=33099
Mark Wielaard changed:
What|Removed |Added
Status|NEW |ASSIGNED
--- Comment #4 from Mark
https://sourceware.org/bugzilla/show_bug.cgi?id=33099
Mark Wielaard changed:
What|Removed |Added
CC||mark at klomp dot org
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
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
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
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 \
>
https://sourceware.org/bugzilla/show_bug.cgi?id=33062
Mark Wielaard changed:
What|Removed |Added
CC||mark at klomp dot org
--- Comment #1
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
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
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
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
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
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
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
https://sourceware.org/bugzilla/show_bug.cgi?id=33006
Mark Wielaard changed:
What|Removed |Added
Resolution|--- |FIXED
Status|UNCONFIRMED
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(+)
https://sourceware.org/bugzilla/show_bug.cgi?id=33005
Mark Wielaard changed:
What|Removed |Added
CC||mark at klomp dot org
--- Comment #3
https://sourceware.org/bugzilla/show_bug.cgi?id=33006
Mark Wielaard changed:
What|Removed |Added
CC||mark at klomp dot org
--- Comment #2
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 -
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
https://sourceware.org/bugzilla/show_bug.cgi?id=33004
Mark Wielaard changed:
What|Removed |Added
Resolution|--- |NOTABUG
Status
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
https://sourceware.org/bugzilla/show_bug.cgi?id=33003
Mark Wielaard changed:
What|Removed |Added
Resolution|--- |NOTABUG
Status
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
https://sourceware.org/bugzilla/show_bug.cgi?id=33004
Mark Wielaard changed:
What|Removed |Added
CC||mark at klomp dot org
--- Comment #1
https://sourceware.org/bugzilla/show_bug.cgi?id=33003
Mark Wielaard changed:
What|Removed |Added
CC||mark at klomp dot org
--- Comment #1
__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
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
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
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
This is actually v3, because I was nitpicking too much.
But this version is perfect I have nothing to nitpick anymore.
Thanks,
Mark
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
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),
>
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
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
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
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.
Hi Aaron,
Yes, please.
Thanks,
Mark
ost probably not generically. Especially not the container builders.
But you might make some deal with a specific direct hardware worker
admin?
Cheers,
Mark
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
>
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
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
https://sourceware.org/bugzilla/show_bug.cgi?id=32929
Mark Wielaard changed:
What|Removed |Added
Status|UNCONFIRMED |RESOLVED
Resolution
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
https://sourceware.org/bugzilla/show_bug.cgi?id=32929
Mark Wielaard changed:
What|Removed |Added
CC||mark at klomp dot org
--- Comment #1
: 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
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
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
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
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
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
> +.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
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
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
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
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
of their patrons as thank you.
https://xeiaso.net/notes/2025/anubis-works/
https://xeiaso.net/patrons/
Cheers,
Mark
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
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
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.
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
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
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)
> >
&
1 - 100 of 1329 matches
Mail list logo