Re: ☠ Buildbot (GNU Toolchain): elfutils - failed test (failure) (master)
Hi, On Mon, Aug 01, 2022 at 02:09:52AM +0200, Mark Wielaard wrote: > > - 7: make check ( failure ) > > Logs: > > - stdio: > > https://builder.sourceware.org/buildbot/#builders/43/builds/47/steps/7/logs/stdio > > - test-suite.log: > > https://builder.sourceware.org/buildbot/#builders/43/builds/47/steps/7/logs/test-suite_log > > So that is in the one little addition I made: > > -==3856043== Invalid read of size 1 > -==3856043==at 0x484EBE8: memrchr (vg_replace_strmem.c:1012) > -==3856043==by 0x100FEDF: handle_dynamic (readelf.c:1909) > -==3856043==by 0x102061D: print_dynamic (readelf.c:2013) > -==3856043==by 0x102061D: process_elf_file (readelf.c:1034) > -==3856043==by 0x1021FDB: process_dwflmod (readelf.c:818) > -==3856043==by 0x4962BCF: dwfl_getmodules (dwfl_getmodules.c:86) > -==3856043==by 0x100E175: process_file (readelf.c:926) > -==3856043==by 0x1006A75: main (readelf.c:395) > -==3856043== Address 0x56df358 is 24 bytes before a block of size 264 alloc'd > -==3856043==at 0x484C002: calloc (vg_replace_malloc.c:1328) > -==3856043==by 0x4A4EED9: elf_getdata_rawchunk > (elf_getdata_rawchunk.c:173) > -==3856043==by 0x1010621: get_dynscn_strtab (readelf.c:4958) > -==3856043==by 0x1010621: handle_dynamic (readelf.c:1884) > -==3856043==by 0x102061D: print_dynamic (readelf.c:2013) > -==3856043==by 0x102061D: process_elf_file (readelf.c:1034) > -==3856043==by 0x1021FDB: process_dwflmod (readelf.c:818) > -==3856043==by 0x4962BCF: dwfl_getmodules (dwfl_getmodules.c:86) > -==3856043==by 0x100E175: process_file (readelf.c:926) > -==3856043==by 0x1006A75: main (readelf.c:395) > > I am staring at the code, but don't immediately see which mistake I > made. Maybe I should use d_val instead of d_ptr (but those are both > uint64_t so that shouldn't really matter). Doh. Even though memchr searches backwards, it takes the start of the buffer instead of the end of the buffer as argument. Fixed as attached, also cleaned up the use of d_val vs d_ptr. Pushed after verifying with a try- build that it really fixes the issue. Cheers, Mark>From d0ff4e224738adf34eba38dc33ffda67e5da6634 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 1 Aug 2022 02:02:16 +0200 Subject: [PATCH] readelf: memrchr searches backwards but takes the start buf as argument The bug (caught by valgrind) was giving memrchr to end of the buffer. Also as cleanup, Use d_val not d_ptr for calculating offset. --- src/ChangeLog | 5 + src/readelf.c | 8 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index db20a6ef..42ce6640 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2022-08-01 Mark Wielaard + + * readelf.c (handle_dynamic): Pass start of buffer to memrchr. + Use dyn->d_un.d_val for offsets instead of d_ptr. + 2022-04-28 Di Chen * readelf.c (options): Add use-dynamic 'D'. diff --git a/src/readelf.c b/src/readelf.c index f4d973da..f1f77ce8 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -1905,10 +1905,10 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, GElf_Phdr *phdr) { if (! use_dynamic_segment) name = elf_strptr (ebl->elf, shdr->sh_link, dyn->d_un.d_val); - else if (dyn->d_un.d_ptr < strtab_data->d_size - && memrchr (strtab_data->d_buf + strtab_data->d_size - 1, '\0', - strtab_data->d_size - 1 - dyn->d_un.d_ptr) != NULL) - name = ((char *) strtab_data->d_buf) + dyn->d_un.d_ptr; + else if (dyn->d_un.d_val < strtab_data->d_size + && memrchr (strtab_data->d_buf + dyn->d_un.d_val, '\0', + strtab_data->d_size - 1 - dyn->d_un.d_val) != NULL) + name = ((char *) strtab_data->d_buf) + dyn->d_un.d_val; } switch (dyn->d_tag) -- 2.30.2
☺ Buildbot (GNU Toolchain): elfutils - build successful (master)
A restored build has been detected on builder elfutils-fedora-s390x while building elfutils. Full details are available at: https://builder.sourceware.org/buildbot/#builders/43/builds/48 Build state: build successful Revision: d0ff4e224738adf34eba38dc33ffda67e5da6634 Worker: fedora-s390x Build Reason: (unknown) Blamelist: Di Chen , Mark Wielaard Steps: - 0: worker_preparation ( success ) - 1: set package name ( success ) - 2: git checkout ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/43/builds/48/steps/2/logs/stdio - 3: autoreconf ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/43/builds/48/steps/3/logs/stdio - 4: configure ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/43/builds/48/steps/4/logs/stdio - 5: get version ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/43/builds/48/steps/5/logs/stdio - property changes: https://builder.sourceware.org/buildbot/#builders/43/builds/48/steps/5/logs/property_changes - 6: make ( warnings ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/43/builds/48/steps/6/logs/stdio - warnings (3): https://builder.sourceware.org/buildbot/#builders/43/builds/48/steps/6/logs/warnings__3_ - 7: make check ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/43/builds/48/steps/7/logs/stdio - test-suite.log: https://builder.sourceware.org/buildbot/#builders/43/builds/48/steps/7/logs/test-suite_log - 8: prep ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/43/builds/48/steps/8/logs/stdio - 9: build bunsen.cpio.gz ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/43/builds/48/steps/9/logs/stdio - 10: fetch bunsen.cpio.gz ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/43/builds/48/steps/10/logs/stdio - 11: unpack bunsen.cpio.gz ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/43/builds/48/steps/11/logs/stdio - 12: pass .bunsen.source.gitname ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/43/builds/48/steps/12/logs/stdio - 13: pass .bunsen.source.gitbranch ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/43/builds/48/steps/13/logs/stdio - 14: pass .bunsen.source.gitrepo ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/43/builds/48/steps/14/logs/stdio - 15: upload to bunsen ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/43/builds/48/steps/15/logs/stdio - 16: clean up ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/43/builds/48/steps/16/logs/stdio - 17: make clean ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/43/builds/48/steps/17/logs/stdio 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/17 Build state: failed test (failure) Revision: d0ff4e224738adf34eba38dc33ffda67e5da6634 Worker: bb3 Build Reason: (unknown) Blamelist: Mark Wielaard Steps: - 0: worker_preparation ( success ) - 1: set package name ( success ) - 2: git checkout ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/17/steps/2/logs/stdio - 3: autoreconf ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/17/steps/3/logs/stdio - 4: configure ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/17/steps/4/logs/stdio - 5: get version ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/17/steps/5/logs/stdio - property changes: https://builder.sourceware.org/buildbot/#builders/88/builds/17/steps/5/logs/property_changes - 6: make ( warnings ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/17/steps/6/logs/stdio - warnings (3): https://builder.sourceware.org/buildbot/#builders/88/builds/17/steps/6/logs/warnings__3_ - 7: make check ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/17/steps/7/logs/stdio - test-suite.log: https://builder.sourceware.org/buildbot/#builders/88/builds/17/steps/7/logs/test-suite_log - 8: make distcheck ( failure ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/17/steps/8/logs/stdio - test-suite.log: https://builder.sourceware.org/buildbot/#builders/88/builds/17/steps/8/logs/test-suite_log - warnings
Re: ☺ Buildbot (GNU Toolchain): elfutils - build successful (master)
On Mon, Aug 01, 2022 at 09:36:33AM +, builder--- via Elfutils-devel wrote: > A restored build has been detected on builder elfutils-fedora-s390x while > building elfutils. > > Full details are available at: > https://builder.sourceware.org/buildbot/#builders/43/builds/48 > > Build state: build successful > Revision: d0ff4e224738adf34eba38dc33ffda67e5da6634 > Worker: fedora-s390x > Build Reason: (unknown) > Blamelist: Di Chen , Mark Wielaard That is good! \o/ > 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/17 > > Build state: failed test (failure) > Revision: d0ff4e224738adf34eba38dc33ffda67e5da6634 > Worker: bb3 > Build Reason: (unknown) > Blamelist: Mark Wielaard But that is bad :{ > - 8: make distcheck ( failure ) > Logs: > - stdio: > https://builder.sourceware.org/buildbot/#builders/88/builds/17/steps/8/logs/stdio > - test-suite.log: > https://builder.sourceware.org/buildbot/#builders/88/builds/17/steps/8/logs/test-suite_log > - warnings (3): > https://builder.sourceware.org/buildbot/#builders/88/builds/17/steps/8/logs/warnings__3_ The issue is in run-debuginfod-percent-escape.sh. It does a kill -USR1 $PID1 and then wait_ready $PORT1 'thread_work_total{role="traverse"}' 1 But that can race with the initial traversal done at startup. Fixed as attached. Cheers, Mark>From bcd7651eb06f2e57a04ca97ae69b42c174fe3db3 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 1 Aug 2022 12:18:30 +0200 Subject: [PATCH] tests: Add initial scan wait_ready in run-debuginfod-percent-escape.sh Otherwise wait_ready for thread_work_total{role="traverse"} after the kill -USR1 can be either zero, one or two. We want to see it change to one first, then after the kill -USR1 it should change to two to be sure the scan happened after the new binary was created. Signed-off-by: Mark Wielaard --- tests/ChangeLog| 4 tests/run-debuginfod-percent-escape.sh | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/ChangeLog b/tests/ChangeLog index fb573d80..0c6f68ef 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +2022-08-01 Mark Wielaard + + * run-debuginfod-percent-escape.sh: Add initial scan wait_ready. + 2022-04-28 Di Chen * run-readelf-Dd.sh: New test. diff --git a/tests/run-debuginfod-percent-escape.sh b/tests/run-debuginfod-percent-escape.sh index f7d8dc66..cd867427 100755 --- a/tests/run-debuginfod-percent-escape.sh +++ b/tests/run-debuginfod-percent-escape.sh @@ -34,7 +34,8 @@ tempfiles vlog$PORT1 errfiles vlog$PORT1 # Server must become ready wait_ready $PORT1 'ready' 1 -# Be patient when run on a busy machine things might take a bit. +# And initial scan should be done +wait_ready $PORT1 'thread_work_total{role="traverse"}' 1 # Build a non-stripped binary echo "int main() { return 0; }" > ${PWD}/F/p++r\$\#o^^g.c @@ -44,7 +45,7 @@ BUILDID=`env LD_LIBRARY_PATH=$ldpath ${abs_builddir}/../src/readelf \ tempfiles ${PWD}/F/p++r\$\#o^^g.c ${PWD}/F/p++r\$\#o^^g kill -USR1 $PID1 # Now there should be 1 files in the index -wait_ready $PORT1 'thread_work_total{role="traverse"}' 1 +wait_ready $PORT1 'thread_work_total{role="traverse"}' 2 wait_ready $PORT1 'thread_work_pending{role="scan"}' 0 wait_ready $PORT1 'thread_busy{role="scan"}' 0 rm -rf $DEBUGINFOD_CACHE_PATH # clean it from previous tests -- 2.30.2
☺ Buildbot (GNU Toolchain): elfutils - build successful (master)
A restored build 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/18 Build state: build successful Revision: bcd7651eb06f2e57a04ca97ae69b42c174fe3db3 Worker: bb3 Build Reason: (unknown) Blamelist: Mark Wielaard Steps: - 0: worker_preparation ( success ) - 1: set package name ( success ) - 2: git checkout ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/2/logs/stdio - 3: autoreconf ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/3/logs/stdio - 4: configure ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/4/logs/stdio - 5: get version ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/5/logs/stdio - property changes: https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/5/logs/property_changes - 6: make ( warnings ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/6/logs/stdio - warnings (3): https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/6/logs/warnings__3_ - 7: make check ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/7/logs/stdio - test-suite.log: https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/7/logs/test-suite_log - 8: make distcheck ( warnings ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/8/logs/stdio - test-suite.log: https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/8/logs/test-suite_log - warnings (5): https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/8/logs/warnings__5_ - 9: prep ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/9/logs/stdio - 10: build bunsen.cpio.gz ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/10/logs/stdio - 11: fetch bunsen.cpio.gz ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/11/logs/stdio - 12: unpack bunsen.cpio.gz ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/12/logs/stdio - 13: pass .bunsen.source.gitname ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/13/logs/stdio - 14: pass .bunsen.source.gitbranch ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/14/logs/stdio - 15: pass .bunsen.source.gitrepo ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/15/logs/stdio - 16: upload to bunsen ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/16/logs/stdio - 17: clean up ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/17/logs/stdio - 18: make clean ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#builders/88/builds/18/steps/18/logs/stdio
[Bug libdw/29434] New: Memory leak in `dwarf_getscopes`
https://sourceware.org/bugzilla/show_bug.cgi?id=29434 Bug ID: 29434 Summary: Memory leak in `dwarf_getscopes` Product: elfutils Version: unspecified Status: UNCONFIRMED Severity: normal Priority: P2 Component: libdw Assignee: unassigned at sourceware dot org Reporter: godlygeek at gmail dot com CC: elfutils-devel at sourceware dot org Target Milestone: --- Found by valgrind: ==173857== 64 bytes in 2 blocks are definitely lost in loss record 3,155 of 8,232 ==173857==at 0x480B7BB: malloc (vg_replace_malloc.c:380) ==173857==by 0x90143DC: pc_record (in /path/to/python_extension_module.cpython-38-x86_64-linux-gnu.so) ==173857==by 0x9019ABC: walk_children (in /path/to/python_extension_module.cpython-38-x86_64-linux-gnu.so) ==173857==by 0x901974A: __libdw_visit_scopes (in /path/to/python_extension_module.cpython-38-x86_64-linux-gnu.so) ==173857==by 0x9019A69: walk_children (in /path/to/python_extension_module.cpython-38-x86_64-linux-gnu.so) ==173857==by 0x901974A: __libdw_visit_scopes (in /path/to/python_extension_module.cpython-38-x86_64-linux-gnu.so) ==173857==by 0x9014691: dwarf_getscopes (in /path/to/python_extension_module.cpython-38-x86_64-linux-gnu.so) `dwarf_getscopes` ends with: ``` if (result > 0) *scopes = a.scopes; return result; ``` but this is incorrect, since `a.scopes` may be non-NULL even if `result` is <= 0 and is leaked in this case since no reference is retained to it. Seems like this needs to be: ``` if (result > 0) *scopes = a.scopes; else free(a.scopes); return result; ``` -- You are receiving this mail because: You are on the CC list for the bug.