Frank Ch. Eigler [Thu, 26 Nov 2020 00:41:03 +0000 (19:41 -0500)]
debuginfod: use clock_gettime(CLOCK_MONOTONIC) for intervals
On Mark's request, use a monotonic clock for metrics/reports related
to time interval measurement. gettimeofday can jump a bit, which
could distort metrics. Tests unaffected.
Frank Ch. Eigler [Tue, 24 Nov 2020 00:58:10 +0000 (19:58 -0500)]
debuginfod: sqlite3 metrics
Add metrics for tracking sqlite3 error counts and query performance.
The former looks like a new sibling of the "error_count" family, and
is tested by dd-corrupting a live database file then triggering some
debuginfod activity.
error_count{sqlite3="file is not a database"} 1
The latter looks like _count/_sum pairs for each type of sqlite
prepared-statement used in the code, and is grep smoke-tested. They
should assist a sysadmin in tuning db storage. This example shows a
6.4 ms/operation cost:
Mark Wielaard [Tue, 10 Nov 2020 23:23:08 +0000 (00:23 +0100)]
debuginfod-client: Add debuginfod_set_verbose_fd and DEBUGINFOD_VERBOSE
Introduce a new function debuginfod_set_verbose_fd which will produce
verbose output on a given file descriptor (STDERR_FILENO if the
environment variable DEBUGINFOD_VERBOSE is set) showing how the search
for a particular client query is going.
Example output:
debuginfod_find_debuginfo 1234567890
server urls "https://debuginfod.elfutils.org/ http://dbgd.usersys.com:3632/"
checking build-id
checking cache dir /home/mark/.cache/debuginfod_client
using timeout 90
init server 0 https://debuginfod.elfutils.org/
url 0 https://debuginfod.elfutils.org/buildid/1234567890/debuginfo
init server 1 http://dbgd.usersys.com:3632/
url 1 http://dbgd.usersys.com:3632/buildid/1234567890/debuginfo
query 2 urls in parallel
server response HTTP response code said error
url 0 The requested URL returned error: 404 Not Found
server response HTTP response code said error
url 1 The requested URL returned error: 404 Not Found
not found No such file or directory (err=-2)
Frank Ch. Eigler [Thu, 19 Nov 2020 18:16:10 +0000 (13:16 -0500)]
debuginfod: add thread-busy metrics to webapi service
Improve monitoring of debuginfod instances by tracking thread_busy
status for the threads responding to http requests. While these are
usually short-lived, longer archive-uncompress operations can take
long enough time to show up on top/uptime. This should also assist
noticing abusive clients and guide scaling of the service.
Mark Wielaard [Wed, 11 Nov 2020 20:28:07 +0000 (21:28 +0100)]
debuginfod-find: Be a bit less verbose with -v
debuginfod-find -v enables a progressfn that prints the Progress every
time the callback is called. For slow transfers or big downloads this
can be really verbose (hundreds a times a second). Slow it down a bit,
so it only prints the progress at most 5 times a second.
Mark Wielaard [Fri, 6 Nov 2020 17:16:24 +0000 (18:16 +0100)]
libelf: Update SH_ENTSIZE_HASH comment.
The elf-knowledge.h contains various macros to deal with specific ELF
knowledge needed to interpret some ELF constructs that can be ambigious
depending on architecture ABI. Update the comment of SH_ENTSIZE_HASH
to add a more technical description of why it is needed.
Dmitry V. Levin [Wed, 4 Nov 2020 08:00:00 +0000 (08:00 +0000)]
config: do not define DEBUGINFOD_URLS environment variable unnecessarily
Before this change, when elfutils was configured without
--enable-debuginfod-urls, the installed profile.d/debuginfod.sh and
profile.d/debuginfod.csh scripts used to define the DEBUGINFOD_URLS
environment variable as an non-empty string containing spaces, making
all libdebuginfod users do extra work.
Change these scripts to avoid defining the DEBUGINFOD_URLS environment
variable unless configured using --enable-debuginfod-urls.
Dmitry V. Levin [Mon, 2 Nov 2020 08:00:00 +0000 (08:00 +0000)]
config: Conditionalize on LIBDEBUGINFOD instead of DEBUGINFOD
When elfutils is configured using --enable-libdebuginfod
--disable-debuginfod, that is, when the library is built and installed
but the server is not, it makes sense to install libdebuginfod.pc
because the latter complements the library rather than the server.
Likewise, it makes sense to install profile.d/debuginfod.*sh files
along with libdebuginfod because the library can use DEBUGINFOD_URLS
environment variable as well as the server.
This change does not affect --enable-debuginfod mode as the latter
requires --enable-libdebuginfod.
Fixes: fed3c3ceeaa6 ("Do not install libdebuginfod.pc unless debuginfod is enabled") Fixes: b503c358dde8 ("Do not install profile.d/debuginfod.*sh files unless debuginfod is enabled") Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Mark Wielaard [Sun, 1 Nov 2020 17:52:15 +0000 (18:52 +0100)]
libelf: Check header exists in elf_strptr
We already checked the header actually existed for ELFCLASS64 but not
for the ELFCLASS32 case. It is very unlikely it is at this point in the
code, but theoretically it could happen.
Mark Wielaard [Sun, 1 Nov 2020 17:51:02 +0000 (18:51 +0100)]
libelf: Set dst to zero on failure in __elf_getphdrnum_rdlock
GCC with -flto finds some (very) unlikely error paths. It flags callers
of __elf_getphdrnum_chk_rdlock with *dst not yet set because an internal
call to __elf_getphdrnum_rdlock might not initialize *dst either in one
particular failure path. The sanity check that __elf_getphdrnum_chk_rdlock
then performs might happen against uninitialized data. So just set *dst
to zero on failure in __elf_getphdrnum_rdlock so any caller can simply
check either the result/error code or whether *dst is zero or not.
Mark Wielaard [Sun, 1 Nov 2020 17:50:04 +0000 (18:50 +0100)]
libelf: Use GElf_Ehdr instead of Elf handle in __libelf_data_type
GCC with -flto detects some (very) unlikely issues in error paths.
In theory getting the Ehdr from an Elf handle might fail. But in
most cases where __libelf_data_type is used, we already have the
Ehdr anyway. So simply pass that to __libelf_data_type. In the one
place where we don't have it yet, get it and check for failure
before calling __libelf_data_type.
Mark Wielaard [Mon, 2 Nov 2020 14:20:54 +0000 (15:20 +0100)]
tests: Create bogus R/nothing.rpm with cyclic symlink.
We used to try to trigger an error during debuginfod scanning using
a chmod 000 file. But this doesn't always result in an error. Create
a cyclic symlink instead, which always results in a failure to open/read.
Érico Rolim [Mon, 2 Nov 2020 01:49:46 +0000 (22:49 -0300)]
Switch from numerical to defined constants for permissions.
Use defined constants for permission values. Also add fallback
definitions for them in system.h, to allow for compatibility with
systems that don't provide these macros.
Include system.h in all tests/ files that required it.
Signed-off-by: Érico Rolim <erico.erc@gmail.com> Signed-off-by: Mark Wielaard <mark@klomp.org>
Érico Rolim [Mon, 2 Nov 2020 00:48:50 +0000 (21:48 -0300)]
Support building when fts and obstack aren't part of libc.
- Make configure.ac test for fts and obstack availability;
- Add fts and obstack ldflags to all files that need them;
- Add missing argp ldflags to programs in debuginfod/.
Added new metrics for scanning that allow estimation of its reading
bandwidth. Accelerated responsivity to SIGINT shutdown during
archive-scanning phase, which previously insisted on completely
processing the current archive. Noted in systemd service file that in
the worst case, it might still take a long time. Accelerated
traversals by moving regex -I/-X handling to apply to file names only
(as always documented), so directory traversal metrics are accurate
regardless of their name.
Mark Wielaard [Sat, 31 Oct 2020 12:43:42 +0000 (13:43 +0100)]
tests: Add dlopen override to dwfl-proc-attach for old glibc/valgrind.
Some combination of old glibc and valgrind create unsuppressable memory
leak warnings when the process is run under valgrind, is multi-threaded
and uses dlopen. libdw will try to dlopen libdebuginfod be default.
So simply override dlopen and always return NULL to make sure
libdebuginfod is never loaded. The dwfl-proc-attach test doesn't rely
on libdebuginfod anyway.
This was seen on the armbian buildbot which uses valgrind 3.14.0 and
glibc 2.28.
Mark Wielaard [Sat, 31 Oct 2020 10:19:23 +0000 (11:19 +0100)]
tests: Remove bashism from test-wrapper.sh /bin/sh script.
Debian uses dash as /bin/sh which is pretty strict about syntax. It
didn't like the == in the test for strings in the test-wrapper.sh.
Replace by single =.
Mark Wielaard [Thu, 29 Oct 2020 15:43:14 +0000 (16:43 +0100)]
tests: Run valgrind also on binary tests.
When configuring with --enable-valgrind we were only running valgrind
on tests with a shell wrapper script. This patch makes sure to also run
valgrind on "pure" binary tests. This found one small issue in libasm
where we could be writing some uninitialized padding to an ELF file.
And there were a couple tests that didn't clean up all the resources
they used. Both issues are also fixed with this patch.
During a test upgrade of an RPM based on this spec file, it was
observed that, er, the /var/cache/.../debuginfod.sqlite file was
zeroed. Whoops! We don't want to lose this data. Removed the
%verify attributes and added %ghost for the sqlite database.
Frank Ch. Eigler [Fri, 30 Oct 2020 22:26:04 +0000 (18:26 -0400)]
PR26775: restore thread_work_groom metric to cycle count
... and add new metrics about progress of traversal and groom
processes. Correct one control flow abnormality that could
prematurely end a scanner thread and might have accounted for
the inconsistent test results from the previous patch.
Frank Ch. Eigler [Thu, 29 Oct 2020 18:25:18 +0000 (14:25 -0400)]
PR26775: make grooming progress visible & interruptible
On very large servers, it's desirable to be able to interrupt a rescan
or groom cycle. SIGUSR[12] now do that. (Unfortunately, this is not
practically testable in the testsuite, since these cycles are so fast
on that small dataset.) We also expose more internal progress count
about the grooming pass, so the administrator can assess possible need
to interrupt.
Frank Ch. Eigler [Thu, 29 Oct 2020 16:20:51 +0000 (12:20 -0400)]
PR26810: debuginfod should tolerate some absence/renaming sans grooming
debuginfod now knows to handle a case where a buildid search is
satisfiable from more than one source (e.g., archive location), but
some of them are invalid. New exception catching beneath the sqlite
scanning loop ensures all possible matches are scanned in case of
errors.
Mark Wielaard [Sun, 25 Oct 2020 19:40:33 +0000 (20:40 +0100)]
tests: Add read_unaligned testcase
Run tests/read_unaligned 1 on a big endian and little endian machine
to generate the le_mem and be_mem arrays. The one byte variants are
kind of impossible to get wrong, but including them makes sure the
other variants are not naturally aligned in memory.
Tom Tromey [Wed, 28 Oct 2020 23:26:42 +0000 (17:26 -0600)]
Fix leb128 reading
PR 26773 points out that some sleb128 values are decoded incorrectly.
This version of the fix only examines the sleb128 conversion.
Overlong encodings are not handled, and the uleb128 decoders are not
touched. The approach taken here is to do the work in an unsigned
type, and then rely on an implementation-defined cast to convert to
signed.
Érico Rolim [Tue, 27 Oct 2020 19:19:58 +0000 (16:19 -0300)]
unstrip: Stop using strndupa.
This functon has inherent safety issues, since a long enough path can
lead to memory clobbering. Due to the recursive nature of
make_directories(), multiple calls could also stack overflow. Instead,
the string can be allocated in the heap.
As a bonus, this improves musl compatibility, since musl doesn't include
the strndupa macro for now.
Mark Wielaard [Mon, 19 Oct 2020 08:17:59 +0000 (10:17 +0200)]
libdw: dwarf_frame_register takes an array of at least 3 Dwarf_Ops
GCC11 will warn about a mismatch in the declaration of dwarf_frame_register:
dwarf_frame_register.c:37:61: error: argument 3 of type ‘Dwarf_Op *’
declared as a pointer [-Werror=array-parameter=]
37 | dwarf_frame_register (Dwarf_Frame *fs, int regno, Dwarf_Op *ops_mem,
| ~~~~~~~~~~^~~~~~~
libdw.h:1068:43: note: previously declared as an array ‘Dwarf_Op[3]’
1068 | Dwarf_Op ops_mem[3],
| ~~~~~~~~~^~~~~~~~~~
When fixing that it will show an actual bug in the addrcfi testcase:
addrcfi.c:98:16: error: ‘dwarf_frame_register’ accessing 96 bytes in a
region of size 64 [-Werror=stringop-overflow=]
98 | int result = dwarf_frame_register (stuff->frame, regno, ops_mem, &ops, &nops);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
addrcfi.c:98:16: note: referencing argument 3 of type ‘Dwarf_Op *’
1069 | extern int dwarf_frame_register (Dwarf_Frame *frame, int regno,
| ^~~~~~~~~~~~~~~~~~~~
Fix the declaration, fix the bug and add an extra comment to the description
in libdw.h.
Mark Wielaard [Sat, 17 Oct 2020 20:30:37 +0000 (22:30 +0200)]
backends: Remove tilegx backend.
Support for the Tilera TILE-Gx processor has been removed or deprecated
in gcc and binutils already. There are no users and there is no way to
test it.
Mark Wielaard [Sat, 17 Oct 2020 19:22:22 +0000 (21:22 +0200)]
libebl: Remove unused ebl_syscall_abi.
GCC11 -Warray-parameter warned about ebl_syscall_abi being inconsistently
declared (once with a pointer to int, once with an array of 6 int elements).
Since ebl_syscall_abi isn't actually used and was only implemented for
3 backends without any tests just remove it.
Frank Ch. Eigler [Wed, 21 Oct 2020 00:24:43 +0000 (20:24 -0400)]
PR26756: add more prometheus metrics to debuginfod
Add an error_count{} family of metrics for each libc/libarchive/http
exception instance created during operation. Add a family of fdcache*
metrics for tracking fdcache operations and status. Test via a
injecting a permission-000 empty nothing.rpm in the testsuite.
Frank Ch. Eigler [Tue, 20 Oct 2020 23:26:04 +0000 (19:26 -0400)]
debuginfod: suppress fdcache prefetching during dwz lookup
During a recent from-scratch reindexing of the rpm/deb corpus at
debuginfod.elfutils.org, we found the fdcache chewed up an abnormal
amount of $TMPDIR space. This was due to internal .dwz lookups, which
triggered fdcache prefetching as for a webapi query, but there was not
a timely fdcache eviction pass to clean it up again. Rather than add
that pass, it's better to suppress the prefetching completely, as an
internal .dwz search will only ever need that file, not any others
from the same archive.
PR25461: add /etc/profile.d files for default $DEBUGINFOD_URLS
To give distros a simple knob to let their userbase enjoy debuginfod
services, we add a --enable-debuginfod-urls[=URLS] to the configury.
This propagates to $DEBUGINFOD_URLS environment variable settings
in /etc/profile.d/debuginfod.{sh,csh} files.
The default is nothing. If simply enabled, the current prototype
public server is used. If enabled with parameters, the builder/distro
can specify a default URL search path of their own.
Mark Wielaard [Sun, 27 Sep 2020 19:07:12 +0000 (21:07 +0200)]
readelf: Support showing view pairs in loclists as GNU extension.
View pairs are encoded in .debug_loclists as they are encoded in
.debug_locs sections by the GCC compiler. Scan for DW_AT_GNU_locviews
attributes that point to the view pairs just in front of the actual
location lists.
Mark Wielaard [Fri, 18 Sep 2020 10:49:29 +0000 (12:49 +0200)]
libdwfl: Add ZSTD support.
Newer kernels might be compressed using ZSTD add support to libdwfl open
so we can can automatically read ZSTD compressed files and kernel images.
The support is very similar to the bzip2 and lzma support, but slightly
different. With a bit more macros it could maybe have used the gzip.c
USE_INFLATE code path. But I felt that the many macros didn't really help
understand the code. So the unzip routine has a slightly different code
path for ZSTD.
debuginfod: store only canonicalized sref pathnames in database
Since PR25548, we let debuginfod answer /buildid/HEX/source/PATH
queries with both canonicalized and raw PATHs. It canonicalizes
incoming paths, but still stored the raw paths in the database too.
This near-dupe storage is not needed, since the queries would always
find the canonicalized version too, so stop doing that. This saves
database space/time.
Mark Wielaard [Tue, 8 Sep 2020 12:12:28 +0000 (14:12 +0200)]
debuginfod: Fix BUILD_STATIC build.
The BUILD_STATIC build, as used by the coverage setup, was broken for
debuginfod because the DUMMY_LIBDEBUGINFOD case was mixed up. It should
include libcurl_LIBS when NOT doing a dummy build.
DW_CFA_AARCH64_negate_ra_state is used on aarch64 to indicate whether
or not the return address is mangled or not. This has the same value
as the DW_CFA_GNU_window_save. So we have to pass around the e_machine
value of the process or core we are inspecting to know which one to
use.
Note that it isn't actually implemented yet. It needs ARMv8.3 hardware.
If we don't have such hardware it is enough to simply ignore the
DW_CFA_AARCH64_negate_ra_state (and not confuse it with
DW_CFA_GNU_window_save) to get backtraces to work on aarch64.
Add a testcase for eu-readelf --debug-dump=frames to show the value
is correctly recognized. Also don't warn we cannot find any DWARF
if we are just dumping frames (those will come from .eh_frame if
there is no .debug_frame).
Mark Wielaard [Thu, 3 Sep 2020 13:42:32 +0000 (09:42 -0400)]
libebl: Handle aarch64 bti, pac bits in gnu property note
When building with gcc -mbranch-protection= we might get a gnu property
note indicating BTI (Branch Target Identification) and/or PAC (Pointer
Authentication Code) is being used.
Add a small testcase to show eu-readelf -n now properly lists those
bits in the gnu property note.
Mark Wielaard [Tue, 1 Sep 2020 21:32:09 +0000 (23:32 +0200)]
readelf: base address entry can be first
In both debug_ranges and debug_loc a base address entry can be the
first in the range or loc list. If so print the offset and set first
to false. Otherwise don't print the entry list offset, but do set
first to false.
Mark Wielaard [Wed, 26 Aug 2020 12:27:46 +0000 (14:27 +0200)]
readelf: It is not an error if there are no line number statements
It can happen that there are no line number statements at the end of
a debug line section. So don't check that there are any more bytes
after the last file entry. And print "No line number statements."
Mark Wielaard [Wed, 19 Aug 2020 21:41:24 +0000 (23:41 +0200)]
libelf: Fixup SHF_COMPRESSED sh_addralign in elf_update if necessary.
In elf_getdata.c we have the following to compensate for possibly
bad sh_addralign values of compressed sections:
/* Compressed data has a header, but then compressed data.
Make sure to set the alignment of the header explicitly,
don't trust the file alignment for the section, it is
often wrong. */
if ((flags & SHF_COMPRESSED) != 0)
{
entsize = 1;
align = __libelf_type_align (elf->class, ELF_T_CHDR);
}
Which makes sure the d_data alignment is correct for the Chdr struct
at the start of the compressed section.
But this means that if a user just reads such a compressed section
without changing it, and then tries to write it out again using
elf_update they get an error message about d_align and sh_addralign
being out of sync.
We already correct obviously incorrect sh_entsize fields.
Do the same for the sh_addralign field of a SHF_COMPRESSED section.
Mark Wielaard [Sun, 19 Jul 2020 19:51:16 +0000 (21:51 +0200)]
Only typedef Ebl once.
Since commit 287a18452 libasm.h defines an opague Ebl handle.
This is fine, except for (internal) code that also includes libebl.h.
Since C11 having multiple typedefs for the same thing is fine, but we
do build using GNU/C99. This also allows multiple same typedefs, except
for (very) old GCCs.
This only affects internal code, since libebl.h isn't a public header.
For internal code, only add the typedef in libebl.h when libasm.h
hasn't been included. Make sure all code that includes both headers
includes libasm.h first.
Mark Wielaard [Sat, 4 Jul 2020 22:13:35 +0000 (00:13 +0200)]
libasm: Make libasm.h include work without relying on any other include.
The public headers should be usable when includes as is.
libasm.h wasn't because it was using gelf.h data structures without
include gelf.h. Include it now in libasm.h.
Add a new testcase run-test-includes.sh to test all public headers
can be included "standalone".
Alice Zhang [Fri, 3 Jul 2020 17:37:34 +0000 (13:37 -0400)]
debuginfod: DEBUGINFOD_URLS should accept scheme-free urls
Check scheme instead of effective url so that user may abbreviate
DEBUGINFOD_URL. Add one test for scheme free http url.
Notice that libcurl does not provide an almighty scheme free url
support, /path/to/something without FILE:// can not be recognized
in most circumstances, therefore for the neatness of our code
structure, DEBUGINFOD_ URL of scheme "FILE" must be input as URI.
Mark Wielaard [Fri, 19 Jun 2020 17:41:08 +0000 (19:41 +0200)]
debuginfod: Add --disable-libdebuginfod and --enable-libdebuginfod=dummy.
Make it possible to build just the debuginfod client or to create a
dummy libdebuginfod that doesn't link against libcurl. The dummy library
can be used for bootstrapping. For testing purposes you can also build
debuginfod against the dummy libdebuginfod but then the debuginfod
server will not be able to do delegation.
PR26195: adapt debuginfod to API change in libmicrohttpd-0.9.71
To make our code build with -Werror as well as against older libmicrohttpd,
we must conditionalize the data type (int vs. enum) returned by callbacks
and some mhd functions.
Mark Wielaard [Sun, 28 Jun 2020 13:27:25 +0000 (15:27 +0200)]
libdwfl: read_address should use increasing address in intuit_kernel_bounds
In kernels from 4.14 up to 4.19 in /proc/kallsyms there are special
__entry_SYSCALL_64_trampoline symbols. The problem is that they come
after the last kernel address, but before the module addresses.
And they are (much) smaller than the start address we found. This
confuses intuit_kernel_bounds and makes it fail.
Make sure to check read_address returns an increasing address when
searching for the end.
Mark Wielaard [Tue, 16 Jun 2020 22:08:23 +0000 (00:08 +0200)]
debuginfod: Make sure handle_data can be allocated and is always freed.
When allocating handle_data we should check for out of memory failures.
Also when the allocation has succeeded make sure we always clean up by
going to out1 on any future errors. So move the curl_multi_init call
earlier, because that goes to out0 on failure.
When is debuginfod_query_server is given an hexadecimal string as
build-id build_id_len will be zero. We were checking the size of
the build_id_bytes destination string instead of the string length
of build_id input string. Make sure the input string is not too
big or strcpy might overwrite then end of the build_id_bytes array.
Mark Wielaard [Tue, 16 Jun 2020 21:56:45 +0000 (23:56 +0200)]
debuginfod: Make sure suffix can place zero terminator when copying filename
We need to make sure that we can always place a zero terminator at
the end of suffix when we are copying the filename. So add one more
char to the suffix array. And make sure that we can always add an
extra escape character when we need to escape the current character.
Mark Wielaard [Tue, 16 Jun 2020 21:53:03 +0000 (23:53 +0200)]
debuginfod: Handle not being able to fopen interval_path.
Although we check for and/or create the interval_path right before,
there is still a possibility that the fopen call fails. Handle that
as if the file is unreadable.
Mark Wielaard [Tue, 16 Jun 2020 21:22:56 +0000 (23:22 +0200)]
ar, ranlib: Call fchown before fchmod, explicitly check and ignore errors.
In ar and ranlib we don't mind if the fchown call fails (it normally
would, then the file simply gets own by the current user). We used to
call fchown before fchmod, but that might ignore (or reset) some mode
flags, so call fchown first, then try fchmod (like we already do in
elfcompress). Also explicitly test and then ignore any errors for
chown. We used to do some asm trick, but that confuses some static
analyzers (and it is somewhat unreadable). Also split out the giant
if statements to make them a little bit more understandable.
Mark Wielaard [Tue, 16 Jun 2020 16:19:45 +0000 (18:19 +0200)]
libdwfl: When we find a compressed image, use that, don't search for others
We try to find a compressed vmlinux image ending with either .gz, bz2 or
xz. Stop searching if we find one. Otherwise we will leak a file descriptor
for an earlier one we opened.
Mark Wielaard [Tue, 16 Jun 2020 16:14:37 +0000 (18:14 +0200)]
elflint: Explicitly check and ignore elf_compress error.
We just want to make sure that any section data is decompressed before
use, if the section was already decompressed that is fine, so just ignore
any errors. The make this more clear, explicitly check for errors, then
don't do anything. This is better than silently ignoring since everywhere
else in the code we do explicitly check for errors.
Mark Wielaard [Tue, 16 Jun 2020 15:53:08 +0000 (17:53 +0200)]
backends: Make the reloc_nametable zero element an one char array.
We are using the reloc_nametable zero element as an char array.
So make that element an actual array (we are actually after one
of the next string arrays in the table).
Mark Wielaard [Wed, 10 Jun 2020 18:55:58 +0000 (20:55 +0200)]
libebl: Remove Ebl struct size check and MODVERSION string.
We used to do several sanity checks when the ebl backend libraries
were loaded to make sure there was no version mismatch. When initializing
the backend we passed the current Ebl struct size so the library could
check it supported the given Ebl struct and we checked that the init
method returned the correct build time module version string. Neither
are necessary now that the backends are builtin.
Remove both the struct size check and the MODVERSION string (which
wasn't actually checked anymore). Make the init function return the
given Ebl handle or NULL on error (no init function currently indicates
any error).
Mark Wielaard [Sun, 7 Jun 2020 14:13:13 +0000 (16:13 +0200)]
nm: Handle corrupt symbol name table.
We try to sort symbol by name (when neither -n nor -p are given).
This could crash if the symbol name table was corrupt. Use elf_strptr
to get the symbol name and use the empty string in case a name couldn't
be found.