| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
It is expected from libdw to return strings that are null-terminated to
avoid overflowing ELF data.
* Add calculation of a safe prefix inside string sections, where any
string will be null-terminated.
* Check if offset overflows the safe prefix in dwarf_formstring.
Signed-off-by: Aleksei Vetrov <vvvvvv@google.com>
|
|
|
|
|
|
|
|
|
| |
There have been a couple of cases where demangler support has been
accidentially been disabled because libstdc++ wasn't there/installed
during build. Make it an error if --disable-demangler isn't explicitly
given.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
| |
Fixes indentation of -g option.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
| |
In __libdw_intern_expression we checked for one byte too many.
We only need one byte for the size and (at least one) for the uleb128
DIE reference.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
|
| |
dwarf_getlocation would return an error when it saw a
DW_OP_GNU_uninit. Handle it by simply recognizing as a no argument
operation.
DW_OP_GNU_uninit is emitted by GCC as a marker to flag the location
expression as referring to an uninitialized value.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
| |
Add sanity check making sure an leb128 isn't being read beyond the
end of the current data segment. Most code already had these guards,
but some were missing. This makes sure an appropriate error is
generated instead.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
| |
__libdw_get_uleb128 and __libdw_get_sleb128 should check if addrp has
already reached the end before unrolling the first step. It is done by
moving __libdw_max_len to the beginning of the function, which can
notice, that addrp is beyond the end. Then we just check the result of
this function.
Signed-off-by: Aleksei Vetrov <vvvvvv@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
binutils 2.40 introduces DW_TAG_unspecified_type for assembly
functions with an unknown return type. This breaks the
run-funcretval.sh testcase because dwfl_module_return_value_location
returns an error for such functions because it cannot determine the
return value location. Fix that by treating DW_TAG_unspecified_type
as if the DIE doesn't have a DW_AT_type.
Also update the testcase to explicitly checking for
DW_TAG_unspecified_type and printing "returns unspecified type".
https://sourceware.org/bugzilla/show_bug.cgi?id=30047
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add support for clang Memory Sanitizer [1], which detects the usage of
uninitialized values. While elfutils itself is already checked with
valgrind, checking code that depends on elfutils requires elfutils to
be built with MSan.
MSan is not linked into shared libraries, and is linked into
executables statically. Therefore, unlike the other sanitizers, MSan
needs to be configured fairly early, since we need to drop
-D_FORTIFY_SOURCE [2], -Wl,-z,defs and --no-undefined.
Disable a few tests that run for more than 5 minutes due to test files
being statically linked with MSan.
[1] https://clang.llvm.org/docs/MemorySanitizer.html
[2] https://github.com/google/sanitizers/issues/247
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
|
|
|
|
|
|
|
|
|
| |
On the low level, they are the same as pointers. The change needs to be
done for all backends, so define a function and a macro to avoid
repetition. Also add a native test, which has to be implemented in C++.
Add the configure check for it.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
clang complains:
debuginfod.cxx:354:1: error: unused variable 'apba__' [-Werror,-Wunused-const-variable]
ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT;
^
../lib/printversion.h:47:21: note: expanded from macro 'ARGP_PROGRAM_BUG_ADDRESS_DEF'
const char *const apba__ __asm ("argp_program_bug_address")
^
The default linkage for consts in C++ is internal, so declare them
extern. While at it, remove the debuginfod workaround for
argp_program_version_hook.
Co-developed-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
|
|
|
|
|
|
| |
It's showing up in git status when configuring in the source directory.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
|
|
|
|
|
|
|
| |
__cxa_demangle is normally implemented in the C++ runtime library,
instrumenting which for MSan is a hassle. Add a knob for disbling it.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
|
|
|
|
|
|
|
|
|
|
|
| |
By default, clang produces .llvm_addrsig sections [1]. The GNU
toolchain does not know how to handle them yet [2], so just ask clang
not to generate them for the time being.
[1] https://llvm.org/docs/Extensions.html#sht-llvm-addrsig-section-address-significance-table
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105625
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
clang complains:
readelf.c:12205:72: error: parameter 'desc' set but not used [-Werror,-Wunused-but-set-parameter]
handle_bit_registers (const Ebl_Register_Location *regloc, const void *desc,
^
Mark Wielaard says:
It is never really used since as far as I can see we don't have any
backend with a core register sets where a register doesn't have a
number of bits which isn't a multiple of 8 (only ia64 has some 1
bit registers, but those don't seem part of the core register set).
If we do accidentally try to handle such a register having an abort
is also not very nice. Lets just warn and return/continue.
https://sourceware.org/bugzilla/show_bug.cgi?id=30084
Co-developed-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
clang complains:
asm_newscn.c:48:22: error: field 'pattern' with variable sized type 'struct FillPattern' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
struct FillPattern pattern;
^
Fix by using a union instead. Define the second union member to be a
char array 1 byte larger than struct FillPattern. This should be legal
according to 6.7.9:
If an object that has static or thread storage duration is not
initialized explicitly, then ... if it is a union, the first named
member is initialized (recursively) according to these rules, and
any padding is initialized to zero bits.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
|
|
|
|
|
|
| |
There is run-addr2line-i-demangle-test.sh for that.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
MSan complains:
Uninitialized value was created by an allocation of 'reglocs' in the stack frame
#0 0x562d35c686f0 in handle_core_note elfutils/src/readelf.c:12674:3
#const Ebl_Register_Location *reglocs;
==1006199==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x562d35c68a2a in handle_core_note elfutils/src/readelf.c:12692:11
#colno = handle_core_registers (ebl, ebl->elf, desc + regs_offset,
# reglocs, nregloc);
Strictly speaking, this is not a problem, because nregloc == 0, but for
other note types we initialize it anyway, so do it here as well.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
clang complains:
readelf.c:10250:10: error: variable 'nculist' set but not used [-Werror,-Wunused-but-set-variable]
size_t nculist = 0;
^
Fix by deleting it.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
contain it.
Before attempting to download a section, cache_find_section tries to
extract the section from existing files in the cache. If it's determined
that the section must not exist, cache_find_section returns -ENOENT to
indicate that the download should be skipped.
This patch fixes a bug where cache_find_section returns -ENOENT even
though the section exists. If the cache contains the executable but
not the debuginfo with the given build-id and the section only exists
in the debuginfo (such as any of the .debug_* sections), then
debuginfod_find_section returns -ENOENT even if the section could be
downloaded.
Fix this by having cache_find_section not return -ENOENT unless cached
debuginfo was able to be read.
Signed-off-by: Aaron Merey <amerey@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Both debuginfod.h and libdwfl.h have a simple typedef for struct
debuginfod_client. Some compilers pedantically warn when including
both headers that such typedefs are only officially supported in
C11. So guard them with _ELFUTILS_DEBUGINFOD_CLIENT_TYPEDEF to
make them happy.
https://sourceware.org/bugzilla/show_bug.cgi?id=30077
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
| |
https://sourceware.org/bugzilla/show_bug.cgi?id=30072
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With gcc -flto the abstract origin of an inlined subroutine
could be in a different CU. dwarf_getscopes might return an
empty scope if it cannot find the abstract origin scope. So
make sure to search in the
We also tried to add the origin match in pc_record directly
in the current inlined scope. This always failed, causing
to do a needless traversal, followed by the full CU scan in
dwarf_getscopes. Just always stop the pc_record search and
then do the CU origin_match in dwarf_getscopes.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The --demangle option takes an option (ignored) argument. Since -C
is the short option of --demangle it also takes that optional
argument. But that means that something like -Cfi is like -C got
fi as argument, while the user expects -Cfi to be like -C -f -i.
Separate the --demangle and -C options. --demangle still takes
an optional (ignored) argument, but -C doesn't take any arguments
so -Cfi acts the same as -fiC.
Also fix --target, -b, so that it is properly ignored (and not
accidentially enables demangling).
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
| |
elf_memory call in __libdw_open_elf_memory can return NULL. It was not
checked and led to the null pointer dereference.
Signed-off-by: Aleksei Vetrov <vvvvvv@google.com>
|
|
|
|
|
|
|
|
|
| |
If /bin/sh wasn't build with build-id the test fails because
debuginfod-find will not be able to even try to fetch something.
Use libdebuginfod.so.1 instead as test file because we just
build that and configure makes sure we always produce a build-id.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
| |
Using the NONE relocation doesn't do anything, but is harmless.
This fixes several (self) tests on sparc that use elflint to
check files are valid ELF.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
| |
The various print_debug_*_section functions didn't get the section
data in the same way. Add a new get_debug_elf_data function that
gets the (possibly relocated) section data and that checks (and
warns) if the data might still be compressed in a way that we
cannot decompress.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
debuginfod/ChangeLog:
* debuginfod-client.c: Typo simultaniously.
doc/ChangeLog:
* debuginfod.8: Typo succesfully.
lib/ChangeLog:
* dynamicsizehash_concurrent.c: Typo modul.
* system.h: Typo dependend.
libdwfl/ChangeLog:
* open.c: Typo non-existant.
src/ChangeLog:
* nm.c: Typo Covert.
* strings.c: Likewise.
tests/ChangeLog:
* elfstrmerge.c: Typo outselves.
* run-debuginfod-extraction.sh: Typo accidentially.
* run-debuginfod-fd-prefetch-caches.sh: Likewise.
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
doc/ChangeLog:
* debuginfod-find.1: add a note to DESCRIPTION section for the 'source'
subcommand, clarifying where to find the CU compilation-directory.
I'm looking at how to improve and document the workflow for using
debuginfod-find to study the behaviour of packaged software on a system, e.g.
in conjunction with a tracing tool like SystemTap. You can read the exact
compiled source code with debuginfod-find source and use that to figure out
which source code locations are interesting to trace. But that process has
several non-obvious or inconvenient steps.
This patch is a clarification to the debuginfod-find source man page pointing
out the eu-readelf command that can show the comp_dir in downloaded debuginfo.
Since debuginfod-find source could be picked up and used by a developer
unfamiliar with DWARF terminology, I think such a clarification saves time
for newbies figuring out what a CU compilation-directory is.
Signed-off-by: Serhei Makarov <serhei@serhei.io>
|
|
|
|
|
|
|
| |
... based on rlimit (rlimig -n NUM)
... based on cpu-affinity (taskset -c A,B,C,D ...)
Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
|
|
|
|
|
|
| |
https://sourceware.org/bugzilla/show_bug.cgi?id=29926
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
config/ChangeLog:
* libelf.pc.in: Add LIBLZSTD to Requires.private.
ChangeLog:
* configure.ac: Detect ZSTD streaming API.
libelf/ChangeLog:
* Makefile.am: Use zstd_LIBS.
* elf_compress.c:
(__libelf_compress): Split into ...
(__libelf_compress_zlib): ... this.
(do_zstd_cleanup): New.
(zstd_cleanup): New.
(__libelf_compress_zstd): New.
(__libelf_decompress): Switch in between zlib and zstd.
(__libelf_decompress_zlib): Renamed from __libelf_decompress.
(__libelf_decompress_zstd): New.
(__libelf_decompress_elf): Dispatch in between compression
algorithms.
(elf_compress): Likewise.
* elf_compress_gnu.c (elf_compress_gnu): Call with
ELFCOMPRESS_ZLIB.
* libelfP.h (__libelf_compress): Add new argument.
(__libelf_decompress): Add chtype argument.
src/ChangeLog:
* elfcompress.c (enum ch_type): Add ZSTD.
(parse_opt): Parse "zstd".
(get_section_chtype): New.
(process_file): Support zstd compression.
(main): Add zstd to help.
* readelf.c (elf_ch_type_name): Rewrite with switch.
tests/ChangeLog:
* Makefile.am: Add ELFUTILS_ZSTD if zstd is enabled.
* run-compress-test.sh: Test zstd compression algorithm
for debug sections.
|
|
|
|
|
|
|
| |
A couple of files undefined _, which is defined in lib/eu-config.h as
gettext helper macro. This seems unnecessary and arbitrary.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is no regression in tests for an x86_64 build, while the new
hello_arc_hs4.ko is added as well. This is the only meaningful
test that I could add at the moment, given the features supported
by this port.
$ cat tests/test-suite.log
==========================================
elfutils 0.188: tests/test-suite.log
==========================================
# TOTAL: 236
# PASS: 235
# SKIP: 1
# XFAIL: 0
# FAIL: 0
# XPASS: 0
# ERROR: 0
.. contents:: :depth: 2
SKIP: run-lfs-symbols.sh
========================
LFS testing is irrelevant on this system
SKIP run-lfs-symbols.sh (exit status: 77)
$ cat tests/run-strip-reloc.sh.log
runtest hello_i386.ko
runtest hello_x86_64.ko
runtest hello_ppc64.ko
runtest hello_s390.ko
runtest hello_aarch64.ko
runtest hello_m68k.ko
runtest hello_riscv64.ko
runtest hello_csky.ko
runtest hello_arc_hs4.ko <-- [ new ARC HS4 test ]
runtest /home/shahab/pahole_pkg/elfutils-git/bld_arc/src/strip
runtest /home/shahab/pahole_pkg/elfutils-git/bld_arc/src/strip.o
runtest strip-uncompressed.o
runtest strip-compressed.o
runtest testfile-debug-rel-ppc64.o
runtest testfile-debug-rel-ppc64-z.o
runtest testfile-debug-rel-ppc64-g.o
PASS run-strip-reloc.sh (exit status: 0)
Signed-off-by: Shahab Vahedi <shahab@synopsys.email>
|
|
|
|
|
|
| |
The build used -ffunction-sections just for one file.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
| |
This block of code can not be removed. As it's contains a goto label
enomem that been used elsewhere.
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
|
|
|
|
|
|
|
|
| |
Older curl.h don't define CURL_AT_LEAST_VERSION, so define it
ourselves because it is nicer than doing hex encoded version
comparisons.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The `CURLINFO_SIZE_DOWNLOAD_T` and `CURLINFO_CONTENT_LENGTH_DOWNLOAD_T`
identifiers are `enum`s, not pre-processor definitions, so the current
`#ifdef` logic is not selecting the newer API. This results in the
older identifiers being used and they now generate errors when compiled
against Curl 7.87, which has silently deprecated them, causing GCC to
emit `-Werror=deprecated-declarations`.
Instead, the newer identifiers were added in Curl 7.55, so explicitly
check for `CURL_AT_LEAST_VERSION(7, 55, 0)` instead of the current
logic. This eliminates the error when compiling against Curl 7.87.
Ref: https://github.com/curl/curl/pull/1511
Signed-off-by: Andrew Paprocki <andrew@ishiboo.com>
|
|
|
|
|
|
|
|
|
| |
Rely on include dirs being set up correctly. Setup libdw AM_CPPFLAGS
to include libebl directory. In libdwfl note that debuginfod.h is a
generated file in the builddir. Only include it in the one file
debuginfod-client.c that really needs it.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
| |
This implements initial support for the LoongArch architecture.
Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since read_portion and the standard dwfl_elf_phdr_memory_callback
functions make sure to read at least minread bytes there is no need
for dwfl_segment_report_module to check and adjust the data to the
actual buffer size read. Reading beyond the end of the expected data
size (if the buffer read is much larger) actually causes issues when
passing the data to elfXX_xlatetom() because it is possible that
src->d_size is not a multiple of recsize (for ELF_T_DYN, recsize is 16
while the minimum required alignment is 8), causing elfXX_xlatetom()
to return ELF_E_INVALID_DATA.
Signed-off-by: Gavin Li <gavin@matician.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
| |
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
|
|
|
|
|
|
| |
This is enough and can be recognized by clang-cl on windows
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
|
|
|
|
|
|
| |
Adds various new ARC related declarations.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
src/ChangeLog:
* elfcompress.c (T_UNSET): Remove and use ch_type.
(T_DECOMPRESS): Likewise.
(T_COMPRESS_ZLIB): Likewise.
(T_COMPRESS_GNU): Likewise.
(enum ch_type): New.
(parse_opt): Parse to new ch_type.
(compress_section): Change gnu and compress arguments
to schtype (source compression) and dchtype (destination
compression).
(process_file): Use new enum type and adjusted compress_section.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes:
./src/elfcompress -t zlib-gnu a.out -force
[28] .zdebug_aranges unchanged, already GNU compressed[29] .zdebug_info unchanged, already GNU compressed[30] .zdebug_abbrev unchanged, already GNU compressed[31] .zdebug_line unchanged, already GNU compressed[32] .zdebug_str unchanged, already GNU compressed[33] .zdebug_line_str unchanged, already GNU compressed[34] .zdebug_rnglists unchanged, already GNU compressed
to:
./src/elfcompress -t zlib-gnu a.out -force
[28] .zdebug_aranges unchanged, already GNU compressed
[29] .zdebug_info unchanged, already GNU compressed
[30] .zdebug_abbrev unchanged, already GNU compressed
[31] .zdebug_line unchanged, already GNU compressed
[32] .zdebug_str unchanged, already GNU compressed
[33] .zdebug_line_str unchanged, already GNU compressed
[34] .zdebug_rnglists unchanged, already GNU compressed
src/ChangeLog:
* elfcompress.c (process_file): Add missing newline.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The option -s accepts in elfutils (compared to binutils) a positional
argument that is name of a symbol table section which should be printed.
Thus, print a reasonable warning if -sW is used:
./src/readelf -sW a.out
WARNING: cannot find section: 'W'
PR29719
src/ChangeLog:
* readelf.c (print_symtab): Change signature and return true if
something is printed.
(process_elf_file): Use it and print warning.
tests/ChangeLog:
* run-readelf-s.sh: Test -sW.
|
|
|
|
|
|
|
|
| |
On error going to out2, the response_data is freed. So initialize the
response_data to NULL immediately after allocation or when going back
to query_in_parallel.
Signed-off-by: Mark Wielaard <mark@klomp.org>
|