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

2023-02-23 Thread Mark Wielaard
ommon name (binutils-gdb calls this AARCH64_DWARF_RA_SIGN_STATE, but only defines it in a private header). Lets move this into cfi.c as private implementation detail in the next patch. Thanks, Mark

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

2023-02-23 Thread Mark Wielaard
RA_SIGN_STATE].value ^= 0x1; > } > else > { Looks good. Lets also move the DW_AARCH64_RA_SIGN_STATE definition into cfi.h (from libdw.h in the previous patch). Thanks, Mark

Re: [PATCH 0/4] Add AARCH64 pointer authentication support

2023-02-23 Thread Mark Wielaard
Hi German, On Thu, May 19, 2022 at 02:30:23PM +0100, German Gomez via Elfutils-devel wrote: > On 28/04/2022 20:56, Mark Wielaard wrote: > > I haven't been able to look at the actual patches yet. And I am on > > vacation this week. But I'll review next week after I am ba

Re: [PATCH v3] strip: keep .ctf section in stripped file

2023-02-24 Thread Mark Wielaard
N is an extended wildcard pattern. May be given more than once. Only non-allocated sections can be removed. Do you really need a new option? Or could you use an explicit --keep-section=.ctf and/or --remove-section=.ctf ? Thanks, Mark

Re: [PATCH] libdw: Fix dwarf_getscopes memory leak on error

2023-02-28 Thread Mark Wielaard
Hi, On Wed, 2023-02-22 at 23:39 +0100, Mark Wielaard wrote: > When there is an error in dwarf_getscopes after the initial scopes > have been allocated, e.g. when looking for the inlined scopes, then > the scopes would leak. Fix this by explicitly free the scopes on error. &

Re: [PATCH v3] strip: keep .ctf section in stripped file

2023-02-28 Thread Mark Wielaard
Hi Guillermo, CCed Nick to see if he knows why binutils strip does what it does. On Fri, 2023-02-24 at 10:48 -0600, Guillermo E. Martinez wrote: > On Fri, Feb 24, 2023 at 12:51:25PM +0100, Mark Wielaard wrote: > > > > On Thu, Feb 23, 2023 at 12:42:37PM -0600, Guillermo

Re: [PATCH v3] strip: keep .ctf section in stripped file

2023-02-28 Thread Mark Wielaard
e (defaulting to keeping). I am mainly wondering why binutils strip already seems to keep ".ctf" sections (even without -g). Cheers, Mark

Re: PATCH: Bug debuginfod/29472 followup

2023-03-01 Thread Mark Wielaard
m servers. Luckily, json-c is > a small & self-contained library. aha, I see, the metadata query is different from other queries. It "merges" the replies from all servers instead of picking the first one that gives an answer. Does it really merge the results? It looks like it just adds all elements to the array whether or not they are there. Should the result also contain the server URL from which the entry came? Cheers, Mark

Re: elfutils 0.189 release next week

2023-03-02 Thread Mark Wielaard
Hi, On Tue, 2023-02-21 at 14:33 +0100, Mark Wielaard wrote: > We accumulated a lot of patches since 0.188 (59 commits by 13 authors) > with some nice new features and some important bug fixes. So it would > be good to push a new release out. > > I cleaned up the patchwork list a

Re: [PATCH v2 09/16] libelf: uid_t, gid_t and mode_t are not comes with msvcrt, so using long/unsigned long instead on win32

2023-03-02 Thread Mark Wielaard
ly. But ar.c also simply uses uid_t, gid_t and mode_t. So those should then also be adjusted. Can't we use some configure check instead? I am somewhat hesitant to change this because it is in a public header. Cheers, Mark

Re: [PATCH v2 11/16] libebl/libdwelf: define ssize_t and pid_t for MSVC within installed header libdwelf.h and libebl.h

2023-03-02 Thread Mark Wielaard
both signed and no wider than a long. libdwelf.h is a public header. libebl.h isn't. But I am not sure these are the right places to add these typedefs. pid_t and ssize_t are used all over the place. Cheers, Mark

Re: [PATCH v2 14/16] Add function sys_get_page_size to replace platform dependent sysconf (_SC_PAGESIZE)

2023-03-02 Thread Mark Wielaard
tem.c b/lib/system.c > new file mode 100644 > index ..bd3831f5 > --- /dev/null > +++ b/lib/system.c > @@ -0,0 +1,48 @@ > +/* Definitions for system functions. > + Copyright (C) 2006-2011 Red Hat, Inc. > + Copyright (C) 2022 Mark J. Wielaard > +

Re: [PATCH v3] strip: keep .ctf section in stripped file

2023-03-03 Thread Mark Wielaard
Hi Guillermo, On Thu, 2023-03-02 at 20:40 -0600, Guillermo E. Martinez wrote: > On Tue, Feb 28, 2023 at 03:27:13PM +0100, Mark Wielaard wrote: > > There are some exceptions to the general rule in eu-strip of dropping > > not referenced, non-allocated, SHT_PROGBIT sections. SH

[COMMITTED] readelf: Fix use-after-free ebl pointer issue

2023-03-03 Thread Mark Wielaard
it in the comparison. Signed-off-by: Mark Wielaard --- src/ChangeLog | 5 + src/readelf.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 699d98ee..c26dafdd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2023-03-03

[COMMITTED] libelf: Document and make ELFCOMPRESS_ZSTD usable with old system elf.h

2023-03-03 Thread Mark Wielaard
Make sure that even if the system elf.h doesn't have ELF_COMPRESS_ZSTD defined it can still be used as constant. Also update libelf.h documentation and add new feature to NEWS. Signed-off-by: Mark Wielaard --- ChangeLog| 4 NEWS | 8 +++- libelf/ChangeLog

[COMMITTED] Prepare for 0.189

2023-03-03 Thread Mark Wielaard
Set version to 0.189 Update NEWS and elfutils.spec.in Set copyright year in configure.ac and printversion. Regenerate po/*.po files. Signed-off-by: Mark Wielaard --- NEWS|5 + config/elfutils.spec.in | 13 + configure.ac|4 +- lib/printversion.c

[COMMITTED] Fix static build when zstd is enabled for libelf

2023-03-03 Thread Mark Wielaard
infod-find executable itself in the testcase. * src/Makefile.am (libelf): When BUILD_STATIC add $(zstd_LIBS) * tests/Makefile.am (libelf): Likewise. * tests/run-debuginfod-query-retry.sh: Use debuginfod-find instead of libdebuginfod.so.1 Signed-off-by: Mark Wielaard --- src/M

elfutils 0.189 released

2023-03-03 Thread Mark Wielaard
ry printversion: Fix unused variable backends: Support returning lvalue and rvalue references configure: Add --enable-sanitize-memory Mark Wielaard (35): debuginfod: Mark extract_section function static readelf: Check phdr != NULL or shdr != NULL in handle_dynamic. libdw: Don't dereference

[PATCH] tests: skip '(null)' symname frames in backtrace tests

2023-03-04 Thread Mark Wielaard
Some setups might have some frames for unknown (null) functions in the thread backtrace. Skip these frames instead of failing immediately. * tests/backtrace.c (callback_verify): Check and skip nulls_seen. https://sourceware.org/bugzilla/show_bug.cgi?id=29176 Signed-off-by: Mark Wielaard

Re: [PATCH v3] strip: keep .ctf section in stripped file

2023-03-07 Thread Mark Wielaard
Hi Nick, Hi Guillermo, On Sat, 2023-03-04 at 08:00 -0600, Guillermo E. Martinez wrote: > Hello, > > On Fri, Mar 03, 2023 at 12:24:19PM +, Nick Clifton wrote: > > Hi Mark, > > > > > > > I am mainly wondering why binutils strip already seems to keep "

Sourceware infrastructure updates Q1 2023

2023-03-08 Thread Mark Wielaard
and organisations for maintaining and/or providing hardware for builder.sourceware.org Brno University, Dan Horák, Marist University, Thomas Fitzsimmons, Mark Wielaard, Frank Eigler, IBM, Carl Love, The Works on Arm initiative, Christophe Lyon, and Red Hat

Re: [PATCH v3] strip: keep .ctf section in stripped file

2023-03-09 Thread Mark Wielaard
it keeps such sections when -g isn't given. > > So I am not sure we really need a --keep-ctf flag for eu-strip (unless > > we also get it for binutils strip). My preference would be to just > > recommend a user use --keep-section=.ctf or --remove-section=.ctf to > > in

Re: [PATCH] LoongArch: implemented a basic machine flag check

2023-03-20 Thread Mark Wielaard
achine flags: 0x43 > $ echo $? > 1 Thanks. I quickly peeked at the LoongArch ELF ABI specification and this is precisely what needs to be checked. Added a ChangeLog entry to the commit message, a reference to the bug you filed and pushed. Cheers, Mark

[PATCH] backends: Check results for NULL early in dwarf_peeled_die_type

2023-04-06 Thread Mark Wielaard
rt of function. Signed-off-by: Mark Wielaard --- backends/libebl_CPU.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backends/libebl_CPU.h b/backends/libebl_CPU.h index 3b2cc3e4..d138f5f7 100644 --- a/backends/libebl_CPU.h +++ b/backends/libebl_CPU.h @@ -66,13 +

[PATCH] readelf: Handle NULL shdr in section_name

2023-04-06 Thread Mark Wielaard
In some error cases we want to show the section name but cannot because the section header is corrupt or NULL. Make sure the section_name always returns "???" in that case. * src/readelf.c (section_name): Check for shdr == NULL. Signed-off-by: Mark Wielaard --- src/readelf.c

Some ideas for process improvements/changes

2023-04-06 Thread Mark Wielaard
downstream users of our code. Especially if someone starts assigning CVEs to them. It would be good to have some explicit text to point "security" bug reporters at on how we will handle their bugs. Cheers, Mark

Re: Some ideas for process improvements/changes

2023-04-06 Thread Mark Wielaard
get CVEs assigned which cause lots of extra work for some of our downstream users. I think we should be clear that we want to fix all bugs and don't want to get dragged into embargoed security theater. https://daniel.haxx.se/blog/2023/03/29/pre-notification-dilemmas/ Cheers, Mark

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

2023-04-06 Thread Mark Wielaard
On Sat, Apr 01, 2023 at 02:43:43PM +0800, Youling Tang wrote: > Adds R_LARCH_*. Thanks, pushed.

Re: [PATCH 2/2] backends: Add new relocation type handling for LoongArch

2023-04-06 Thread Mark Wielaard
On Sat, Apr 01, 2023 at 02:43:44PM +0800, Youling Tang wrote: > Add new relocation type handling. Thanks, looks good. Pushed. Cheers, Mark

Re: [PATCH] backends: add checks for _GLOBAL_OFFSET_TABLE_ on loongarch

2023-04-06 Thread Mark Wielaard
tch .got.plt section address 0x68238 > > After applying the patch: > $ ./src/elflint --gnu-ld ./src/elflint > No errors Thanks, code looks correct. I agree that the other issue mentioned (_DYNAMIC symbol size 0) is a separate issue. Pushed, Mark

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

2023-04-07 Thread Mark Wielaard
nstance of 'sqlite_exception' Which doesn't really make sense. Where is this sqlite_exception thrown that it isn't caught? Might this be a sparc specific bug? Cheers, Mark

Re: [PATCH] readelf: Handle NULL shdr in section_name

2023-04-14 Thread Mark Wielaard
Hi, On Thu, 2023-04-06 at 17:04 +0200, Mark Wielaard wrote: > In some error cases we want to show the section name but cannot > because the section header is corrupt or NULL. Make sure the > section_name always returns "???" in that case. > > * src/readelf.c (sect

Re: [PATCH] backends: Check results for NULL early in dwarf_peeled_die_type

2023-04-14 Thread Mark Wielaard
Hi, On Thu, 2023-04-06 at 17:04 +0200, Mark Wielaard wrote: > Calling dwarf_peeled_die_type with a NULL results pointer is an error, > check early that result is not NULL so dwarf_formref_die and > dwarf_peel_type won't try to set the NULL Dwarf_Die. > > * b

[PATCH] tests: Limit the number of concurrent requests in debuginfod-federation

2023-04-14 Thread Mark Wielaard
-federation-sqlite.sh: Likewise. Signed-off-by: Mark Wielaard --- tests/run-debuginfod-federation-metrics.sh | 4 +++- tests/run-debuginfod-federation-sqlite.sh | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/run-debuginfod-federation-metrics.sh b/tests/run-debuginfod

Re: [PATCH] tests: Limit the number of concurrent requests in debuginfod-federation

2023-04-17 Thread Mark Wielaard
On Fri, 2023-04-14 at 18:46 +0200, Mark Wielaard wrote: > It seems doing 100 parallel requests can crash some versions of > libmicrohttpd so limit the number a little to the number of processors > times 4, with a max of 64. > > * tests/run-debuginfod-federation-metrics.sh: Us

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

2023-04-17 Thread Mark Wielaard
; Build state: failed test (failure) > Revision: ce2312975812a1719a2c322aa75e97f96c4f8ca7 > Worker: gentoo-sparc > Build Reason: (unknown) > Blamelist: Mark Wielaard > > Steps: > [...] > > - 7: make check ( failure ) > Logs: > - stdio: > https:

Re: [PATCH] PR28873 - Implement eu-readelf -D

2023-04-18 Thread Mark Wielaard
at. Cheers, Markdiff --git a/ChangeLog b/ChangeLog index ece07e97..6aed95b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,7 @@ 2023-03-27 Di Chen * NEWS: Support readelf -Ds for using dynamic segment to -print symbol table. + print symbol table. 2023-03-03 Mark Wielaar

[PATCH] elfcompress: Don't compress if section already compressed unless forced

2023-04-21 Thread Mark Wielaard
ts" : "allocated")); } + } Signed-off-by: Mark Wielaard --- src/elfcompress.c | 43 +++ 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/src/elfcompress.c b/src/elfcompress.c index 18ade66f..f771b92a 100644

Re: [PATCH] testsuite: Avoid C99 compatibility issues in run-native-test.sh

2023-04-22 Thread Mark Wielaard
Hi Florian, On Sat, Apr 22, 2023 at 09:37:09PM +0200, Florian Weimer via Elfutils-devel wrote: > Include for the pause function, and add the return type > of main. Avoids an implicit function declaration and implicit int. Thanks, pushed. Cheers, Mark

Re: [PATCH] libdwfl: Fix memory leak in unzip()

2023-05-08 Thread Mark Wielaard
buffer was always NULL. Cheers, Mark

Re: [PATCH] elfcompress: Don't compress if section already compressed unless forced

2023-05-08 Thread Mark Wielaard
Hi, On Sat, 2023-04-22 at 01:45 +0200, Mark Wielaard wrote: > Before commit a5b07cdf9 "support ZSTD compression algorithm" > elfcompress would not try to compress a section if it already > had the requested compression type (or was already uncompressed) > unless the --fo

Re: Hitting g dwfl->lookup_elts limit in report_r_debug, so not all modules show up and backtracing fails

2023-05-08 Thread Mark Wielaard
ate too + many times, there must be a loop in the pointers due to link_map + clobberation. */ +#define MAX_PT_LOAD 5 size_t iterations = 0; - while (next != 0 && ++iterations < dwfl->lookup_elts) + while (next != 0 && ++iterations < dwfl->lookup_elts * MAX_PT_LOAD) { if (read_addrs (&memory_closure, elfclass, elfdata, &buffer, &buffer_available, next, &read_vaddr, Does that sound reasonable? Thanks, Mark

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

2023-05-08 Thread Mark Wielaard
Hi, On Mon, 2023-05-08 at 16:30 +, builder--- via Elfutils-devel wrote: > A new failure has been detected on builder elfutils-opensusetw-x86_64 > while building elfutils. > > Full details are available at: > https://builder.sourceware.org/buildbot/#builders/88/builds/157 > > Build state: f

Re: [PATCH 1/5] backends: Add abi_cfi and register_info callbacks for LoongArch

2023-05-08 Thread Mark Wielaard
tml Looks good. Thanks for the references. Cheers, Mark

Re: [PATCH 2/5] backends: Add set_initial_registers_tid callback for LoongArch

2023-05-08 Thread Mark Wielaard
comment says 64bits, but the mask is for 32bits. I assume the comment is wrong and the masking is deliberate? Cheers, Mark

Re: [PATCH 3/5] backends: Add initial return value location support for LoongArch

2023-05-08 Thread Mark Wielaard
adding the reference). But the code looks plausible. Thanks, Mark

Re: [PATCH 4/5] backends: Add frame pointer unwinding for LoongArch

2023-05-08 Thread Mark Wielaard
well known frame pointer locations in the stack snapshot and use them > to bridge the frames without debug information. Looks useful and correct. Thanks, Mark

Re: [PATCH 5/5] backends: Add core_note callback for LoongArch

2023-05-08 Thread Mark Wielaard
t after a quick look at the kernel sources. Thanks, Mark

Re: [PATCH 2/5] backends: Add set_initial_registers_tid callback for LoongArch

2023-05-09 Thread Mark Wielaard
r[r] & 0x; > - > - if (! setfunc (32, 32, dwarf_fregs, arg)) > + /* $f0-$f31 */ > + if (! setfunc (32, 32, &fregs.fpr[0], arg)) > > Do I need to send the v2 patchset again? Please just sent this patch rebased against the current git branch. I already pushed the other 4 patches since they looked good. Thanks, Mark

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

2023-05-09 Thread Mark Wielaard
ole="scan"} keeps a queue of 5? I have no idea how that can happen. The next build does see this testcase PASS on sparc. It was clearly not caused by this patch (backends: Add abi_cfi and register_info callbacks for LoongArch). Cheers, Mark

Re: [PATCH v2] backends: Add set_initial_registers_tid callback for LoongArch

2023-05-09 Thread Mark Wielaard
Hi, On Tue, 2023-05-09 at 19:20 +0800, Youling Tang wrote: > This patch implements the set_initial_registers_tid hook for LoongArch. Thanks for the update. Looks good. Pushed, Mark

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

2023-05-09 Thread Mark Wielaard
m"} never gets to 1. I don't really understand this. And again this cannot be caused by the last commit (backends: Add set_initial_registers_tid callback for LoongArch). I will assume this is a flaky test (or maybe sparc is flaky?) Cheers, Mark

Re: [PATCH 1/5] strip: Adapt src/strip -o -f on mips

2023-05-09 Thread Mark Wielaard
s. But I would have expected a specific conversion function for MIPS for ELF_T_REL and/or ELF_T_RELA (which are currently generic). Cheers, Mark

Re: [PATCH 2/5] readelf: Adapt src/readelf -h/-S/-r/-w/-l/-d/-a on mips

2023-05-11 Thread Mark Wielaard
gt;elf, symshdr->sh_link, sym->st_name)); > + class == ELFCLASS32 ? 10 : 18, rel->r_offset, > + likely (ebl_reloc_type_check (ebl, > +

Re: [PATCH 3/5] elflint: Fix invalid type of relocation info and other issues on mips

2023-05-11 Thread Mark Wielaard
} > if (sh_flags & SHF_MASKOS) > - if (gnuld) > - sh_flags &= ~(GElf_Xword) SHF_GNU_RETAIN; > + { > + if (gnuld) > + sh_flags &= ~(GElf_Xword) SHF_GNU_RETAIN; > + if (ehdr->e_machine == EM_MIPS) > + { > + if(sh_flags == SHF_MIPS_NOSTRIP || sh_flags == SHF_MIPS_LOCAL > +|| sh_flags == SHF_MIPS_NAMES || sh_flags == SHF_MIPS_NODUPE) > + sh_flags &= ~shdr->sh_flags; > + } > + } > if (sh_flags != 0) > ERROR (_("section [%2zu] '%s' contains unknown flag(s)" > " %#" PRIx64 "\n"), Can this be checked with the machine_section_flag_check hook? Thanks, Mark

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

2023-05-11 Thread Mark Wielaard
read_t *readfunc, void *arg, > + bool *signal_framep __attribute__ ((unused))) > +{ > + Dwarf_Word fp, lr, sp; > + > + if (!getfunc(LR_REG, 1, &lr, arg)) > +return false; > + > + if (lr == 0 || !setfunc(-1, 1, &lr, arg)) > +return false; > + > + if (!getfunc(FP_REG, 1, &fp, arg)) > +fp = 0; > + > + if (!getfunc(SP_REG, 1, &sp, arg)) > +sp = 0; > + > + Dwarf_Word newLr, newFp, newSp; > + > + if (!readfunc(fp + LR_OFFSET, &newLr, arg)) > +newLr = 0; > + > + if (!readfunc(fp + FP_OFFSET, &newFp, arg)) > +newFp = 0; > + > + newSp = fp + SP_OFFSET; > + > + // These are not fatal if they don't work. They will just prevent > unwinding at the next frame. > + setfunc(LR_REG, 1, &newLr, arg); > + setfunc(FP_REG, 1, &newFp, arg); > + setfunc(SP_REG, 1, &newSp, arg); > + > + // If the fp is invalid, we might still have a valid lr. > + // But if the fp is valid, then the stack should be moving in the right > direction. > + return fp == 0 || newSp > sp; > +} Looks good. Thanks, Mark

Re: [PATCH 5/5] backends: Fix run-native-test.sh and run-funcretval++11.sh run fail on mips

2023-05-11 Thread Mark Wielaard
(dwarf_attr_integrate (typedie, DW_AT_encoding, > + &attr_mem), &encoding) != 0) > + return -1; > + > +#define ARCH_LOC(loc, regsize) ((regsize) == 4 ? (loc ## _o32) : (loc)) > + > + if (encoding == DW_ATE_float) > + { > + *locp = ARCH_LOC(loc_fpreg, regsize); > + if (size <= regsize) > + return nloc_fpreg; > + > + if (size <= 2*regsize) > + return nloc_fpregpair; > + > + if (size <= 4*regsize && arch == MIPS_ARCH_32) > + return nloc_fpregquad; > + > + goto aggregate; > + } > + } > + *locp = ARCH_LOC(loc_intreg, regsize); > + if (size <= regsize) > + return nloc_intreg; > + if (size <= 2*regsize) > + return nloc_intregpair; > + > + /* Else fall through. Shouldn't happen though (at least with gcc) */ > + } > + FALLTHROUGH; > + > +case DW_TAG_structure_type: > +case DW_TAG_class_type: > +case DW_TAG_union_type: > +case DW_TAG_array_type: > +aggregate: > + /* XXX TODO: Can't handle structure return with other ABI's yet :-/ */ > + if ((arch != MIPS_ARCH_32) && (arch != MIPS_ARCH_64)) > +return -2; > + > + *locp = loc_aggregate; > + return nloc_aggregate; > +} > + > + /* XXX We don't have a good way to return specific errors from ebl calls. > + This value means we do not understand the type, but it is well-formed > + DWARF and might be valid. */ > + return -2; > +} OK. This looks plausible. Would be good to have a reference to the actual calling convention. Thanks, Mark

Re: [PATCHv2 1/1] report_r_debug: handle `-z separate-code' and find more modules

2023-05-12 Thread Mark Wielaard
it has a limit on the number of link map entries it will > look at, to avoid loops in corrupted core files. Looks good. Pushed. Thanks, Mark

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

2023-05-12 Thread Mark Wielaard
-elf-file.sh. That isn't caused by the last commit. It is probably a hickup on the machine, run-large-elf-file.sh generates a > 4GB ELF file and might cause some swapping. All other buildbot builders passed. Cheers, Mark

Sourceware joins Software Freedom Conservancy

2023-05-15 Thread Mark Wielaard
#x27;s PLC includes various volunteers, past and present, from the Sourceware community. The founding PLC is: Frank Ch. Eigler, Christopher Faylor, Ian Kelling, Ian Lance Taylor, Tom Tromey, Jon Turney, and Mark J. Wielaard. Recent discussions have inspired the Sourceware volunteers to think

[COMMITTED htdocs] Add current and older git snapshots code coverage links

2023-05-19 Thread Mark Wielaard
https://snapshots.sourceware.org/ now generates code coverage reports for git commits (every 15 minutes if there are any changes). --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index b3b55403..d603021f 100644 --- a/index.html +++ b/index

Re: [PATCH 1/5] strip: Adapt src/strip -o -f on mips

2023-05-21 Thread Mark Wielaard
Hi Ying, On Tue, May 16, 2023 at 02:38:45PM +0800, Ying Huang wrote: > 在 2023/5/9 23:15, Mark Wielaard 写道: > > On Tue, 2023-04-11 at 16:12 +0800, Ying Huang wrote: > >> In mips64 little-endian, r_info consists of four byte fields(contains > >> three reloc types) an

Re: [PATCH 1/5] strip: Adapt src/strip -o -f on mips

2023-05-21 Thread Mark Wielaard
rry, the mailinglist seems to strip the image attachements. > huangying@Sleepygon:~/elf/elfutils_4$ src/elflint src/nm.o > Segmentation fault > huangying@Sleepygon:~/elf/elfutils_4$ src/elflint src/strip.o > Segmentation fault When running under gdb, what is the backtrace of the crash? Thanks, Mark

Re: Local Build ID Directory Lookup (DEBUGINFOD_LOCAL_PATH)

2023-06-14 Thread Mark Wielaard
he traditional lookup uses the (relative!) path in the .gnu_debugaltlink section of the .debug file. I wonder which parts of the "traditional" lookup are still useful/relevant. Could we get away with pointing at a "traditional" /usr/lib/debug/ like path that contains a .build-id and (optional) .dwz subdir to make libdebuginfo that "uniform" debug file lookup library? Cheers, Mark

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

2023-06-16 Thread Mark Wielaard
ster and rerun the elfutils buildbot. Thanks for providing a testcase for valgrind on s390x :) Cheers, Mark

[COMMITTED] tests: Add a bit less and slightly smaller sections for addsections

2023-06-16 Thread Mark Wielaard
section data just one single zero byte. * tests/addsections.c (add_sections): Don't strdup and free the string ".extra", but just add the empty string. * tests/run-copymany-sections.sh: Call addsections with 32768 instead of 65535. Signed-off-by

[COMMITTED] tests: Use readelf -N -w in run-strip-reloc.sh

2023-06-16 Thread Mark Wielaard
With -N the test runs 4 times faster. And the address lookup is not essential for the test. * tests/run-strip-reloc.sh: Use readelf -N -w. Signed-off-by: Mark Wielaard --- tests/run-strip-reloc.sh | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/run

[COMMITTED] tests: Split run-copymany-sections.sh into separate tests

2023-06-17 Thread Mark Wielaard
. Add test-copymany-subr.sh, run-copymany-be32.sh, run-copymany-le32.sh, run-copymany-be64.sh and run-copymany-le64.sh. Signed-off-by: Mark Wielaard --- tests/Makefile.am| 8 ++-- tests/run-copymany-be32.sh

[COMMITTED] tests: Really split run-copymany-sections.sh into separate tests

2023-06-17 Thread Mark Wielaard
ts/run-copymany-le64.sh: Likewise. Signed-off-by: Mark Wielaard --- tests/run-copymany-be32.sh | 1 - tests/run-copymany-be64.sh | 1 - tests/run-copymany-le32.sh | 1 - tests/run-copymany-le64.sh | 1 - tests/test-copymany-subr.sh | 44 +++-- 5 files c

[COMMITTED] tests: Split up run-strip-reloc.sh test in three subtests

2023-06-17 Thread Mark Wielaard
ko.sh, run-strip-reloc-self.sh and run-strip-reloc-ppc64.sh. Signed-off-by: Mark Wielaard --- tests/Makefile.am | 8 +- tests/run-strip-reloc-ko.sh| 51 +++ tests/run-strip-reloc-ppc64.sh | 15 tests/run-strip-reloc-self.sh | 20 + tests/run-strip-rel

[COMMITTED] tests: Use -N for run-readelf-self.sh.

2023-06-17 Thread Mark Wielaard
The test doesn't really need to resolve all addresses and -N is really slow. * tests/run-readelf-self.sh: Add -N. Signed-off-by: Mark Wielaard --- tests/run-readelf-self.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run-readelf-self.sh b/tests/run-re

Re: Local Build ID Directory Lookup (DEBUGINFOD_LOCAL_PATH)

2023-06-19 Thread Mark Wielaard
:) So that leaves the wrinkle of finding the .dwz files. And how to connect the debuginfo to the debugsources. When pointing to a "traditional" build-id based directory like /usr/lib/debug/ and /usr/src/debug/ Cheers, Mark

Re: Performance issue with systemd-coredump and container process linking 2000 shared libraries.

2023-06-19 Thread Mark Wielaard
etting the build-ids with $ eu-unstrip --core=./the-core -n So providing some other "static data" might be possible with a simpler interface. Thanks for this extensive bug report and reproducer. I play some more with it to hopefully get you some real answers/fixes. Cheers, Mark

Re: Re: Performance issue with systemd-coredump and container process linking 2000 shared libraries.

2023-06-20 Thread Mark Wielaard
er, and so on) and not in the namespaces of the crashing process. One can utilize specifiers such as %P to find the right /proc/[pid] directory and probe/enter the crashing process's namespaces if needed. https://man7.org/linux/man-pages/man5/core.5.html Cheers, Mark

Re: Performance issue with systemd-coredump and container process linking 2000 shared libraries.

2023-06-20 Thread Mark Wielaard
is not the ideal datastructure here. But I don't think it is causing the really long delay. That clearly comes from the (negative) inode/dentry file search cache. But we could look at this after we solve the other issues and we maybe want to speed things up a bit more. > Cheers, Mark

Re: Performance issue with systemd-coredump and container process linking 2000 shared libraries.

2023-06-20 Thread Mark Wielaard
Hi, On Mon, Jun 19, 2023 at 05:08:50PM +0200, Mark Wielaard wrote: > Just to let you know I am looking at this. But haven't made much > progress in understanding it yet. Thanks so much for the reproducer. I > have been able to see the (very slow) parsing of the core file with i

Re: Performance issue with systemd-coredump and container process linking 2000 shared libraries.

2023-06-21 Thread Mark Wielaard
eeing those performance results I understand why you were suspecting the linked list data structure used in elf_getdata_rawchunk. Would you be able to test a rebuild libelf with the attached patch, which replaces that datastructure with a binary search tree? It didn't really show much speedup

Re: Performance issue with systemd-coredump and container process linking 2000 shared libraries.

2023-06-21 Thread Mark Wielaard
Hi Romain, On Wed, Jun 21, 2023 at 06:14:27PM +, Romain GEISSLER wrote: > > Le 21 juin 2023 à 18:24, Mark Wielaard a écrit : > > > > Seeing those performance results I understand why you were suspecting > > the linked list data structure used in elf_getdata_rawchun

Re: Performance issue with systemd-coredump and container process linking 2000 shared libraries.

2023-06-22 Thread Mark Wielaard
the full ELF file. Maybe another solution might be an "get me everything for this Dwfl, all symbol tables, all elf files, all separate Dwarf debug files, etc." function so an application can "pay upfront" for not having to fetch each item lazily? Such a function could then do a "parallel/batched fetch" through debuginfod. Cheers, Mark

Re: Performance issue with systemd-coredump and container process linking 2000 shared libraries.

2023-06-22 Thread Mark Wielaard
the testing of the individual fixes. > Mark, do you think it's worth backporting this in CentOS Steam 9/RHEL 9 on > elfutils side ? If you need a ticket, we have Red Hat case 03536980 which > lead to RHBZ 2215412. Yes, I'll look into it. The systemd fix seems most important si

[COMMITTED] debuginfod: Fix formatting in debuginfod_config_cache

2023-06-22 Thread Mark Wielaard
The formatting of debuginfod_config_cache in debuginfod-client.c was slightly off making it hard to see the program logic. Make sure lines are < 76 chars, and if { } else { } indentation follows GNU style. Signed-off-by: Mark Wielaard --- debuginfod/debuginfod-client.c |

Re: [PATCH] libelf: Sync elf.h from glibc

2023-06-27 Thread Mark Wielaard
On Mon, 2023-06-26 at 16:30 +0200, Andreas Schwab via Elfutils-devel wrote: > Adds new RISC-V relocations. > > * elf.h: Update from glibc. Thanks, looks good. Pushed, Mark

Re: [PATCH] backends: Update list of RISC-V relocations

2023-06-27 Thread Mark Wielaard
Hi Andreas, On Mon, 2023-06-26 at 16:32 +0200, Andreas Schwab via Elfutils-devel wrote: > * backends/riscv_reloc.def: Add IRELATIVE, PLT32, SET_ULEB128, > SUB_ULEB128. Thanks, looks good. Pushed, Mark

Re: Performance issue with systemd-coredump and container process linking 2000 shared libraries.

2023-06-27 Thread Mark Wielaard
Hi, On Wed, 2023-06-21 at 18:24 +0200, Mark Wielaard wrote: > libelf: Replace list of elf_getdata_rawchunk results with a > tree > > elf_getdata_rawchunks did a linear search to see if a chunk was > already fetched. Replace this list with a binary search tree to make > lookup

Re: How does eu_unstrip restore symbols

2023-06-30 Thread Mark Wielaard
'unstrip'? Yes, that how it works, it merges the sections from the main executable and the separate debug file into one as it was before separating them. > Will it occur to some kind of precision error 3. > How fast is it for like 10 million tiny binaries? I think you will have to measure that yourself. Cheers, Mark

Re: Performance issue with systemd-coredump and container process linking 2000 shared libraries.

2023-06-30 Thread Mark Wielaard
On Fri, Jun 30, 2023 at 04:09:37PM +, Romain GEISSLER wrote: > > Le 27 juin 2023 à 16:09, Mark Wielaard a écrit : > > On Wed, 2023-06-21 at 18:24 +0200, Mark Wielaard wrote: > > > > I pushed this now. It is also in Fedora Rawhide: > > https://bodhi.fedorap

Re: PR29472: debuginfod metadata query

2023-07-04 Thread Mark Wielaard
> % debuginfod-find metadata file /bin/ls > % debuginfod-find metadata glob "/usr/local/bin/c*" Would be nice to have some example output here. If only to explain what the used can expect. It gives the following for me: /home/mark/.cache/debuginfod_client/metadata/key=file&

Re: PR29472: debuginfod metadata query

2023-07-04 Thread Mark Wielaard
nup while at it. > + */ > + for (int i = 0; i < num_urls; i++) > + { > +curl_multi_remove_handle(curlm, data[i].handle); /* ok to repeat */ > +curl_easy_cleanup (data[i].handle); > +free (data[i].response_data); > + > +if (NULL == data[i].metadata) > +{ > + if (vfd >= 0) > +dprintf (vfd, "Query to %s failed with error message:\n\t\"%s\"\n", > + data[i].url, data[i].errbuf); > + continue; > +} > + > +json_object *upstream_metadata = json_tokener_parse(data[i].metadata); > +if(NULL == upstream_metadata) continue; > +// Combine the upstream metadata into the json array > +for (int j = 0, n = json_object_array_length(upstream_metadata); j < n; > j++) { > +json_object *entry = json_object_array_get_idx(upstream_metadata, j); > +json_object_get(entry); // increment reference count > +json_object_array_add(json_metadata, entry); > +} > +json_object_put(upstream_metadata); > + > +free (data[i].metadata); > + } Do we really need libjson-c functions to combine the results? Can't we simply return multiple json arrays/objects if we get results from multiple servers? > + /* Because of race with cache cleanup / rmdir, try to mkdir/mkstemp up to > twice. */ > + for (int i=0; i<2; i++) { > +/* (re)create target directory in cache */ > +(void) mkdir(target_cache_dir, 0700); /* files will be 0400 later */ > + > +/* NB: write to a temporary file first, to avoid race condition of > + multiple clients checking the cache, while a partially-written or > empty > + file is in there, being written from libcurl. */ > +fd = mkstemp (target_cache_tmppath); > +if (fd >= 0) break; > + } > + if (fd < 0) /* Still failed after two iterations. */ > +{ > + rc = -errno; > + goto out1; > +} > + > + > + /* Plop the complete json_metadata object into the cache. */ > + const char* json_string = json_object_to_json_string_ext(json_metadata, > JSON_C_TO_STRING_PRETTY); > + if (json_string == NULL) > +{ > + rc = -ENOMEM; > + goto out1; > +} > + ssize_t res = write_retry (fd, json_string, strlen(json_string)); > + (void) lseek(fd, 0, SEEK_SET); // rewind file so client can read it from > the top > + > + /* NB: json_string is auto deleted when json_metadata object is nuked */ > + if (res < 0 || (size_t) res != strlen(json_string)) > +{ > + rc = -EIO; > + goto out1; > +} > + /* PR27571: make cache files casually unwriteable; dirs are already 0700 */ > + (void) fchmod(fd, 0400); > + > + /* rename tmp->real */ > + rc = rename (target_cache_tmppath, target_cache_path); > + if (rc < 0) > +{ > + rc = -errno; > + goto out1; > + /* Perhaps we need not give up right away; could retry or something > ... */ > +} > + > + /* don't close fd - we're returning it */ > + /* don't unlink the tmppath; it's already been renamed. */ > + if (path != NULL) > + *path = strdup(target_cache_path); > + > + rc = fd; > + goto out1; > + > +/* error exits */ > +out2: > + /* remove all handles from multi */ > + for (int i = 0; i < num_urls; i++) > + { > +if (data[i].handle != NULL) > +{ > + curl_multi_remove_handle(curlm, data[i].handle); /* ok to repeat */ > + curl_easy_cleanup (data[i].handle); > + free (data[i].response_data); > + free (data[i].metadata); > +} > + } > + > +out1: > + free(data); > + > + for (int i = 0; i < num_urls; ++i) > +free(server_url_list[i]); > + free(server_url_list); > + > +out: > + free (server_urls); > + json_object_put(json_metadata); > + /* Reset sent headers */ > + curl_slist_free_all (client->headers); > + client->headers = NULL; > + client->user_agent_set_p = 0; > + > + free (target_cache_dir); > + free (target_cache_path); > + free (target_cache_tmppath); > + free (key_and_value); > + free (cache_path); > + > + return rc; > + > +#else /* ! HAVE_JSON_C */ > + return -ENOSYS; > +#endif > +} OK. That is it for debuginfod-client.c. Will go over the rest tomorrow. Cheers, Mark

Re: PR29472: debuginfod metadata query

2023-07-05 Thread Mark Wielaard
; +#endif Why the HAVE_JSON_C guard? debuginfod_find_metadata will return -ENOSYS if there is no support doesn't it? >else > { >argp_help (&argp, stderr, ARGP_HELP_USAGE, argv[0]); > @@ -240,8 +267,6 @@ main(int argc, char** argv) >debuginfod_end (clie

Re: PR29472: debuginfod metadata query

2023-07-05 Thread Mark Wielaard
ler > > + > + PR29472: debuginfod metadata query > + * debuginfod-find.1: Document metadata query. > + * debuginfod-client-config.7: Document metadata cache control setting. > + * debuginfod.8: Document new option and webapi. > + > 2023-02-14 Mark Wielaar

Re: PR29472: debuginfod metadata query

2023-07-07 Thread Mark Wielaard
cxx > index 5ef6cc32189b..000820fec5ea 100644 > --- a/debuginfod/debuginfod.cxx > +++ b/debuginfod/debuginfod.cxx > @@ -1,5 +1,5 @@ > /* Debuginfo-over-http server. > - Copyright (C) 2019-2021 Red Hat, Inc. > + Copyright (C) 2019-2023 Red Hat, Inc. > Copyright (C) 2021

Re: PR29472: debuginfod metadata query

2023-07-07 Thread Mark Wielaard
hive: "" } ] Or return an error as: { "error": "Server unreachable code: 554" } - I don't really know how to reason properly about the merging done for results from multiple federated servers. But it seems to make it impossible to distinguish between no results or an error fetching results. Maybe creating one big results array as is done is the most sane way. Have you though of other ways to represent "merged" results? Cheers, Mark

Re: [PATCH] tests: run-lfs-symbols.sh needs gawk

2023-07-20 Thread Mark Wielaard
or near / > FAIL run-lfs-symbols.sh (exit status: 2) > ``` > > * tests/run-lfs-symbols.sh: Call 'gawk' instead of 'awk'. Thanks. We already require gawk for known-dwarf.awk, check for it in configure and use it for the coverage generation. Pushed, Mark

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

2023-07-20 Thread Mark Wielaard
> https://builder.sourceware.org/buildbot/#builders/225/builds/84/steps/2/logs/err_text > - err.html: > https://builder.sourceware.org/buildbot/#builders/225/builds/84/steps/2/logs/err_html > This is your buildbot builder. Please kick it! :) Cheers, Mark

Re: eu-strip on .rustc section produce error information

2023-07-20 Thread Mark Wielaard
l table section 3 is and what 742th symbol in that table is? And does libtarget_1.so actually contain a .rustc section? Thanks, Mark

Re: Issue 60887 in oss-fuzz: elfutils:fuzz-libelf: Direct-leak in __libelf_decompress_zlib

2023-07-29 Thread Mark Wielaard
google or github account to login). Thanks, Mark On Thu, Jul 27, 2023 at 01:44:24PM -0700, ClusterFuzz-External via monorail via Elfutils-devel wrote: > Status: New > Owner: > CC: elfut...@sourceware.org, da...@adalogics.com, evv...@gmail.com, > izz...@google.com > Labe

Re: Issue 60887 in oss-fuzz: elfutils:fuzz-libelf: Direct-leak in __libelf_decompress_zlib

2023-07-30 Thread Mark Wielaard
4328c88fd610decaf311020ffc7073aec1db252/projects/elfutils/fuzz-libelf.c#L27C6-L27C20 Thanks, I can replicate it with that and valgrind. The issue is when elf_strptr has (partially) uncompressed the section data (to read the uncompressed string), the program never requests the (uncompressed) section data, but does (re)compress it. Working on a fix. Cheers, Mark

[PATCH] libelf: Free and clear rawdata_base and zdata_base consistently

2023-07-30 Thread Mark Wielaard
wdata): Free zdata_base if it isn't (going to be) used for rawdata_base. Explicitly clear rawdata_base and zdata_base after free. * libelf/elf_end.c (elf_end): Clear zdata_base after free. Signed-off-by: Mark Wielaard --- libelf/elf_compress.c | 14 +- libelf

Re: Fwd: Anton Baltser, bug with libdebuginfod

2023-07-31 Thread Mark Wielaard
= > make[1]: Nothing to be done for 'check-am'. > > Is that right result? That looks correct yes. Cheers, Mark

Re: 答复: eu-strip on .rustc section produce error information

2023-07-31 Thread Mark Wielaard
er this error infor: > https://sourceware.org/git/?p=elfutils.git;a=commitdiff;h=7bf4b63a4980788e6c1969cae02f0483e79c069f;hp=4f7b5ba9624489b5a2f714569c29ef865d4dcd6f > Is this error info an expected behavior? Yes. It is an expected warning. Cheers, Mark

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