From 2ae705e60959633fe69ab8a8459446f9e9a82e8b Mon Sep 17 00:00:00 2001 From: eabdullin Date: Tue, 11 Mar 2025 07:11:34 +0000 Subject: [PATCH] import CS elfutils-0.192-5.el9 --- .elfutils.metadata | 2 +- .gitignore | 2 +- ...tils-0.192-fix-configure-conditional.patch | 26 +++++++ SOURCES/elfutils-0.192-libelf-static.patch | 36 +++++++++ SOURCES/elfutils-0.192-skip-ima-test.patch | 48 ++++++++++++ SOURCES/elfutils-0.192-stacktrace-lto.patch | 35 +++++++++ SPECS/elfutils.spec | 78 +++++++++++++++++-- 7 files changed, 220 insertions(+), 7 deletions(-) create mode 100644 SOURCES/elfutils-0.192-fix-configure-conditional.patch create mode 100644 SOURCES/elfutils-0.192-libelf-static.patch create mode 100644 SOURCES/elfutils-0.192-skip-ima-test.patch create mode 100644 SOURCES/elfutils-0.192-stacktrace-lto.patch diff --git a/.elfutils.metadata b/.elfutils.metadata index 665b9dc..4e8e79e 100644 --- a/.elfutils.metadata +++ b/.elfutils.metadata @@ -1 +1 @@ -651aa2b7390aeba178be2ceefd4c2eb42e783e97 SOURCES/elfutils-0.191.tar.bz2 +2dbae5652dcf5927213df0058969a62070dfa56e SOURCES/elfutils-0.192.tar.bz2 diff --git a/.gitignore b/.gitignore index e342b55..ecebecd 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/elfutils-0.191.tar.bz2 +SOURCES/elfutils-0.192.tar.bz2 diff --git a/SOURCES/elfutils-0.192-fix-configure-conditional.patch b/SOURCES/elfutils-0.192-fix-configure-conditional.patch new file mode 100644 index 0000000..dda720e --- /dev/null +++ b/SOURCES/elfutils-0.192-fix-configure-conditional.patch @@ -0,0 +1,26 @@ +From fb4753feb0ed7e3387f52b54bb02c6c74aac6a3e Mon Sep 17 00:00:00 2001 +From: Aaron Merey +Date: Tue, 29 Oct 2024 14:54:10 -0400 +Subject: [PATCH] Fix ENABLE_DEBUGINFOD_IMA_VERIFICATION always +evaluating to false + +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index f191488..3d2d3ee 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -892,7 +892,7 @@ AS_IF([test "x$enable_debuginfod" != "xno"],AC_DEFINE([ENABLE_DEBUGINFOD],[1],[B + AM_CONDITIONAL([DEBUGINFOD],[test "x$enable_debuginfod" = "xyes"]) + AS_IF([test "x$enable_debuginfod_ima_verification" = "xyes"],AC_DEFINE([ENABLE_IMA_VERIFICATION],[1],[Build IMA verification])) + AS_IF([test "x$have_libarchive" = "xyes"],AC_DEFINE([HAVE_LIBARCHIVE],[1],[Define to 1 if libarchive is available])) +-AM_CONDITIONAL([ENABLE_IMA_VERIFICATION],[test "$enable_debuginfod_ima_verification" = "xyes"]) ++AM_CONDITIONAL([ENABLE_IMA_VERIFICATION],[test "x$enable_debuginfod_ima_verification" = "xyes"]) + AM_CONDITIONAL([OLD_LIBMICROHTTPD],[test "x$old_libmicrohttpd" = "xyes"]) + + dnl for /etc/profile.d/elfutils.{csh,sh} +-- +2.47.0 + diff --git a/SOURCES/elfutils-0.192-libelf-static.patch b/SOURCES/elfutils-0.192-libelf-static.patch new file mode 100644 index 0000000..799cfb4 --- /dev/null +++ b/SOURCES/elfutils-0.192-libelf-static.patch @@ -0,0 +1,36 @@ +From 0a65a54593ae489d40cb993caa74095d45bc47fd Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Tue, 22 Oct 2024 15:03:42 +0200 +Subject: [PATCH] libelf: Add libeu objects to libelf.a static archive + +libelf might use some symbols from libeu.a, specifically the eu-search +wrappers. But we don't ship libeu.a separately. So include the libeu +objects in the libelf.a archive to facilitate static linking. + + * libelf/Makefile.am (libeu_objects): New variable. + (libelf_a_LIBADD): New, add libeu_objects. + +https://sourceware.org/bugzilla/show_bug.cgi?id=32293 + +Signed-off-by: Mark Wielaard +--- + libelf/Makefile.am | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/libelf/Makefile.am b/libelf/Makefile.am +index 3402863e..2d3dbdf2 100644 +--- a/libelf/Makefile.am ++++ b/libelf/Makefile.am +@@ -122,6 +122,9 @@ libelf.so: $(srcdir)/libelf.map $(libelf_so_LIBS) $(libelf_so_DEPS) + @$(textrel_check) + $(AM_V_at)ln -fs $@ $@.$(VERSION) + ++libeu_objects = $(shell $(AR) t ../lib/libeu.a) ++libelf_a_LIBADD = $(addprefix ../lib/,$(libeu_objects)) ++ + install: install-am libelf.so + $(mkinstalldirs) $(DESTDIR)$(libdir) + $(INSTALL_PROGRAM) libelf.so $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so +-- +2.47.0 + diff --git a/SOURCES/elfutils-0.192-skip-ima-test.patch b/SOURCES/elfutils-0.192-skip-ima-test.patch new file mode 100644 index 0000000..a887e62 --- /dev/null +++ b/SOURCES/elfutils-0.192-skip-ima-test.patch @@ -0,0 +1,48 @@ +From 36bd0ffe72f63a187902679823dfd50510bf7300 Mon Sep 17 00:00:00 2001 +From: Aaron Merey +Date: Fri, 13 Dec 2024 11:14:39 -0500 +Subject: [PATCH] run-debuginfod-ima-verification.sh: Skip test 4 + +Test 4 requires `rpmsign --delfilesign` to remove IMA signatures. +RHEL 9 rpmsign does not currently support delfilesign, so skip this +test for now. +--- + tests/run-debuginfod-ima-verification.sh | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +diff --git a/tests/run-debuginfod-ima-verification.sh b/tests/run-debuginfod-ima-verification.sh +index d582af5f..a5e6eeb2 100755 +--- a/tests/run-debuginfod-ima-verification.sh ++++ b/tests/run-debuginfod-ima-verification.sh +@@ -127,17 +127,17 @@ RC=0 + testrun ${abs_top_builddir}/debuginfod/debuginfod-find executable $RPM_BUILDID || RC=1 + test $RC -ne 0 + +-echo Test 4: A rpm without a signature will fail +-cp signed.rpm R/signed.rpm +-rpmsign --delfilesign R/signed.rpm +-rm -rf $DEBUGINFOD_CACHE_PATH # clean it from previous tests +-kill -USR1 $PID1 +-wait_ready $PORT1 'thread_work_total{role="traverse"}' 4 +-wait_ready $PORT1 'thread_work_pending{role="scan"}' 0 +-wait_ready $PORT1 'thread_busy{role="scan"}' 0 +-RC=0 +-testrun ${abs_top_builddir}/debuginfod/debuginfod-find executable $RPM_BUILDID || RC=1 +-test $RC -ne 0 ++#echo Test 4: A rpm without a signature will fail ++#cp signed.rpm R/signed.rpm ++#rpmsign --delfilesign R/signed.rpm ++#rm -rf $DEBUGINFOD_CACHE_PATH # clean it from previous tests ++#kill -USR1 $PID1 ++#wait_ready $PORT1 'thread_work_total{role="traverse"}' 4 ++#wait_ready $PORT1 'thread_work_pending{role="scan"}' 0 ++#wait_ready $PORT1 'thread_busy{role="scan"}' 0 ++#RC=0 ++#testrun ${abs_top_builddir}/debuginfod/debuginfod-find executable $RPM_BUILDID || RC=1 ++#test $RC -ne 0 + + echo Test 5: Only tests 1,2 will result in extracted signature + [[ $(curl -s http://127.0.0.1:$PORT1/metrics | grep 'http_responses_total{extra="ima-sigs-extracted"}' | awk '{print $NF}') -eq 2 ]] +-- +2.47.1 + diff --git a/SOURCES/elfutils-0.192-stacktrace-lto.patch b/SOURCES/elfutils-0.192-stacktrace-lto.patch new file mode 100644 index 0000000..9f110f8 --- /dev/null +++ b/SOURCES/elfutils-0.192-stacktrace-lto.patch @@ -0,0 +1,35 @@ +commit 43829fb8780ecbe9d17aaed22d3dfcb806cb5f45 +Author: Mark Wielaard +Date: Thu Oct 24 10:44:25 2024 +0200 + + stacktrace: Init elf_fd in sysprof_init_dwfl + + When building with LTO gcc believes elf_fd can be used uninitialized: + + In function ‘sysprof_init_dwfl’, + inlined from ‘sysprof_unwind_cb’ at stacktrace.c:1235:16: + stacktrace.c:1087:7: error: ‘elf_fd’ may be used uninitialized [-Werror=maybe-uninitialized] + 1087 | close (elf_fd); + | ^ + + This code won't be reached because if find_procfile doesn't initialize + elf_fd, it will return an error. But help the compiler by initializing + elf_fd to -1. + + * src/stacktrace.c (sysprof_init_dwfl): Init elf_fd to -1. + + Signed-off-by: Mark Wielaard + +diff --git a/src/stacktrace.c b/src/stacktrace.c +index 438cb1dd0d38..b912ca5de502 100644 +--- a/src/stacktrace.c ++++ b/src/stacktrace.c +@@ -1033,7 +1033,7 @@ sysprof_init_dwfl (struct sysprof_unwind_info *sui, + } + + Elf *elf = NULL; +- int elf_fd; ++ int elf_fd = -1; + err = find_procfile (dwfl, &pid, &elf, &elf_fd); + if (err < 0) + { diff --git a/SPECS/elfutils.spec b/SPECS/elfutils.spec index 4de2186..fef2af0 100644 --- a/SPECS/elfutils.spec +++ b/SPECS/elfutils.spec @@ -3,8 +3,8 @@ %bcond_with static Name: elfutils -Version: 0.191 -%global baserelease 4 +Version: 0.192 +%global baserelease 5 Release: %{baserelease}%{?dist} URL: http://elfutils.org/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/ @@ -16,6 +16,13 @@ Summary: A collection of utilities and DSOs to handle ELF files and DWARF data # Needed for isa specific Provides and Requires. %global depsuffix %{?_isa}%{!?_isa:-%{_arch}} +# eu-stacktrace currently only supports x86_64 +%ifarch x86_64 +%global enable_stacktrace 1 +%else +%global enable_stacktrace 0 +%endif + Requires: elfutils-libelf%{depsuffix} = %{version}-%{release} Requires: elfutils-libs%{depsuffix} = %{version}-%{release} Requires: elfutils-debuginfod-client%{depsuffix} = %{version}-%{release} @@ -39,6 +46,8 @@ BuildRequires: pkgconfig(libmicrohttpd) >= 0.9.33 BuildRequires: pkgconfig(libcurl) >= 7.29.0 BuildRequires: pkgconfig(sqlite3) >= 3.7.17 BuildRequires: pkgconfig(libarchive) >= 3.1.2 +# For debugindod metadata query +BuildRequires: pkgconfig(json-c) >= 0.11 # For tests need to bunzip2 test files. BuildRequires: bzip2 @@ -51,6 +60,17 @@ BuildRequires: curl # For run-debuginfod-response-headers.sh test case BuildRequires: socat +# For debuginfod rpm IMA verification +BuildRequires: rpm-devel +BuildRequires: ima-evm-utils-devel +BuildRequires: openssl-devel +BuildRequires: rpm-sign + +# For eu-stacktrace +%if %{enable_stacktrace} +BuildRequires: sysprof-capture-devel +%endif + BuildRequires: automake BuildRequires: autoconf BuildRequires: gettext-devel @@ -72,6 +92,18 @@ BuildRequires: gettext-devel # Patches +# Include libeu.a objects in libelf.a for static linking. +Patch1: elfutils-0.192-libelf-static.patch + +# Fix eu-stacktrace LTO build error. +Patch2: elfutils-0.192-stacktrace-lto.patch + +# Fix configure.ac setting ENABLE_DEBUGINFOD_IMA_VERIFICATION. +Patch3: elfutils-0.192-fix-configure-conditional.patch + +# Skip IMA test not currently supported in RHEL 9. +Patch4: elfutils-0.192-skip-ima-test.patch + %description Elfutils is a collection of utilities, including stack (to show backtraces), nm (for listing symbols from object files), size @@ -298,11 +330,16 @@ RPM_OPT_FLAGS="${RPM_OPT_FLAGS} -Wformat" trap 'cat config.log' EXIT +%configure CFLAGS="$RPM_OPT_FLAGS" \ %if 0%{?centos} >= 8 -%configure CFLAGS="$RPM_OPT_FLAGS" --enable-debuginfod-urls=https://debuginfod.centos.org/ -%else -%configure CFLAGS="$RPM_OPT_FLAGS" + --enable-debuginfod-urls=%{dist_debuginfod_url} \ %endif +%if %{enable_stacktrace} + --enable-stacktrace \ +%endif + --enable-debuginfod \ + --enable-debuginfod-ima-verification \ + --enable-debuginfod-ima-cert-path=%{_sysconfdir}/keys/ima trap '' EXIT %make_build @@ -385,6 +422,9 @@ fi %{_bindir}/eu-size %{_bindir}/eu-srcfiles %{_bindir}/eu-stack +%if %{enable_stacktrace} +%{_bindir}/eu-stacktrace +%endif %{_bindir}/eu-strings %{_bindir}/eu-strip %{_bindir}/eu-unstrip @@ -429,6 +469,9 @@ fi %{_libdir}/libelf.so %{_libdir}/pkgconfig/libelf.pc %{_mandir}/man3/elf_*.3* +%{_mandir}/man3/elf32_*.3* +%{_mandir}/man3/elf64_*.3* +%{_mandir}/man3/libelf.3* %if %{with static} %files libelf-devel-static @@ -447,6 +490,8 @@ fi %{_mandir}/man1/debuginfod-find.1* %{_mandir}/man7/debuginfod*.7* %{_sysconfdir}/profile.d/debuginfod.* +%{_sysconfdir}/debuginfod/*.certpath +%config(noreplace) %{_datadir}/fish/vendor_conf.d/* %if 0%{?centos} >= 8 %{_sysconfdir}/debuginfod/*.urls %endif @@ -488,6 +533,29 @@ exit 0 %systemd_postun_with_restart debuginfod.service %changelog +* Jan 15 2025 Aaron Merey - 0.192-5 +- Add debuginfod certpath to %files unconditionally + +* Jan 15 2025 Aaron Merey - 0.192-4 +- NVR Bump. + +* Fri Dec 13 2024 Aaron Merey - 0.192-3 +- Enable debuginfod IMA verification +- Add elfutils-0.192-fix-configure-conditional.patch +- Add elfutils-0.192-skip-ima-test.patch + +* Thu Oct 24 2024 Aaron Merey - 0.192-2 +- Enable eu-stacktrace on x86_64 +- Add elfutils-0.192-stacktrace-lto.patch + +* Wed Oct 23 2024 Aaron Merey - 0.192-1 +- Upgrade to upstream elfutils 0.192 +- Drop upstreamed patches + elfutils-0.190-riscv-flatten.patch + elfutils-0.191-riscv-flatten.patch + elfutils-0.191-profile-empty-urls.patch +- Add elfutils-0.192-libelf-static.patch + * Fri Apr 19 2024 Aaron Merey - 0.191-3 - eu-srcfiles directly links to libdebuginfod.so so explicitly Require elfutils-debuginfod-client not just Recommends.