Re: [PATCH] tests, config: Add more .gitignore files

2024-04-01 Thread Mark Wielaard
On Fri, Mar 29, 2024 at 12:43:08AM +0100, Mark Wielaard wrote: > Some new tests and one configure file weren't in .gitignore. Also > we made a copy of libelf.h in tests/ which should be an symlink. > > * config/.gitignore: Add profile.fish. > * t

Re: [PATCH] readelf: Fix division by zero in handle a relocation sections

2024-04-02 Thread Mark Wielaard
d by RASU JSC. Sorry, but I am going to stop reviewing your patches till you have responded to some of the previous reviews. All your suggested changes are (subtly) wrong. In this case gelf_fsize cannot return zero for example. Please better explain your proposed changes and provide testcases/examples of how the current code is wrong. Thanks, Mark

Re: [PATCH] libdw: dwarf_getsrcfiles should not imply dwarf_getsrclines

2024-04-02 Thread Mark Wielaard
hrough dwarf_getsrcfiles, and the file names >will be broken. */ > > - if (__libdw_getsrclines (table->dbg, line_offset, table->comp_dir, > -table->address_size, NULL, &table->files) < 0) > + if (__libdw_getsrcfiles (table->dbg, line_offset, table->comp_dir, > +table->address_size, &table->files) < 0) > table->files = (void *) -1; > } OK. > diff --git a/libdw/libdwP.h b/libdw/libdwP.h > index c1c84ed3..e55ff50a 100644 > --- a/libdw/libdwP.h > +++ b/libdw/libdwP.h > @@ -1108,6 +1108,16 @@ int __libdw_getsrclines (Dwarf *dbg, Dwarf_Off > debug_line_offset, >internal_function >__nonnull_attribute__ (1); > > +/* Load .debug_line unit at DEBUG_LINE_OFFSET. COMP_DIR is a value of > + DW_AT_comp_dir or NULL if that attribute is not available. Caches > + the loaded unit and set *FILESP with loaded information. Returns 0 > + for success or a negative value for failure. */ > +int __libdw_getsrcfiles (Dwarf *dbg, Dwarf_Off debug_line_offset, > + const char *comp_dir, unsigned address_size, > + Dwarf_Files **filesp) > + internal_function > + __nonnull_attribute__ (1); > + > /* Load and return value of DW_AT_comp_dir from CUDIE. */ > const char *__libdw_getcompdir (Dwarf_Die *cudie); OK. > diff --git a/tests/get-files.c b/tests/get-files.c > index 04091733..fa65aa93 100644 > --- a/tests/get-files.c > +++ b/tests/get-files.c > @@ -24,6 +24,7 @@ > #include ELFUTILS_HEADER(dw) > #include > #include > +#include "../libdw/libdwP.h" > > > int > @@ -76,6 +77,13 @@ main (int argc, char *argv[]) > break; > } > > + if (die->cu->lines != NULL) > + { > + printf ("%s: dwarf_getsrcfiles should not get lines\n", > argv[cnt]); > + result = 1; > + break; > + } > + > const char *const *dirs; > size_t ndirs; > if (dwarf_getsrcdirs (files, &dirs, &ndirs) != 0) > diff --git a/tests/get-lines.c b/tests/get-lines.c > index 188d0162..77fb3c54 100644 > --- a/tests/get-lines.c > +++ b/tests/get-lines.c > @@ -26,6 +26,7 @@ > #include > #include > #include > +#include "../libdw/libdwP.h" > > > int > @@ -69,6 +70,24 @@ main (int argc, char *argv[]) > } > old_cuoff = cuoff; > > + Dwarf_Files *files; > + size_t nfiles; > + > + /* Get files first to test that lines are read separately. */ > + if (dwarf_getsrcfiles (&die, &files, &nfiles) != 0) > + { > + printf ("%s: cannot get files\n", argv[cnt]); > + result = 1; > + break; > + } > + > + if (die.cu->lines != NULL) > + { > + printf ("%s: dwarf_getsrcfiles should not get lines\n", > argv[cnt]); > + result = 1; > + break; > + } > + > Dwarf_Lines *lb; > size_t nlb; > if (dwarf_getsrclines (&die, &lb, &nlb) != 0) > @@ -103,7 +122,6 @@ main (int argc, char *argv[]) > > /* Getting the file path through the Dwarf_Files should >result in the same path. */ > - Dwarf_Files *files; > size_t idx; > if (dwarf_line_file (l, &files, &idx) != 0) > { OK. Tests do use libdwP.h internals. Which isn't great. But OK in this case because there is no other way to test this functionality. tests/run-get-files.sh and tests/run-get-lines.sh also contain testfiles using dwo and dwp files, which all still pass. Thanks, Mark

Re: [PATCH] segment: Fix dangling pointer

2024-04-03 Thread Mark Wielaard
r `old`. OK, but that doesn't really make sense. old isn't a dangling pointer. It is a local pointer that is freed before returning from the function. What do you try to accomplish by assigning it the value NULL? What real issue are you trying to fix? Thanks, Mark > пт, 29 мар. 2024

Re: [PATCH] segment: Fix memory leak in insert()

2024-04-03 Thread Mark Wielaard
On Tue, Apr 02, 2024 at 11:32:50PM +0300, Maks Mishin wrote: > Dynamic memory, referenced by 'naddr', is allocated at segment.c:66 > by calling function 'realloc' and lost at segment.c:92. It isn't lost, it is assigned to dwfl->lookup_addr at segment.c:77 > > Found by RASU JSC. > > Signed-off-b

Re: [PATCH v2 2/2] Hexagon: implement machine flag check

2024-04-04 Thread Mark Wielaard
GElf_Word reserved_flags = ~(EF_HEXAGON_TINY | EF_HEXAGON_MACH); > > return (flags & reserved_flags) == 0; > } > > ... implies a new EF_HEXAGON_TINY 0x8000 definition BTW. You obviously know this architecture better than me. But is the TINY flag (bit 15) appropriate for all machines? It looks like it can only be set on V67 and V71. If so maybe just check those two explicitly? Cheers, Mark

Re: [PATCH v2 1/2] Add support for Hexagon

2024-04-04 Thread Mark Wielaard
agon.ko.bz2. * tests/hello_hexagon.ko.bz2: New test file. * tests/run-strip-reloc-ko.sh: Add hello_hexagon.ko. This is mainly for my own review, so I know all changes were actually intended. Pushed, Mark

Re: [PATCH v2 2/2] Hexagon: implement machine flag check

2024-04-04 Thread Mark Wielaard
be in those cases? OK, if there could be other TINY variants then either the check suggested by Matheus or you would be more correct. I do like the idea to have a self documenting EF_HEXAGON_TINY constant for this. Thanks, Mark

Re: [PATCH v3] Hexagon: implement machine flag check

2024-04-04 Thread Mark Wielaard
ded ChangeLog to commit message. > - Implemented better machine_flag_check operation, as suggested by > bcain. > - Extracted only patch 2/2 as 1/2 was already merged. This looks good. Pushed, Mark

Re: [PATCH v3 5/6] stack: Fix stack unwind failure on mips

2024-04-05 Thread Mark Wielaard
-core-.sh with tests/tests/backtrace..{exec,core}.bz2 so it can be tested from a non-MIPS setup (as opposed to the tests/run-backtrace-native.sh and tests/run-backtrace-native-core.sh tests). Thanks, Mark

Re: [PATCH v3 6/6] backends: Add register_info, return_value_location, core_note function on mips

2024-04-05 Thread Mark Wielaard
tly this backend only handles the 64 bit little endian one? Again it would be nice if you could come up with non-native variants of the tests so the implementation can also be tested on non-MIPS arches. Specifically for tests/run-allregs.sh, tests/run-funcretval.sh and/or tests/run-readelf-mixed-corenote.sh. Thanks, Mark

Re: [PATCH v3] Hexagon: implement machine flag check

2024-04-05 Thread Mark Wielaard
ractive, but it would be a lot of work recreating the existing binary test files. And nobody has tried yet, so we don't know if this (or some other tool) is expressive enough. Cheers, Mark

Re: [PATCH] strip: Add check for elf_begin() result

2024-04-05 Thread Mark Wielaard
y understand the code. In this case if debugelf == NULL then gelf_newehdr will also return NULL to indicate the earlier error. This is a common pattern in the libelf code. Thanks, Mark > Found by RASU JSC. > > Signed-off-by: Maks Mishin > --- > src/strip.c | 4 +++- >

Re: Elfutils Code of Conduct

2024-04-07 Thread Mark Wielaard
Hi, On Thu, Mar 28, 2024 at 12:25:32PM -0400, Aaron Merey wrote: > This code of conduct includes a committee to handle any complaints or > concerns that fall under the code. Mark and I have offered to be on this > committee. If anyone else would like to be a member of the elfutils

Re: [rfc] [patch] PR28204: debuginfod ima signature verification

2024-04-09 Thread Mark Wielaard
S) $(sqlite3_LIBS) > $(libarchive_LIBS) $(rpm_LIBS) -lpthread -ldl > > debuginfod_find_SOURCES = debuginfod-find.c > debuginfod_find_LDADD = $(libdw) $(libelf) $(libeu) $(libdebuginfod) > $(argp_LDADD) $(fts_LIBS) > @@ -97,7 +97,7 @@ libdebuginfod_so_LIBS = libdebuginfod_pic.a

Re: [PATCH] libdw: dwarf_getsrcfiles should not imply dwarf_getsrclines

2024-04-10 Thread Mark Wielaard
t; > + file[7] = "include/linux/sched.h" > + file[8] = "include/asm/thread_info.h" > + file[9] = "include/linux/thread_info.h" > + file[10] = "include/asm/atomic.h" > + file[11] = "include/linux/list.h" > + file[12] = "include/linux/cpumask.h" > + file[13] = "include/linux/rbtree.h" > + file[14] = "include/asm/page.h" > + file[15] = "include/linux/rwsem.h" > + file[16] = "include/asm/rwsem.h" > + file[17] = "include/asm/spinlock.h" > + file[18] = "include/linux/completion.h" > + file[19] = "include/linux/wait.h" > + file[20] = "include/linux/aio.h" > + file[21] = "include/linux/workqueue.h" > + file[22] = "include/linux/timer.h" > + file[23] = "include/linux/types.h" > + file[24] = "include/asm/posix_types.h" > + file[25] = "include/linux/pid.h" > + file[26] = "include/linux/time.h" > + file[27] = "include/linux/capability.h" > + file[28] = "include/linux/signal.h" > + file[29] = "include/linux/resource.h" > + file[30] = "include/linux/sem.h" > + file[31] = "include/asm/fpu.h" > + file[32] = "include/linux/fs_struct.h" > + file[33] = "include/asm/signal.h" > + file[34] = "include/asm/siginfo.h" > + file[35] = "include/asm-generic/siginfo.h" > + file[36] = "include/asm/nodedata.h" > + file[37] = "include/linux/mmzone.h" > + file[38] = "include/linux/jiffies.h" > + file[39] = "include/asm/io.h" > + file[40] = "include/asm/machvec.h" > + file[41] = "include/asm/smp.h" > + file[42] = "include/asm/numa.h" > + file[43] = "include/linux/slab.h" > +EOF > + > +# Files should be printed 3 times, followed by the files from > DW_LNE_define_file > +cat files > define-files.out > +cat files >> define-files.out > +cat files >> define-files.out > +echo ' file[44] = "include/asm/abc.c"' >> define-files.out > +echo ' file[45] = "include/linux/01.c"' >> define-files.out > + > +cat define-files.out | testrun_compare ${abs_builddir}/get-files-define-file > testfile-define-file > + > exit 0 Nice. So testfile-define-file is actually testfile36.debug but with a new line program? How did you edit/insert that one? Cheers, Mark

Re: [PATCH] libdw: dwarf_getsrcfiles should not imply dwarf_getsrclines

2024-04-11 Thread Mark Wielaard
am > that was easy to replace with two DW_LNE_define_file opcodes without > corrupting things. Fun. Could you add a small description to tests/run-get-files.sh where testfile-define-file is use so future hackers know how the file was created? All looks good BTW. Please do push (if possible with the above change). Thanks, Mark

Re: [rfc] [patch] PR28204: debuginfod ima signature verification

2024-04-11 Thread Mark Wielaard
ial replacement of files). Relying on https and CRC checking seems simpler to understand for that. But you are right that there isn't really anyhing for the main executables. For the source files you could check the lenght and time stamps (or the MD5 sums if added by the DWARF producer). &g

[PATCH] ar: Replace one alloca use by xmalloc

2024-04-30 Thread Mark Wielaard
. Signed-off-by: Mark Wielaard --- src/ar.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ar.c b/src/ar.c index e6d6d58f2b3b..fcb8bfb90a9f 100644 --- a/src/ar.c +++ b/src/ar.c @@ -41,6 +41,7 @@ #include #include +#include "libeu.h" #include "arlib.h&

[PATCH] readelf: Fix printing of DW_FORM_strx and DW_MACRO parsing

2024-05-04 Thread Mark Wielaard
efore calling print_form_data. * tests/testfileclangmacro.bz2: New testfile. * tests/Makefile.am (EXTRA_DIST): Add testfileclangmacro.bz2. * tests/run-readelf-macro.sh: Add testfileclangmacro output. Signed-off-by: Mark Wielaard --- src/readelf.c| 13 +-

Re: [PATCH] ar: Replace one alloca use by xmalloc

2024-05-12 Thread Mark Wielaard
Hi Aaron, On Fri, May 10, 2024 at 05:16:06PM -0400, Aaron Merey wrote: > On Tue, Apr 30, 2024 at 10:39 AM Mark Wielaard wrote: > > > > This alloca use is inside a lexical block and is used to replace one > > element of argv. Use a function local variable, xmalloc and fr

Re: [PATCH] readelf: Fix printing of DW_FORM_strx and DW_MACRO parsing

2024-05-14 Thread Mark Wielaard
Hi, On Sun, 2024-05-05 at 00:15 +0200, Mark Wielaard wrote: > print_form_data didn't take the offset_len (4 or 8 bytes) into account > causing the wrong entry to be read from .debug_str_offsets. > print_debug_macro_section did sanity checking before calling > print_form_data,

Re: [rfc] [patch] PR28204: debuginfod ima signature verification

2024-05-14 Thread Mark Wielaard
and formulate the security attack we are trying to defend against with ima verification first. Cheers, Mark

Re: [PATCH] Fix 'make coverage' when used with lcov version 2.0+

2024-05-14 Thread Mark Wielaard
ed as "not collegial and exaggerated", then maybe next time also provide an example of how to formulate the request that sounds better. Tone is a difficult thing, especially on the mailinglist. Cheers, Mark

Re: [PATCH] readelf: add pretty printing for FDO Dlopen Metadata note

2024-05-14 Thread Mark Wielaard
when the elf.h change is accepted in glibc, then we'll sync and integrate this. Thanks, Mark > > Signed-off-by: Luca Boccassi > --- > libebl/eblobjnote.c | 9 +++-- > libebl/eblobjnotetypename.c | 3 +++ > libelf/elf.h| 4 > 3 files c

Re: [PATCH] readelf: add pretty printing for FDO Dlopen Metadata note

2024-05-31 Thread Mark Wielaard
Hi Luca, On Thu, 2024-05-30 at 11:45 +0100, Luca Boccassi wrote: > On Tue, 14 May 2024 at 22:18, Mark Wielaard wrote: > > Not a fan of json, feels very un-ELF. But it is what it is. The patch > > looks OK. Could you let us know when the elf.h change is accepted in > > glibc

[PATCH 1/2] libelf: Sync elf.h from glibc

2024-05-31 Thread Mark Wielaard
* libelf/elf.h: Adds AT_HWCAP{3,4}, NT_FDO_DLOPEN_METADATA and R_LARCH_TLS_DESC{32,64}. Signed-off-by: Mark Wielaard --- libelf/elf.h | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libelf/elf.h b/libelf/elf.h index f2206e5c065d..081742a9c38c

[PATCH 2/2] readelf: add pretty printing for FDO Dlopen Metadata note

2024-05-31 Thread Mark Wielaard
From: Luca Boccassi The node ID and the string format are now fixed, even if the content of the string might change, it will still be a string. * libebl/eblobjnote.c (ebl_object_note): Handle both type being NT_FDO_PACKAGING_METADATA or NT_FDO_DLOPEN_METADATA when name is "FDO".

Re: elfutils DWARF problem was: Re: Problem with BTF generation on mips64el

2024-06-11 Thread Mark Wielaard
Hi, Adding elfutils-devel to CC to keep everyone up to date on the state of the patches. On Mon, 2024-06-10 at 23:36 -0700, Tony Ambardar wrote: > On Mon, Jun 03, 2024 at 08:47:24PM -0700, Tony Ambardar wrote: > > On Mon, Jun 03, 2024 at 09:18:33PM +0200, Mark Wielaard wrote: > >

Re: make dist considered harmful: odd gotcha with building elfutils rpms

2024-06-11 Thread Mark Wielaard
at the rest of the tree > behaves). Yes, I'll sent a patch. > But I think the root cause is more the continued reliance > on "make dist", made necessary by the exclusion of generated autoconf* > materiel in the source tree. I really don't think putting generated file into git is a good idea. You get all those issues that gcc, binutils and gdb have where you need all this extra CI just to make sure people use the "correct" tools to regenerate the files. Cheers, Mark

[PATCH] doc: Always distribute all man pages

2024-06-11 Thread Mark Wielaard
dist targets shouldn't depend on configure conditionals. * doc/Makefile.am: Remove DEBUGINFOD and LIBDEBUGINFOD from dist targets. Add comments about which man pages go into which section. Signed-off-by: Mark Wielaard --- doc/Makefile.am | 33 +++

Re: make dist considered harmful: odd gotcha with building elfutils rpms

2024-06-12 Thread Mark Wielaard
> unsatisfactory version, any other developer (or a bot) can regen and > fix it. It seems to me a non-problem. Having each committer push generated files with their own variant of the tools causes generates updates that are hard to sanity check by others. Cheers, Mark

Re: [PATCH] doc: Always distribute all man pages

2024-06-16 Thread Mark Wielaard
Hi, On Tue, Jun 11, 2024 at 06:48:49PM +0200, Mark Wielaard wrote: > dist targets shouldn't depend on configure conditionals. > > * doc/Makefile.am: Remove DEBUGINFOD and LIBDEBUGINFOD from > dist targets. Add comments about which man pages go into which > sect

Re: ☝ Buildbot (Sourceware): elfutils - worker cannot substantiate (main)

2024-06-16 Thread Mark Wielaard
/281 > > Build state: worker cannot substantiate > Revision: (unknown) > Worker: bb1-1 > Build Reason: (unknown) > Blamelist: Mark Wielaard Turns out current fedora rawhide is uninstallable because of a partial python transition. I have disabled the rawhide container builders for now. Cheers, Mark

Re: [PATCH] Add man pages for some libelf functions

2024-06-21 Thread Mark Wielaard
RIPTION > +The \fBelf_version\fP function sets the library's ELF version to the > specified value. This function must be called before any other libelf > functions are used. > + > +.SH PARAMETERS > +.TP > +.I version > +An \fIunsigned int\fP value specifying the desired ELF library version. This > is should be set to \fBEV_CURRENT\fP to indicate the current version of the > library. At this time the only supported \fIversion\fP values are > \fBEV_CURRENT\fP and \fBEV_NONE\fP. > + > +.SH RETURN VALUE > +The \fBelf_version\fP function returns \fBEV_CURRENT\fP when \fIversion\fP > is supported. If the specified version is not supported, it returns > \fBEV_NONE\fP. > + > +.SH REPORTING BUGS > +Report bugs to or > https://sourceware.org/bugzilla/. > elf_version is kind of funny. EV_CURRENT is 1 and I don't believe we will ever see another ELF version. Cheers, Mark

[PATCH 1/4] libdwfl: Make sure mapped is always set in unzip

2024-06-22 Thread Mark Wielaard
always called with *_whole being NULL. * libdwfl/gzip.c (unzip): Set mapped = state.input_buffer when *whole is not NULL. Signed-off-by: Mark Wielaard --- libdwfl/gzip.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libdwfl/gzip.c b/libdwfl/gzip.c index 002afc4e916b

[PATCH 2/4] libelf: elf32_getshdr might leak section header when out of memory

2024-06-22 Thread Mark Wielaard
Found by GCC -fanalyzer. When allocating the notcvt buffer fails we leak the shdr. goto free_and_out on malloc failure. * libelf/elf32_getshdr.c (load_shdr_wrlock): goto free_and_out on second malloc failure. Signed-off-by: Mark Wielaard --- libelf/elf32_getshdr.c

[PATCH 3/4] debuginfod-client: Don't leak id/version with duplicate os-release entries

2024-06-22 Thread Mark Wielaard
): Check whether id or version is already set before resetting them. Signed-off-by: Mark Wielaard --- debuginfod/debuginfod-client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c index 95f2a92b701c

[PATCH 4/4] ar, ranlib: Don't double close file descriptors

2024-06-22 Thread Mark Wielaard
to -1. (do_oper_delete): Likewise. (do_oper_insert): Likewise. * src/ranlib.c (handle_file): Likewise. Signed-off-by: Mark Wielaard --- src/ar.c | 12 ++-- src/ranlib.c | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ar.c b/src/ar.c

Re: [PATCH 1/4] libdwfl: Make sure mapped is always set in unzip

2024-06-25 Thread Mark Wielaard
Hi, On Sun, Jun 23, 2024 at 01:50:10AM +0200, Mark Wielaard wrote: > Found by GCC14 -Wanalyzer-null-argument. Aaron took a quick look on irc and said all 4 patches looked reasonable. So I pushed them all to main now. Cheers, Mark

Re: [PATCH] Add man pages for some libelf functions

2024-06-28 Thread Mark Wielaard
NT is the only supported version. When given EV_NONE it won't initialize the library, but return the highest supported version (which is EV_CURRENT obviously). > +.SH RETURN VALUE > +The \fBelf_version\fP function returns \fBEV_CURRENT\fP when \fIversion\fP > is supported. If the specified version is not supported, it returns > \fBEV_NONE\fP. ^ If the version given is not EV_NONE. If the version given is EV_NONE it will return EV_CURRENT. Cheers, Mark

Re: [PATCH] Fix deref-of-null in handle_file_note()

2024-07-02 Thread Mark Wielaard
rom zero to lastix retval is set when mix == firstix. So when firstix < mix retval is definitely set. Cheers, Mark

Re: [PATCH] size: Fix deref-of-null in handle_ar() function

2024-07-02 Thread Mark Wielaard
plain why you believe the tool reports are correct. https://inbox.sourceware.org/elfutils-devel/20240405190452.gh1...@gnu.wildebeest.org/ Cheers, Mark

Re: [PATCH] unstrip: Fix deref-of-null in copy_elided_sections()

2024-07-02 Thread Mark Wielaard
On Mon, Jul 01, 2024 at 11:53:13PM +0300, Maks Mishin wrote: > Pointer `symstrdata` is dereferenced at unstrip.c:1977 without checking for > NULL. If there has to be a NULL check then it needs to be when symstrdata is assigned a value from elf_getdata. Cheers, Mark

Re: [PATCH] readelf: Fix memory leak in print_hash_info()

2024-07-02 Thread Mark Wielaard
.c > +++ b/src/readelf.c > @@ -3597,6 +3597,7 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn, GElf_Shdr > *shdr, size_t shstrndx, > { >error (0, 0, _("invalid sh_link value in section %zu"), >elf_ndxscn (scn)); > + free (counts); > return; > } That looks correct. Pushed. Thanks, Mark

Re: [PATCH] sparc_attrs: Fix string overflow

2024-07-02 Thread Mark Wielaard
be big enough as the comment says: /* NAME should be big enough to hold any possible comma-separated list (no repetitions allowed) of attribute names from one of the arrays above. */ static char name[32*17+32+1]; Maybe there is a way to add a static assert for this? Cheers, Mark

patchwork cleanup

2024-07-03 Thread Mark Wielaard
views/questions. https://patchwork.sourceware.org/project/elfutils/list/?series=15310&state=* Thanks, Mark

Re: [PATCH] libdwfl: Make dwfl_report_offline_memory work with ELF_C_READ_MMAP

2024-07-12 Thread Mark Wielaard
Hi Aleksei, On Thu, 2024-07-11 at 20:35 +, Aleksei Vetrov wrote: > elf_memory open mode recently changed from ELF_C_READ to > ELF_C_READ_MMAP. That was this commit: commit cc44ac6740797a23cd0af0cb22bd828d569224b8 Author: Mark Wielaard Date: Thu Feb 1 14:56:18 2024 +0100 libelf:

Re: [PATCH] backends: allocate enough stace for null terminator

2024-07-17 Thread Mark Wielaard
{'b', 'p'}, + {'s', 'i'}, + {'d', 'i'}, + {'i', 'p'}, }; case 4: ? Since the use of this array is basically just: name[0] = 'r'; name[1] = baseregs[regno][0]; name[2] = baseregs[regno][1]; I think I prefer the individual bytes init way. It makes more clear what we really use these arrays for. imho. Thanks, Mark

Re: [PATCH v2] backends: allocate enough stace for null terminator

2024-07-18 Thread Mark Wielaard
to. This looks good. I have pushed it to main. Will this warning be enabled by -Wall or -Wextra (both of which are enabled by default for elfutils builds)? Or would be need to enable it explicitly? Thanks, Mark

Re: [PATCH 1/9 v2] libelf: Fix deadlock in __libelf_readall

2024-07-18 Thread Mark Wielaard
On Wed, 2024-07-17 at 18:34 -0400, Aaron Merey wrote: > From: Heather McIntyre > > Apply locking during __libelf_readall. > > Signed-off-by: Heather S. McIntyre > Signed-off-by: Aaron Merey > Signed-off-by: Mark Wielaard > > --- > v2 changes: > >

Re: [PATCH 2/9 v2] libelf: Fix deadlock in elf_cntl

2024-07-18 Thread Mark Wielaard
Hi, On Wed, 2024-07-17 at 18:34 -0400, Aaron Merey wrote: > From: Heather McIntyre > > * libelf/elf_cntl.c (elf_cntl): Move rwlock_wrlock, rwlock_unlock, > inside case switch statements. > > Signed-off-by: Heather S. McIntyre > Signed-off-by: Aaron Merey

Re: [PATCH 4/9 v2] libdw: make dwarf_getalt thread-safe

2024-07-18 Thread Mark Wielaard
Hi, On Wed, Jul 17, 2024 at 06:34:03PM -0400, Aaron Merey wrote: > From: Heather McIntyre > > * libdw/dwarf_getalt.c (dwarf_getalt): Add locking. > > Signed-off-by: Heather S. McIntyre > Signed-off-by: Aaron Merey > Signed-off-by: Mark Wielaard > > v2 c

Re: [PATCH 5/9 v2] libdwP.h: Add locking to __libdw_dieabbrev,

2024-07-18 Thread Mark Wielaard
Hi, On Wed, Jul 17, 2024 at 06:34:04PM -0400, Aaron Merey wrote: > From: Heather McIntyre > > Signed-off-by: Heather S. McIntyre > Signed-off-by: Aaron Merey > Signed-off-by: Mark Wielaard > > --- > > v2 changes: > This replaces patch "libdw: Add l

Re: [PATCH 6/9 v2] libdw: Make libdw_find_split_unit thread-safe

2024-07-18 Thread Mark Wielaard
Hi, On Wed, Jul 17, 2024 at 06:34:05PM -0400, Aaron Merey wrote: > From: Heather McIntyre > > * (__libdw_find_split_unit): Add lock for cu->split. > > Signed-off-by: Heather S. McIntyre > Signed-off-by: Aaron Merey > Signed-off-by: Mark Wielaard > >

Re: [PATCH 7/9 v2] libdw: Make libdw_findcu thread-safe

2024-07-19 Thread Mark Wielaard
tyre > Signed-off-by: Aaron Merey > Signed-off-by: Mark Wielaard > > --- > v2 changes: > Use per-Dwarf_CU lock instead of a global lock. Are you sure this description and the ChangeLog entry are correct? This patch doesn't contain a change to use eu_tfind (there is already one

Re: [PATCH 3/9 v2] lib: Add eu_tsearch, eu_tfind, eu_tdelete and eu_tdestroy

2024-07-19 Thread Mark Wielaard
Move the rwlock_* macros out of eu-config.h and into a new header file > locks.h. This was done so that the rwlock_* macros can be included > in libdwP.h without having to also include the rest of eu-config.h. > > Signed-off-by: Heather S. McIntyre > Signed-off-by: Aaron Merey

Re: [PATCH] Add man pages for some libelf functions

2024-07-21 Thread Mark Wielaard
Hi Aaron, Some small comments below. On Thu, Jul 18, 2024 at 10:03:02PM -0400, Aaron Merey wrote: > Add man pages for elf32_offscn.3, elf64_offscn.3, elf_getscn.3 and > elf_ndxscn.3. > > Signed-off-by: Aaron Merey > --- > > Reposting this patch with the new man pages added to doc/Makefile.am.

Re: debuginfod support for split dwarf

2024-07-21 Thread Mark Wielaard
uld be served by the current debuginfod protocol? Also no. Not in memory. There are the dwp files though. Cheers, Mark

Re: [PATCH 01/10 v3] libelf: Fix deadlock in __libelf_readall

2024-08-15 Thread Mark Wielaard
Hi Aaron, On Fri, 2024-08-02 at 19:38 -0400, Aaron Merey wrote: > From: Heather McIntyre > > Apply locking during __libelf_readall. > > Signed-off-by: Heather S. McIntyre > Signed-off-by: Aaron Merey > Signed-off-by: Mark Wielaard > > --- > v3 changes: > &

Re: [PATCH 02/10 v3] libelf: Fix deadlock in elf_cntl

2024-08-15 Thread Mark Wielaard
McIntyre > Signed-off-by: Aaron Merey > Signed-off-by: Mark Wielaard > > --- > v3 changes: > Remove unnecessary early return that would require locking to > check condition. The code looks good and clean now. Thanks, Mark

Re: [PATCH 03/10 v3] lib: Add eu_tsearch, eu_tfind, eu_tdelete and eu_tdestroy

2024-08-15 Thread Mark Wielaard
* elf_getdata_rawchunck.c: Ditto. > * libelfP.h (struct Elf): Replace void * rawchuncks memeber with > search_tree rawchunk_tree. Nice Changelog. (note the memeber typo) > Signed-off-by: Heather S. McIntyre > Signed-off-by: Aaron Merey > Signed-off-by: Mark Wielaard

Re: [PATCH 04/10 v3] libdw: Add rwlocks for Dwarf and Dwarf_CU

2024-08-16 Thread Mark Wielaard
dwarf_getalt for the dwarf_lock, dwarf_formref_die and __libdw_dieabbrev for abbrev_lock). It might also be a good idea to explicitly document which structure fields are "protected" by the separate locks to make reasoning about them a little easier. Cheers, Mark

Re: [PATCH 05/10 v3] libdw: make dwarf_getalt and dwarf_setalt thread-safe

2024-08-16 Thread Mark Wielaard
On Fri, 2024-08-02 at 19:38 -0400, Aaron Merey wrote: > From: Heather McIntyre > > * libdw/dwarf_getalt.c (dwarf_getalt): Add locking. > * libdw/dwarf_setalt.c (dwarf_setalt): Ditto. > > Signed-off-by: Heather S. McIntyre > Signed-off-by: Aaron Merey > Sign

Re: [PATCH 09/10 v3] tests: Add eu-search tests

2024-08-16 Thread Mark Wielaard
efined. > (eu_search_die_LDFLAGS): Likewise. > (eu_search_lines_LDFLAGS): Likewise. > (eu_search_macros_LDFLAGS): Likewise. > > Signed-off-by: Heather S. McIntyre > Signed-off-by: Aaron Merey > Signed-off-by: Mark Wielaard > > --- > No changes betwee

Re: [PATCH 07/10 v3] libdw: Make libdw_find_split_unit thread-safe

2024-08-16 Thread Mark Wielaard
cIntyre > Signed-off-by: Aaron Merey > Signed-off-by: Mark Wielaard > > --- > v3 changes: > Move Dwarf split_lock code from patch 3/9 v2 to this patch. > Assign return value before releasing lock. Looks good this way. Thanks, Mark > libdw/dwarf_end.c

Re: [PATCH 08/10 v3] libdw: Make libdw_findcu thread-safe

2024-08-16 Thread Mark Wielaard
Hi, On Fri, Aug 02, 2024 at 07:38:07PM -0400, Aaron Merey wrote: > From: Heather McIntyre > > * libdw/libdw_findcu.c (__libdw_findcu): Add locking. > > Signed-off-by: Heather S. McIntyre > Signed-off-by: Aaron Merey > Signed-off-by: Mark Wielaard > &

Re: [PATCH 06/10 v3] libdwP.h: Add locking to dwarf_formref_die and __libdw_dieabbrev

2024-08-16 Thread Mark Wielaard
igned-off-by: Heather S. McIntyre > Signed-off-by: Aaron Merey > Signed-off-by: Mark Wielaard > > v3 changes: > Move dwarf_setalt.c changes to patch 5/9 v3. > Set __libdw_dieabbrev result before releasing lock. > --- > libdw/dwarf_formref_die

Re: [PATCH 0/3] aarch64: add some core note types name

2024-08-16 Thread Mark Wielaard
with the glibc elf/elf.h. Since they recently added the same (and more) NT_ARM_* constants I'll sync that file seperately before incorporating your patch. Did you test the output on a core file that has these new regsets and core notes with eu-readelf to see if it looks correct? Thanks, Mark

[COMMITTED] libelf: Sync elf.h from glibc

2024-08-16 Thread Mark Wielaard
* libelf/elf.h: Adds NT_ARM_{SSVE,ZA,ZT,FPRM} Signed-off-by: Mark Wielaard --- libelf/elf.h | 4 1 file changed, 4 insertions(+) diff --git a/libelf/elf.h b/libelf/elf.h index 081742a9c38c..33aea7f743b8 100644 --- a/libelf/elf.h +++ b/libelf/elf.h @@ -831,6 +831,10 @@ typedef

Re: [PATCH 1/3] aarch64: Add NT_ARM_TAGGED_ADDR_CTRL regset

2024-08-16 Thread Mark Wielaard
agging-extension.html Implementation looks correct. Pushed, Mark > > Signed-off-by: Kuan-Ying Lee > --- > backends/aarch64_corenote.c | 11 ++- > libebl/eblcorenotetypename.c | 1 + > 2 files changed, 11 insertions(+), 1 deletion(-) > > diff --git a/backends

Re: [PATCH 2/3] aarch64: Add NT_ARM_PAC_* regset

2024-08-16 Thread Mark Wielaard
cannot find the definition. This assumes it is just one 8 byte word. Is that correct? Can it be more than one? Thanks, Mark > Signed-off-by: Kuan-Ying Lee > --- > backends/aarch64_corenote.c | 24 +++- > libebl/eblcorenotetypename.c | 2 ++ > 2 files changed

Re: [PATCH 3/3] aarch64: add some new core note types name

2024-08-16 Thread Mark Wielaard
Hi, On Wed, Aug 14, 2024 at 04:51:20PM +0800, Kuan-Ying Lee wrote: > Recognize names of some new core note types in ebl_core_note_type_name. Thanks. Pushed the eblcorenotetypename.c part. I pushed a glibc elf.h sync separately (commit 0abdd2e79). Cheers, Mark

Re: [PATCH 5/5] libdwfl, aarch64: Read PAC mask from core

2024-08-16 Thread Mark Wielaard
14085134.109500-3-kuan-ying@canonical.com/ Luckily the patches agree on the definition of the the pac_items (modulo the name data_mask/insn_mask vs pauth_dmask/pauth_cmask). This patch doesn't introduce a regset for ARM_PAC_ENABLED_KEYS that the other one does. Is this not necessary? Tha

Re: [PATCH 1/5] aarch64: Create definitions for AARCH64_RA_SIGN_STATE register

2024-08-20 Thread Mark Wielaard
ial_registers_tid); >HOOK (eh, unwind); That should still be 97. RA_SIGN_STATE is regno 34, which was reserved before, followed by 29 Resered regs (35-43). Cheers, Mark

Re: [PATCH 2/5] libdw, aarch64: Implement DW_CFA_AARCH64_negate_ra_state CFI instruction

2024-08-20 Thread Mark Wielaard
result))) > + goto out; > + fs->regs[DW_AARCH64_RA_SIGN_STATE].value ^= 0x1; > } > else > { Funny we already had some code here to handle DW_CFA_AARCH64_negate_ra_state (and how unfortunate it overlaps with DW_CFA_GNU_window_save, but there is already an em check). Also looks good. Thanks, Mark

Re: [PATCH 1/5] aarch64: Create definitions for AARCH64_RA_SIGN_STATE register

2024-08-20 Thread Mark Wielaard
der). Since this is really just a private detail for CFI could we define it in cfi.h (which is a private elfutils header)? Cheers, Mark

Re: [PATCH 0/5] Enable PAC support in elfutils

2024-08-20 Thread Mark Wielaard
gly. But given we can hide most of it in architecture specific/private code better than special case public architecture functions. Cheers, Mark

[PATCH] debuginfod: Make sure crypto and jsonc are also included in static link

2024-08-21 Thread Mark Wielaard
When doing a --enable-gcov build we link all binaries static. libdebuginfod.so now depends on crypto an jsonc. So also add those when linking against libdebuginfod.a debuginfod/Makefile.am (libdebuginfod): Add $(crypto_LIBS) $(jsonc_LIBS) when BUILD_STATIC. Signed-off-by: Mark

[PATCH] tests: When BUILD_STATIC always link against libeu

2024-08-21 Thread Mark Wielaard
libeu is a static library with internal helper functions normally included in all shared libraries. But when linking static (with --enable-gcov) we need to explicitly link it into the test binaries. * tests/Makefile.am (libelf): Add $(libeu) when BUILD_STATIC. Signed-off-by: Mark Wielaard

Re: [PATCH] debuginfod: Make sure crypto and jsonc are also included in static link

2024-08-21 Thread Mark Wielaard
Hi, On Wed, Aug 21, 2024 at 03:32:59PM +0200, Mark Wielaard wrote: > When doing a --enable-gcov build we link all binaries static. > libdebuginfod.so now depends on crypto an jsonc. So also add those > when linking against libdebuginfod.a > > debuginfod/Makefile.am (libd

Re: [PATCH] tests: When BUILD_STATIC always link against libeu

2024-08-21 Thread Mark Wielaard
Hi, On Wed, Aug 21, 2024 at 03:52:20PM +0200, Mark Wielaard wrote: > libeu is a static library with internal helper functions normally > included in all shared libraries. But when linking static (with > --enable-gcov) we need to explicitly link it into the test binaries. > >

Re: [PATCH 1/9] doc: Add elf32_checksum.3 and elf64_checksum.3

2024-08-27 Thread Mark Wielaard
BUTES > +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 elf32_checksum () > +T} Thread safety MT-Safe > +.TE > + > +.SH REPORTING BUGS > +Report bugs to or > https://sourceware.org/bugzilla/. Cheers, Mark

Re: [PATCH 2/9] doc: Add elf32_fsize.3 and elf64_fsize.3

2024-08-27 Thread Mark Wielaard
e > +.BR attributes (7). > +.TS > +allbox; > +lbx lb lb > +l l l. > +InterfaceAttribute Value > +T{ > +.na > +.nh > +.BR elf32_fsize () > +T} Thread safety MT-Safe > +.TE > + > +.SH REPORTING BUGS > +Report bugs to or > https://sourceware.org/bugzilla/. Cheers, Mark

Re: [PATCH 3/9] doc: Add elf32_getchdr.3 and elf64_getchdr.3

2024-08-27 Thread Mark Wielaard
hdr > +first appeared in elfutils 0.165. This elfutils libelf function may not be > found in other libelf implementations. Yes, but it has been standardized: http://www.linker-aliens.org/blogs/ali/entry/elf_section_compression/ Cheers, Mark

Re: [PATCH 4/9] doc: Add elf32_getphdr.3 and elf64_getphdr.3

2024-08-27 Thread Mark Wielaard
gt; +.BR libelf (3), > +.BR elf (5) Add elf_getphdrnum and elf32_newphdr. > +.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 elf32_getphdr () > +T} Thread safety MT-Safe > +.TE > + > +.SH REPORTING BUGS > +Report bugs to or > https://sourceware.org/bugzilla/. Cheers, Mark

Re: [PATCH 5/9] doc: Add elf32_getshdr.3 and elf64_getshdr.3

2024-08-27 Thread Mark Wielaard
.BR elf (5) Add elf_flagshdr. > +.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 elf32_getshdr () > +T} Thread safety MT-Safe > +.TE > + > +.SH REPORTING BUGS > +Report bugs to or > https://sourceware.org/bugzilla/. Cheers, Mark

Re: [PATCH 6/9] doc: Add elf32_newehdr.3 and elf64_newehdr.3

2024-08-28 Thread Mark Wielaard
IBUTES > +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 elf32_newehdr () > +T} Thread safety MT-Safe > +.TE > + > +.SH REPORTING BUGS > +Report bugs to or > https://sourceware.org/bugzilla/. Cheers, Mark

Re: [PATCH 7/9] doc: Add elf32_newphdr.3 and elf64_newphdr.3

2024-08-28 Thread Mark Wielaard
+.BR elf_errno (3), > +.BR elf64_newphdr (3), > +.BR libelf (3), > +.BR elf (5) > + > +.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 elf32_newphdr () > +T} Thread safety MT-Safe > +.TE > + > +.SH REPORTING BUGS > +Report bugs to or > https://sourceware.org/bugzilla/. Cheers, Mark

Re: [PATCH 8/9] doc: Add elf32_xlatetof.3 and elf64_xlatetof.3

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

[PATCH] elf*_xlatetof: do not check ELF_T_NHDR[8] has integer number of records

2024-08-28 Thread Mark Wielaard
number of records in case of ELF_T_NHDR[8]. Signed-off-by: Mark Wielaard --- libelf/elf32_xlatetof.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libelf/elf32_xlatetof.c b/libelf/elf32_xlatetof.c index ab857409329a..ab3e609ee5d2 100644 --- a/libelf/elf32_xlatetof.c ++

[PATCH] libelf: Don't crash elf[32|64]_xlateto[fm] on bad arguments.

2024-08-28 Thread Mark Wielaard
Check that src and dest aren't NULL and that src->d_type < ELF_T_NUM. * elf32_xlatetof.c (elfw2(LIBELFBITS, xlatetof)): Check src, dest and src->d_type are valid. * elf32_xlatetom.c (elfw2(LIBELFBITS, xlatetom)): Likewise. Signed-off-by: Mark Wielaar

elf_memory again, readonly or readwrite...

2024-08-29 Thread Mark Wielaard
Hi, So we changed elf_memory so it pretends the in-memory Elf image is read with ELF_C_READ_MMAP. This helps when calling elf_memory on read-only memory which still wants to change some things about the Elf like uncompress some sections (which changes the section header). With ELF_C_READ_MMAP lib

Re: [PATCH v2 0/5] Enable PAC support in elfutils

2024-08-30 Thread Mark Wielaard
about is the usage of struct user_pac_mask in aarch64_initreg.c. It might not be defined on older aarch64 systems. Hopefully the buildbot (or some aarch64 user) will catch that if it really is an issue. Thanks, Mark > Cheers, > -- > Steve > > German Gomez (3): > aarch64: Crea

Re: [PATCH 2/3] aarch64: Add NT_ARM_PAC_* regset

2024-08-30 Thread Mark Wielaard
Hi Kuan-Ying, On Mon, 2024-08-19 at 17:43 +0800, Kuan-Ying Lee wrote: > On Sat, Aug 17, 2024 at 01:36:33AM +0200, Mark Wielaard wrote: > > On Wed, Aug 14, 2024 at 04:51:19PM +0800, Kuan-Ying Lee wrote: > > > Add the NT_ARM_PAC_MASK and NT_ARM_PAC_ENABLED_KEYS for aarch64. &

[COMMITTED] readelf: Fix printing of .gdb_index symbol table offset.

2024-09-06 Thread Mark Wielaard
table offsets that were the same as the address offset. Signed-off-by: Mark Wielaard --- src/readelf.c | 2 +- tests/run-readelf-gdb_index.sh | 8 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/readelf.c b/src/readelf.c index 48035264be13

[PATCH] readelf: Allow .gdb_index const table to be empty

2024-09-07 Thread Mark Wielaard
end. 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 8d96443daa83..21cacd7b6c06 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -11679,7 +11679,7 @@ print_gdb_index_section (Dwfl_Module *dwflmod

[PATCH] srcfiles: Fix compile with --disable-libdebuginfod

2024-09-09 Thread Mark Wielaard
ENABLE_LIBDEBUGINFOD after no_backup check. * tests/Makefile.am (TESTS): Only add run-srcfiles-self.sh if DEBUGINFOD and !DUMMY_LIBDEBUGINFOD. * tests/run-srcfiles.self.sh: Use local DEBUGINFOD_CACHE_PATH. https://sourceware.org/bugzilla/show_bug.cgi?id=32155 Signed-off-by: Mark Wielaard

Re: pkg-config not used in configure?

2024-09-10 Thread Mark Wielaard
ight, they are not fully compatible ways to detect zstd library support. I wonder if it is reasonable now to just check for some 1.4.0 zstd symbol to get both libdw decompression and libelf compression support at the same time. Then you only need the eu_ZIPLIB macro and can forget about the pkgconfig version check. Cheers, Mark

Re: [PATCH] readelf: Allow .gdb_index const table to be empty

2024-09-10 Thread Mark Wielaard
Hi, On Sun, 2024-09-08 at 00:00 +0200, Mark Wielaard wrote: > The .gdb_index const table can be empty, if no symbol table entry > refers to a name or CU. Which technically means the symbol table is > empty or has only zero members. > > * src/readelf.c (print_gdb_index_

<    1   2   3   4   5   6   7   8   9   10   >