[Bug libdw/27805] libdwfl: Unable to extract source line information for RISC-V binary
https://sourceware.org/bugzilla/show_bug.cgi?id=27805 --- Comment #6 from John Doe --- I can confirm that compiling the code without -gc-sections seems to resolve this bug. Probably not RISC-V specific. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug libdw/28148] New: eu-addr2line reports function name of the caller when code is inlined
https://sourceware.org/bugzilla/show_bug.cgi?id=28148 Bug ID: 28148 Summary: eu-addr2line reports function name of the caller when code is inlined Product: elfutils Version: unspecified Status: UNCONFIRMED Severity: normal Priority: P2 Component: libdw Assignee: unassigned at sourceware dot org Reporter: n2knqf5ogu at bsogq dot anonbox.net CC: elfutils-devel at sourceware dot org Target Milestone: --- Created attachment 13570 --> https://sourceware.org/bugzilla/attachment.cgi?id=13570&action=edit Binary to reproduce described bug with eu-addrline For inlined code addr2line from binutils reports the function name of the inlined function. eu-addrline from elfutils, on the other hand, reports the function name of the function where the code was inlined (i.e. the caller). However, similar to addr2line, eu-addrline reports the file name of the file where the inlined code is defined. Which is very confusing as **the eu-addrline output reports a function name which is not defined in the reported file** for this reason. Compare the following elfutils-0.185 and binutils-2.35 output for the attached RISC-V binary: $ eu-addr2line -f -e inlined-bug.elf 20400e10 __atomic_fetch_and_4 /home/john/src/RIOT/cpu/riscv_common/include/irq_arch.h:62:5 $ addr2line -f -e inlined-bug.elf 20400e10 irq_disable /home/john/src/RIOT/cpu/riscv_common/include/irq_arch.h:62 The binutils output is correct, the irq_disable function is inlined at address 20400e10 (in the caller __atomic_fetch_and_4) and the irq_disable function is defined in /home/john/src/RIOT/cpu/riscv_common/include/irq_arch.h. The elfutils output on the other hand is confusing as __atomic_fetch_and_4 is not defined in /home/john/src/RIOT/cpu/riscv_common/include/irq_arch.h. I noticed this while using dwfl_module_getsrc/dwfl_lineinfo/dwfl_module_addrname in my own code, the addr2line example just makes it easier to reproduce this issue. From a library standpoint I find it confusing how inlined functions are presently handled in libdwfl as it is often unclear if a libdwfl function returns information about the caller or the inlined function in such cases. -- You are receiving this mail because: You are on the CC list for the bug.
Re: [Bug debuginfod/27983] ignore duplicate urls
Hi Noah, On Mon, 2021-07-26 at 12:29 -0400, Noah Sanci via Elfutils-devel wrote: > The realloc returning NULL issue has been resolved and the patch > successfully rebased onto master. Please find these improvements > attached. This looks really good, but I found some small issues. First it turns out reallocarray isn't available on some older systems. This is easy to workaround though since it is a fairly simple function we could provide ourselves if it isn't there. The attached patch does that. I'll push it if it looks good. Second there is a small memory leak found by valgrind. We only clean up the server_url_list on failure, but we should also clean it up when we are done on success: diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod- client.c index 9d049d33..0f65f115 100644 --- a/debuginfod/debuginfod-client.c +++ b/debuginfod/debuginfod-client.c @@ -1191,6 +1191,9 @@ debuginfod_query_server (debuginfod_client *c, } free (data); + for (int i = 0; i < num_urls; ++i) +free(server_url_list[i]); + free(server_url_list); free (server_urls); /* don't close fd - we're returning it */ Finally on some systems, but not all, one of the tests in run- debuginfod-find.sh failed. In particular this one: # check out the debuginfod logs for the new style status lines # cat vlog$PORT2 grep -q 'UA:.*XFF:.*GET /buildid/.* 200 ' vlog$PORT2 grep -q 'UA:.*XFF:.*GET /metrics 200 ' vlog$PORT2 grep -q 'UA:.*XFF:.*GET /badapi 503 ' vlog$PORT2 grep -q 'UA:.*XFF:.*GET /buildid/deadbeef.* 404 ' vlog$PORT2 That last one changed error message from 404 to 503. This seems related to the setting of DEBUGINFOD_URLS earlier by the new test you added. If I change that to: diff --git a/tests/run-debuginfod-find.sh b/tests/run-debuginfod-find.sh index c2c3b9c3..ec639a38 100755 --- a/tests/run-debuginfod-find.sh +++ b/tests/run-debuginfod-find.sh @@ -367,8 +367,7 @@ wait_ready $PORT1 'found_sourcerefs_total{source=".rpm archive"}' $sourcefiles # PR27983 ensure no duplicate urls are used in when querying servers for files rm -rf $DEBUGINFOD_CACHE_PATH # clean it from previous tests -export DEBUGINFOD_URLS="http://127.0.0.1:$PORT1 http://127.0.0.1:$PORT1 http://127.0.0.1:$PORT1 http:127.0.0.1:7999" -env LD_LIBRARY_PATH=$ldpath ${abs_top_builddir}/debuginfod/debuginfod-find -v executable $BUILDID2 > vlog4 2>&1 || true +env DEBUGINFOD_URLS="http://127.0.0.1:$PORT1 http://127.0.0.1:$PORT1 http://127.0.0.1:$PORT1 http:127.0.0.1:7999" LD_LIBRARY_PATH=$ldpath ${abs_top_builddir}/debuginfod/debuginfod-find -v executable $BUILDID2 > vlog4 2>&1 || true tempfiles vlog4 if [ $( grep -c 'duplicate url: http://127.0.0.1:'$PORT1'.*' vlog4 ) -ne 2 ]; then echo "Duplicated servers remain"; Everything seems to pass everywhere. run-debuginfod-find.sh is really convoluted and we really shouldn't add more and more interacting tests to it. But if we do maybe we should use the env DEBUGINFOD_URLS=... trick to minimize changing other tests in the same file. If you agree with the above two changes, could you resubmit the patch with those? Thanks, Mark From 61210f91afa4084a46bd0f84d12aa6d3f29c1271 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 28 Jul 2021 16:46:36 +0200 Subject: [PATCH] lib: Add static inline reallocarray fallback function Signed-off-by: Mark Wielaard --- ChangeLog | 4 configure.ac | 3 +++ lib/ChangeLog | 4 lib/system.h | 14 ++ 4 files changed, 25 insertions(+) diff --git a/ChangeLog b/ChangeLog index a01f6f9f..12b8f403 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2021-07-28 Mark Wielaard + + * configure.ac (AC_CHECK_DECLS): Add reallocarray check. + 2021-05-22 Mark Wielaard * configure.ac (AC_INIT): Set version to 0.185. diff --git a/configure.ac b/configure.ac index b348a717..7caff2c5 100644 --- a/configure.ac +++ b/configure.ac @@ -425,6 +425,9 @@ AC_CHECK_DECLS([powerof2],[],[],[#include ]) AC_CHECK_DECLS([mempcpy],[],[], [#define _GNU_SOURCE #include ]) +AC_CHECK_DECLS([reallocarray],[],[], + [#define _GNU_SOURCE +#include ]) AC_CHECK_FUNCS([process_vm_readv]) diff --git a/lib/ChangeLog b/lib/ChangeLog index dd3ebcab..44366fec 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2021-07-28 Mark Wielaard + + * system.h (reallocarray): New static inline fallback function. + 2021-04-19 Martin Liska * system.h (startswith): New function. diff --git a/lib/system.h b/lib/system.h index cdf18ed7..58d9deee 100644 --- a/lib/system.h +++ b/lib/system.h @@ -38,6 +38,7 @@ #include #include #include +#include #if __BYTE_ORDER == __LITTLE_ENDIAN # define LE32(n) (n) @@ -70,6 +71,19 @@ ((void *) ((char *) memcpy (dest, src, n) + (size_t) n)) #endif +#if !HAVE_DECL_REALLOCARRAY +static inline void * +reallocarray (void *ptr, size_t nmemb, size_t
Re: [Bug debuginfod/27983] ignore duplicate urls
Hello This patch fixes a memory leak and slightly alters the PR27983 test, isolating where its DEBUGINFO_URLS's duplicates are accessible, which fixes a case of test failure on some systems. Noah On Wed, Jul 28, 2021 at 10:55 AM Mark Wielaard wrote: > > Hi Noah, > > On Mon, 2021-07-26 at 12:29 -0400, Noah Sanci via Elfutils-devel wrote: > > The realloc returning NULL issue has been resolved and the patch > > successfully rebased onto master. Please find these improvements > > attached. > > This looks really good, but I found some small issues. > > First it turns out reallocarray isn't available on some older systems. > This is easy to workaround though since it is a fairly simple function > we could provide ourselves if it isn't there. The attached patch does > that. I'll push it if it looks good. > > Second there is a small memory leak found by valgrind. We only clean up > the server_url_list on failure, but we should also clean it up when we > are done on success: > > diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod- > client.c > index 9d049d33..0f65f115 100644 > --- a/debuginfod/debuginfod-client.c > +++ b/debuginfod/debuginfod-client.c > @@ -1191,6 +1191,9 @@ debuginfod_query_server (debuginfod_client *c, > } > >free (data); > + for (int i = 0; i < num_urls; ++i) > +free(server_url_list[i]); > + free(server_url_list); >free (server_urls); > >/* don't close fd - we're returning it */ > > Finally on some systems, but not all, one of the tests in run- > debuginfod-find.sh failed. In particular this one: > > # check out the debuginfod logs for the new style status lines > # cat vlog$PORT2 > grep -q 'UA:.*XFF:.*GET /buildid/.* 200 ' vlog$PORT2 > grep -q 'UA:.*XFF:.*GET /metrics 200 ' vlog$PORT2 > grep -q 'UA:.*XFF:.*GET /badapi 503 ' vlog$PORT2 > grep -q 'UA:.*XFF:.*GET /buildid/deadbeef.* 404 ' vlog$PORT2 > > That last one changed error message from 404 to 503. This seems related > to the setting of DEBUGINFOD_URLS earlier by the new test you added. If > I change that to: > > diff --git a/tests/run-debuginfod-find.sh b/tests/run-debuginfod-find.sh > index c2c3b9c3..ec639a38 100755 > --- a/tests/run-debuginfod-find.sh > +++ b/tests/run-debuginfod-find.sh > @@ -367,8 +367,7 @@ wait_ready $PORT1 'found_sourcerefs_total{source=".rpm > archive"}' $sourcefiles > > # PR27983 ensure no duplicate urls are used in when querying servers for > files > rm -rf $DEBUGINFOD_CACHE_PATH # clean it from previous tests > -export DEBUGINFOD_URLS="http://127.0.0.1:$PORT1 http://127.0.0.1:$PORT1 > http://127.0.0.1:$PORT1 http:127.0.0.1:7999" > -env LD_LIBRARY_PATH=$ldpath ${abs_top_builddir}/debuginfod/debuginfod-find > -v executable $BUILDID2 > vlog4 2>&1 || true > +env DEBUGINFOD_URLS="http://127.0.0.1:$PORT1 http://127.0.0.1:$PORT1 > http://127.0.0.1:$PORT1 http:127.0.0.1:7999" LD_LIBRARY_PATH=$ldpath > ${abs_top_builddir}/debuginfod/debuginfod-find -v executable $BUILDID2 > > vlog4 2>&1 || true > tempfiles vlog4 > if [ $( grep -c 'duplicate url: http://127.0.0.1:'$PORT1'.*' vlog4 ) -ne 2 > ]; then >echo "Duplicated servers remain"; > > Everything seems to pass everywhere. > > run-debuginfod-find.sh is really convoluted and we really shouldn't add > more and more interacting tests to it. But if we do maybe we should use > the env DEBUGINFOD_URLS=... trick to minimize changing other tests in > the same file. > > If you agree with the above two changes, could you resubmit the patch > with those? > > Thanks, > > Mark From b9d36857b6b7cf4f2889280119ba01628afe2420 Mon Sep 17 00:00:00 2001 From: Noah Sanci Date: Fri, 9 Jul 2021 14:53:10 -0400 Subject: [PATCH] debuginfod: PR27983 - ignore duplicate urls Gazing at server logs, one sees a minority of clients who appear to have duplicate query traffic coming in: the same URL, milliseconds apart. Chances are the user accidentally doubled her $DEBUGINFOD_URLS somehow, and the client library is dutifully asking the servers TWICE. Bug #27863 reduces the pain on the servers' CPU, but dupe network traffic is still being paid. We should reject sending outright duplicate concurrent traffic. The urls are now simply removed upon finding a duplicate after url construction. https://sourceware.org/bugzilla/show_bug.cgi?id=27983 Signed-off-by: Noah Sanci --- debuginfod/ChangeLog | 9 +++ debuginfod/debuginfod-client.c | 104 +++-- tests/ChangeLog| 6 ++ tests/run-debuginfod-find.sh | 11 4 files changed, 99 insertions(+), 31 deletions(-) diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog index 7709c24d..81eb56f9 100644 --- a/debuginfod/ChangeLog +++ b/debuginfod/ChangeLog @@ -34,6 +34,15 @@ (parse_opt): Handle 'r' option by setting regex_groom to true. (groom): Introduce and use reg_include and reg_exclude. +2021-07-09 Noah Sanci + + PR27983 + * debuginfod-client.c (debuginfod_q
[PATCH] debuginfod-doc: PR27950 - Remove redanduncies in man page.
Create a new file, debuginfod-client-config.7, that holds all environment variables and cache control files related info. Get rid of repetitive definitions in three other files, instead, those files will include the content of new file. Any future modification related to environment variables and cache files will only require changes in one file. Signed-off-by: Alice Zhang --- doc/ChangeLog | 10 + doc/debuginfod-client-config.7 | 68 + doc/debuginfod-find.1 | 30 +-- doc/debuginfod.8| 49 +--- doc/debuginfod_find_debuginfo.3 | 51 + 5 files changed, 81 insertions(+), 127 deletions(-) create mode 100644 doc/debuginfod-client-config.7 diff --git a/doc/ChangeLog b/doc/ChangeLog index 05fcd23d..4ace8771 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,13 @@ +2021-07-28 Alice Zhang + + PR27950 + * debuginfod-client-config.7: New file to store all cache config + infos. + * debuginfod-find.1: Removed redundant occurrences of environment + variables & cache control files. + * debuginfod.8: Likewise. + * debuginfod_find_debuginfo.3: Likewise. + 2021-04-23 Frank Ch. Eigler PR27701 diff --git a/doc/debuginfod-client-config.7 b/doc/debuginfod-client-config.7 new file mode 100644 index ..81539dc2 --- /dev/null +++ b/doc/debuginfod-client-config.7 @@ -0,0 +1,68 @@ +.SH ENVIRONMENT VARIABLES +.TP 21 +.B TMPDIR +This environment variable points to a file system to be used for +temporary files. The default is /tmp. + +.TP 21 +.B DEBUGINFOD_URLS +This environment variable contains a list of URL prefixes for trusted +debuginfod instances. Alternate URL prefixes are separated by space. +Avoid referential loops that cause a server to contact itself, directly +or indirectly - the results would be hilarious. + +.TP 21 +.B DEBUGINFOD_TIMEOUT +This environment variable governs the timeout for each debuginfod HTTP +connection. A server that fails to provide at least 100K of data +within this many seconds is skipped. The default is 90 seconds. (Zero +or negative means "no timeout".) + + +.TP 21 +.B DEBUGINFOD_CACHE_PATH +This environment variable governs the location of the cache where +downloaded files are kept. It is cleaned periodically as this +program is reexecuted. If XDG_CACHE_HOME is set then +$XDG_CACHE_HOME/debuginfod_client is the default location, otherwise +$HOME/.cache/debuginfod_client is used. For more information regarding +the client cache see \fIdebuginfod_find_debuginfo(3)\fP. + +.TP 21 +.B DEBUGINFOD_PROGRESS +This environment variable governs the default progress function. If +set, and if a progressfn is not explicitly set, then the library will +configure a default progressfn. This function will append a simple +progress message periodically to stderr. The default is no progress +function output. + +.TP 21 +.B DEBUGINFOD_VERBOSE +This environment variable governs the default file descriptor for +verbose output. If set, and if a verbose fd is not explicitly set, +then the verbose output will be produced on STDERR_FILENO. + +.TP 21 +.B DEBUGINFOD_RETRY_LITMIT +This environment variable governs the default limit of retry attempts. If a +query failed with errno other than ENOENT, will initiate several attempts +within the limit. + +.SH FILES +.TP 20 +.B $HOME/.debuginfod.sqlite +Default database file. +.PD + +.TP 20 +.B $XDG_CACHE_HOME/debuginfod_client +Default cache directory for content from upstream debuginfods. +If XDG_CACHE_HOME is not set then \fB$HOME/.cache/debuginfod_client\fP +is used. +.PD + +.TP 20 +.B $HOME/.debuginfod_client_cache +Default cache directory. If XDG_CACHE_HOME is not set then +\fB$HOME/.cache/debuginfod_client\fP is used. +.PD diff --git a/doc/debuginfod-find.1 b/doc/debuginfod-find.1 index 12d4ec2d..ec357b38 100644 --- a/doc/debuginfod-find.1 +++ b/doc/debuginfod-find.1 @@ -125,35 +125,7 @@ for the basic plaintext \%\fIhttp[s]://userid:password@hostname/\fP style. (The debuginfod server does not perform authentication, but a front-end proxy server could.) -.SH "ENVIRONMENT VARIABLES" - -.TP 21 -.B DEBUGINFOD_URLS -This environment variable contains a list of URL prefixes for trusted -debuginfod instances. Alternate URL prefixes are separated by space. - -.TP 21 -.B DEBUGINFOD_TIMEOUT -This environment variable governs the timeout for each debuginfod HTTP -connection. A server that fails to provide at least 100K of data -within this many seconds is skipped. The default is 90 seconds. (Zero -or negative means "no timeout".) - -.TP 21 -.B DEBUGINFOD_CACHE_PATH -This environment variable governs the location of the cache where -downloaded files are kept. It is cleaned periodically as this program -is reexecuted. Cache management parameters may be set by files under -this directory: see the \fBdebuginfod_find_debuginfo(3)\fP man page -for details. The defau