summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* config: Move the 2>/dev/null inside the sh -c '' quotes for profile.csh.Mark Wielaard2022-05-032-1/+5
| | | | | | | | | | | csh/tcsh would warn about "Ambiguous output redirect" if not done inside the sh -c command. Fix-by: наб <nabijaczleweli@nabijaczleweli.xyz> https://bugzilla.redhat.com/show_bug.cgi?id=2080957 Signed-off-by: Mark Wielaard <mark@klomp.org>
* configure: Don't use valgrind and sanitize-undefined for make distcheckMark Wielaard2022-05-032-1/+5
| | | | | | | | | | | | make distcheck would always run with --enable-valgrind and --enable-sanitize-undefined. Assuming the maintainer would run this just before doing a release. But this makes distcheck really, really, really slow. And we have various buildbots now that run various combinations of valgrind, undefined and/or address sanitizer over every commit now. This make make distcheck "fast" again. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Prepare for 0.187elfutils-0.187Mark Wielaard2022-04-2513-2839/+2823
| | | | | | | | | Set version to 0.187 Update NEWS and elfutils.spec.in Set copyright year in configure.ac and printversion. Regenerate po/*.po files. Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: ensure X-DEBUGINFOD-SIZE contains file sizeAaron Merey2022-04-252-1/+9
| | | | | | | | | | For archived files X-DEBUGINFOD-SIZE currently contains the size of the archive instead of the size of the uncompressed file. Fix this. Also add testcases to verify X-DEBUGINFOD-SIZE contains uncompressed file sizes. Signed-off-by: Aaron Merey <amerey@redhat.com>
* debuginfod: Use the debuginfod-size response headerAaron Merey2022-04-251-40/+43
| | | | | | | | | | | | | In some cases the content-length header may not be available in order to pass to a progressfn. If content-length isn't available then attempt to get the size of the download from the debuginfod-size header instead. It should be mentioned that if a compressed file (ex. gzip) is being transferred, the actual transfer length will be less than debuginfod-size. In this case debuginfod-size is a best-guess upper bound on the size of the transfer. Signed-off-by: Aaron Merey <amerey@redhat.com>
* debuginfod, libdwfl: Initialize libcurl and dlopen debuginfod-client lazilyMark Wielaard2022-04-255-20/+44
| | | | | | | | | | | | | We used to go out of our way to initialize libcurl early before any other thread/code was running. But this meant that we might pay startup cost, which under FIPS is significant, even for code that never uses libdebuginfod or TLS libcurl connections. Although curl_global_init itself isn't thread-safe we can use pthread_once to make sure we don't race against ourselves. This still means we might race against any application code that might use libcurl. But we can assume they will have called curl_global_init before calling dwfl_begin or debuginfod_begin. Signed-off-by: Mark Wielaard <mark@klomp.org>
* AUTHORS: Use generator script & git mailmapFrank Ch. Eigler2022-04-244-3/+145
| | | | | | We can compute a pretty complete list of contributors. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* libelf: Check for mremap, elf_update needs it for ELF_C_RDWR_MMAPMark Wielaard2022-04-244-1/+14
| | | | | | | | | | | Add a AC_CHECK_FUNCS configure check for mremap. Some systems like KFreeBSD and the Hurd don't have it. Also add a configure warning because without mremap elf_update will often fail when ELF_C_RDWR_MMAP is used. ELF_C_RDWR_MMAP is an elfutils extension to libelf. https://sourceware.org/bugzilla/show_bug.cgi?id=27337 Signed-off-by: Mark Wielaard <mark@klomp.org>
* elfclassify: Fix --no-stdin flagMark Wielaard2022-04-242-1/+5
| | | | | | | | | The no-stdin option was using the wrong flag, classify_flag_stdin, instead of classify_flag_no_stdin. https://sourceware.org/bugzilla/show_bug.cgi?id=28724 Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: Use MHD_USE_ITC in MHD_start_daemon flagsMark Wielaard2022-04-244-1/+14
| | | | | | | | | | | | | | | | | | | This prevents the "Server reached connection limit. Closing inbound connection." issue we have been seeing in the run-debuginfod-webapi-concurrency.sh testcase. From the manual: If the connection limit is reached, MHD’s behavior depends a bit on other options. If MHD_USE_ITC was given, MHD will stop accepting connections on the listen socket. This will cause the operating system to queue connections (up to the listen() limit) above the connection limit. Those connections will be held until MHD is done processing at least one of the active connections. If MHD_USE_ITC is not set, then MHD will continue to accept() and immediately close() these connections. https://sourceware.org/bugzilla/show_bug.cgi?id=28708 Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests: Lower parallel lookups in run-debuginfod-webapi-concurrency.shMark Wielaard2022-04-232-3/+8
| | | | | | | | | With 100 parallel lookups we sometimes see: Server reached connection limit. Closing inbound connection. Lower parallel lookups to 64 Signed-off-by: Mark Wielaard <mark@klomp.org>
* config: simplify profile.*sh.inнаб via Elfutils-devel2022-04-233-12/+14
| | | | | | | | | | 1. Simplify needless sh -c "cat glob 2>/dev/null" into cat glob 2>/dev/null under sh and fix re-expansion/-e protection under csh 2. Use $( instead of ` under sh 3. Assign to DEBUGINFOD_URLS directly and either export it or unset it Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
* readelf: Define dyn_mem outside the while loop.Mark Wielaard2022-04-192-1/+5
| | | | | | | The GCC address sanitizer might complain otherwise: stack-use-after-scope src/readelf.c:1787 in get_dyn_ents Signed-off-by: Mark Wielaard <mark@klomp.org>
* readelf: Don't consider padding DT_NULL as dynamic section entryDi Chen2022-04-196-15/+43
| | | | | | | | | | | when using `$ eu-readelf -d {FILE}` to get the number of dynamic section entris, it wrongly counts the padding DT_NULLs as dynamic section entries. However, DT_NULL Marks end of dynamic section. They should not be considered as dynamic section entries. https://sourceware.org/bugzilla/show_bug.cgi?id=28928 Signed-off-by: Di Chen <dichen@redhat.com>
* libdw: Remove unused atomics.h include from libdwP.hMark Wielaard2022-04-172-1/+4
| | | | Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests: Don't try to corrupt sqlite database during test.Mark Wielaard2022-04-142-8/+14
| | | | | | | | | | In run-debuginfod-federation-sqlite.sh we used to try to corrupt the sqlite database while the debuginfod server was running and check it detected errors, but that was unreliably and slightly dangerous since part of the database was already mapped into memory. Instead trigger some some random activity, then trigger a shutdown. Signed-off-by: Mark Wielaard <mark@klomp.org>
* PR29022: 000-permissions files cause problems for backupsAaron Merey2022-04-139-47/+90
| | | | | | | | | | | | | | 000-permission files currently used for negative caching can cause permission problems for some backup software and disk usage checkers. Fix this by using empty files for negative caching instead. Also use each empty file's mtime to determine the time since last download attempt instead of the cache_miss_s file's mtime. https://sourceware.org/bugzilla/show_bug.cgi?id=29022 Tested-by: Milian Wolff <mail@milianw.de> Signed-off-by: Aaron Merey <amerey@redhat.com>
* libdw: Add DWARF5 package file section identifiers, DW_SECT_*Mark Wielaard2022-04-132-0/+18
| | | | | | | | | This only adds the constants. There is no handling of DWARF package file (dwp) files for now. https://sourceware.org/bugzilla/show_bug.cgi?id=29048 Signed-off-by: Mark Wielaard <mark@klomp.org>
* config: Add versioned requires on libs/libelf for debuginfod-clientMark Wielaard2022-04-122-0/+8
| | | | | | | | | elfutils-debuginfod-client contains the debuginfod-client binary which is uses libelf and libdw. Add explicit versioned requires on elfutils-libs and elfutils-libelf so they will always be in sync like done with all other inter sub package dependencies. Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: Include "IPv4 IPv6" in server startup messageAaron Merey2022-04-061-1/+1
| | | | | | | | | | | | | | | At startup debuginfod prints a message indicating the port which the server is listening to. Prior to commit 4e4082be03 this message would include "IPv4" and/or "IPv6" [...] (48671/48671): started http server on IPv4 IPv6 port=8002 As of commit 4e4082be03 the IP versions have been removed from this message. This change can cause issues in any applications that parse the message for this information. Fix this by adding "IPv4 IPv6" back to the message. Signed-off-by: Aaron Merey <amerey@redhat.com>
* libelf: Return already gotten Elf_Data from elf_getdata_rawchunkMark Wielaard2022-04-053-0/+24
| | | | | | | | | | | | | | | | | | | | | | elf_getdata_rawchunk keeps a list of Elf_Data_Chunk to track which Elf_Data structures have already been requested. This allows elf_end to clean up all internal data structures and the Elf_Data d_buf if it was malloced. But it didn't check if a chunk was already requested earlier. This meant that if for example dwelf_elf_gnu_build_id was called multiple times to lookup a build-id from the phdrs a new Elf_Data_Chunk was created. This could slowly leak memory. So also keep track of the offset from which the size and type of the rawdata was requested so we can return existing data if it is requested multiple times. Note that the current cache is a simple linked list but the chain is normally not that long. It is normally used to get chunks from the phdrs, and there are normally less than 10. Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: use single ipv4+ipv6 microhttpd daemon configurationFrank Ch. Eigler2022-04-043-39/+53
| | | | | | | | | | Use a single MHD_USE_DUAL_STACK mhd daemon. This way, the thread connection pool is not doubled, saving memory and better matching user expectations. A slight tweak to logging is required to pull IPv4 remote addresses back out, and also to allow IPv6 ::-laden address forwarding through federation links. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* PR28708: debuginfod: use MHD_USE_EPOLL for microhttpd threadsFrank Ch. Eigler2022-04-032-0/+11
| | | | | | | | | Testing on s390x and other architectures indicates that this configuration reduces thundering-herd wakeups and saturation of a small number of threads. The run-debuginfod-webapi-concurrency.sh test appears solid now. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* libelf: Also copy/convert partial datastructures in xlate functionsMark Wielaard2022-03-302-2/+13
| | | | | | | | | | | The generated xlate functions can only convert full datastructures, dropping any trailing partial data on the floor. That means some of the data might be undefined. Just copy over the trailing bytes as is. That data isn't really usable. But at least it is defined data. https://sourceware.org/bugzilla/show_bug.cgi?id=29000 Signed-off-by: Mark Wielaard <mark@klomp.org>
* Introduce error_exit as a noreturn variant of error (EXIT_FAILURE, ...)Mark Wielaard2022-03-3014-288/+264
| | | | | | | | | | | | error (EXIT_FAILURE, ...) should be noreturn but on some systems it isn't. This may cause warnings about code that should not be reachable. So have an explicit error_exit wrapper that is noreturn (because it calls exit explicitly). Use error_exit in all tools under the src directory. https://bugzilla.redhat.com/show_bug.cgi?id=2068692 Signed-off-by: Mark Wielaard <mark@klomp.org>
* elflint: Recognize NT_FDO_PACKAGING_METADATAMark Wielaard2022-03-252-0/+11
| | | | Signed-off-by: Mark Wielaard <mark@klomp.org>
* libebl: recognize FDO Packaging Metadata ELF noteLuca Boccassi2022-03-243-0/+12
| | | | | | | | | | | | | As defined on: https://systemd.io/COREDUMP_PACKAGE_METADATA/ this note will be used starting from Fedora 36. Allow readelf --notes to pretty print it: Note section [ 3] '.note.package' of 76 bytes at offset 0x2e8: Owner Data size Type FDO 57 FDO_PACKAGING_METADATA Packaging Metadata: {"type":"deb","name":"fsverity-utils","version":"1.3-1"} Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
* libelf: Sync elf.h from glibc.Mark Wielaard2022-03-244-24/+94
| | | | | | | | | | | | | | Adds EM_INTELGT, NT_ARM_TAGGED_ADDR_CTRL, NT_ARM_PAC_ENABLED_KEYS, ELF_NOTE_FDO, NT_FDO_PACKAGING_METADATA and OpenRISC 1000 specific relocs. It also adds and renames some GNU_PROPERTY constants. But none of the constants the elfutils code uses was renamed or given a different constant value. dwelf_elf_e_machine_string was updated to handle EM_INTELGT. Signed-off-by: Mark Wielaard <mark@klomp.org>
* configure: Don't check whether -m64 works for 32bit host biarch checkMark Wielaard2022-03-244-3/+10
| | | | | | | | | | Running a 32bit backtrace test against a 64bit binary doesn't work. Only a 64bit binary can backtrace a 32bit binary. So disable the biarch check that inserts -m64 for a 32bit host. https://sourceware.org/bugzilla/show_bug.cgi?id=24158 Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests: Check addsections test binary is 64bit for run-large-elf-file.shMark Wielaard2022-03-242-0/+15
| | | | | | | | | The test binary should be 64bit to be able to create 4GB, or larger, ELF files. https://sourceware.org/bugzilla/show_bug.cgi?id=28975 Signed-off-by: Mark Wielaard <mark@klomp.org>
* libelf: Correct alignment of ELF_T_GNUHASH data for ELFCLASS64Mark Wielaard2022-03-232-6/+15
| | | | | | | | | | ELF_T_GNUHASH data is just 32bit words for ELFCLASS32. But for ELFCLASS64 it is a mix of 32bit and 64bit words. In the elf_cvt_gnuhash function we rely on the alignment of the whole to be 64bit word aligned, even though the first 4 words are 32bits. Otherwise we might try to convert an unaligned 64bit word. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libelf: Don't overflow offsets in elf_cvt_Verneed and elf_cvt_VerdefMark Wielaard2022-03-202-8/+55
| | | | | | | | The conversion functions for Verdef and Verneed keep offsets to the next structure. Make sure that following vd_aux, vda_next, vd_next, vn_aux, vna_next and vn_next don't overflow (and wrap around) the offsets. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdwfl: Use memcpy to assign image header field valuesMark Wielaard2022-03-182-6/+23
| | | | | | | | The values in the kernel image header aren't properly aligned. Use memcpy and the LE16, LE32 macros to assign and check the values. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdwfl: Close ar members when they cannot be processed.Mark Wielaard2022-03-182-2/+11
| | | | | | | | | | When reporting ar members they should be closed when they cannot be processed. A comment in offline.c said that process_file called elf_end if it returned NULL. But this is incorrect. And other places that call process_file do call elf_end explicitly when it returns NULL. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libelf: Check alignment of Verdef, Verdaux, Verneed and Vernaux offsetsMark Wielaard2022-03-182-4/+19
| | | | | | | | The Verdef, Verdaux, Verneed and Vernaux structures contain fields which point to the next structures. Make sure these offsets are correctly aligned for the structures they point to. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libelf: Make sure ar_size starts with a digit before calling atol.Mark Wielaard2022-03-182-0/+9
| | | | | | | | | The ar_size field is a 10 character string, not zero terminated, of decimal digits right padded with spaces. Make sure it actually starts with a digit before calling atol on it. We already make sure it is zero terminated. Otherwise atol might produce unexpected results. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libelf: Take map offset into account for Shdr alignment check in elf_beginMark Wielaard2022-03-182-3/+10
| | | | | | | | | The sh_num function tries to get at the zero section Shdr directly. When the file is mmapped it has to make sure the offset into the file to the start of the Elf structure is taken into account when trying to cast the address to make sure the alignment is correct. Signed-off-by: Mark Wielaard <mark@klomp.org>
* configure: Use AS_HELP_STRING instead of AC_HELP_STRING.Mark Wielaard2022-03-145-4/+13
| | | | | | | | In most places we already used AS_HELP_STRING. A few places used AC_HELP_STRING. Which has been deprecated for a long time. Use AS_HELP_STRING instead of AC_HELP_STRING everywhere. Signed-off-by: Mark Wielaard <mark@klomp.org>
* addr2line: Make --absolute the default, add --relative option.Mark Wielaard2022-03-144-3/+25
| | | | | | | | | | Make --absolute (including the compilation directory in file names) the default and add a new option --relative to get the previous default behavior. https://www.sourceware.org/bugzilla/show_bug.cgi?id=28951 Signed-off-by: Mark Wielaard <mark@klomp.org>
* configure: Test for _FORTIFY_SOURCE=3 support.Mark Wielaard2022-03-142-10/+33
| | | | | | | | | | | | | | | | | | | | | | _FORTIFY_SOURCE=3 adds extra glibc (dynamic) fortification checks when using GCC 12. This adds a configure check to see if -D_FORTIFY_SOURCE=3 can be used. If not, configure will fall back to -D_FORTIFY_SOURCE=2. On some older glibc versions (glibc 2.17) using -D_FORTIFY_SOURCE=3 provides the same fortification as _FORTIFY_SOURCE=2. On some newer glibc versions and older GCC (glibc 2.34 amd gcc 11) using -D_FORTIFY_SOURCE=3 produces a not supported warning (and we fall back to -D_FORTIFY_SOURCE=2). With newer glibc and newer GCC versions (glibc 2.35 and gcc 12) -D_FORTIFY_SOURCE=3 will use the newer dynamic fortification checks. This patch also makes sure that AC_PROG_CXX is used earlier so that CXXFLAGS is always setup correctly (even if we then don't use it). And it outputs both the CFLAGS and CXXFLAGS as used at the end. Signed-off-by: Mark Wielaard <mark@klomp.org>
* backends: Use PTRACE_GETREGSET for ppc_set_initial_registers_tidMark Wielaard2022-02-162-25/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code in ppc_initreg.c used PTRACE_PEEKUSER to fetch all registers one by one. Which is slightly inefficient. It did this because it wanted things to work on linux 2.6.18 which didn't support PTRACE_GETREGSET. PTRACE_GETREGSET was only officially since 2.6.34 (but backported to some earlier versions). It seems ok to require a linux kernel that supports PTRACE_GETREGSET now. This is much more efficient since it takes just one ptrace call instead of 44 calls to fetch each register individually. For some really old versions we need to include <linux/ptrace.h> to get PTRACE_GETREGSET defined. And on ppc64 there is no 32bit version of struct pt_regs available, so we define that ourselves and check how much data is returned to know whether this is a full pt_regs or one for a 32bit process. An alternative would be to use the raw iov_base bytes with 64bit or 32bit offset constants to get at the registers instead of using a struct with names. The code works for inspecting a 32bit process from a 64bit build, but not the other way around (the previous code also didn't). This could work if we also defined and used a 64bit pt_regs struct on ppc32. But it seems a use case that is not really used (it was hard enough finding ppc32 setups to test this on). Tested against ppc and ppc64 on linux 2.6.32 and glibc 2.12 and ppc and ppc64 on linux 3.10.0 with glibc 2.17. Signed-off-by: Mark Wielaard <mark@klomp.org>
* man debuginfod-client-config.7: Elaborate $DEBUGINFOD_URLSFrank Ch. Eigler2022-01-312-2/+6
| | | | | | | | | Add reference to /etc/profile.d and /etc/debuginfod/*.urls as possible source of default. (No need to autoconf @prefix@ it, these paths are customarily distro standard rather than elfutils configurables.) Drop warning about federation loops, due to protection via PR27917 (0.186). Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* libdwfl: Declare possible zero sized arrays only when non-zeroMark Wielaard2022-01-062-2/+7
| | | | | | | | | | The gcc undefined sanitizer complains when seeing a zero sized array declaration. Move the declaration to the point in the code where we know they aren't zero sized. https://sourceware.org/bugzilla/show_bug.cgi?id=28720 Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdwfl: Handle unaligned Dyns in dwfl_segment_report_moduleMark Wielaard2022-01-062-0/+17
| | | | | | | | | | | The xlate functions only handle correctly aligned buffers. But they do handle src == dest. So if the source buffer isn't aligned correctly just copy it first into the destination (which is already correctly aligned). https://sourceware.org/bugzilla/show_bug.cgi?id=28720 Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdwfl: Fix overflow check in link_map.c read_addrsMark Wielaard2022-01-062-1/+6
| | | | | | | | | The buffer_available overflow check wasn't complete. Also check nb isn't too big. https://sourceware.org/bugzilla/show_bug.cgi?id=28720 Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdwfl: Calculate addr to read by hand in link_map.c read_addrs.Mark Wielaard2022-01-042-6/+9
| | | | | | | | | | The gcc undefined sanitizer doesn't like the trick we use to calculate the (possibly) unaligned addresses to read. So calculate them by hand as unsigned char pointers. https://sourceware.org/bugzilla/show_bug.cgi?id=28720 Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdwfl: Call xlatetom on aligned buffers in dwfl_link_map_reportMark Wielaard2022-01-042-1/+23
| | | | | | | | | | Make sure that when calling xlatetom for Phdrs and Dyns in dwfl_link_map_report the input buffer is correctly aligned by calling memcpy and setting in.d_buf to out.d_buf. https://sourceware.org/bugzilla/show_bug.cgi?id=28720 Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdwfl: Make sure dwfl_elf_phdr_memory_callback returns at least minreadMark Wielaard2022-01-042-1/+10
| | | | | | | | | | | The callers of dwfl_elf_phdr_memory_callback assume at least minread bytes are read and available. Make sure to check start is smaller than elf->maximum_size before reading more. Return false if end - start is smaller than minread. Found by afl-fuzz. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdwfl: Always clean up build_id.memoryMark Wielaard2021-12-212-14/+18
| | | | | | | | | | | There was a small memory leak if an error was detected in some places in dwfl_segment_report_module after the build_id.memory was alredy allocated. Fix this by moving initialization of struct elf_build_id early and always free the memory, if not NULL, at exit. https://sourceware.org/bugzilla/show_bug.cgi?id=28685 Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdwfl: Handle unaligned Nhdr in dwfl_segment_report_moduleMark Wielaard2021-12-202-0/+17
| | | | | | | | | | | The xlate functions only handle correctly aligned buffers. But they do handle src == dest. So if the source buffer isn't aligned correctly just copy it first into the destination (which is already correctly aligned). https://sourceware.org/bugzilla/show_bug.cgi?id=28715 Signed-off-by: Mark Wielaard <mark@klomp.org>