diff --git a/SOURCES/libtracefs-1.0.2-harden-linking.patch b/SOURCES/libtracefs-1.0.2-harden-linking.patch new file mode 100644 index 0000000..1e80e6b --- /dev/null +++ b/SOURCES/libtracefs-1.0.2-harden-linking.patch @@ -0,0 +1,11 @@ +--- a/scripts/utils.mk ++++ b/scripts/utils.mk +@@ -56,7 +56,7 @@ + + do_compile_shared_library = \ + ($(print_shared_lib_compile) \ +- $(CC) --shared $^ '-Wl,-soname,$(1),-rpath=$$ORIGIN' -o $@ $(LIBS)) ++ $(CC) --shared $^ '-Wl,-soname,$(1),-rpath=$$ORIGIN' -o $@ $(GCCLDFLAGS) $(LIBS)) + + do_compile_plugin_obj = \ + ($(print_plugin_obj_compile) \ diff --git a/SPECS/libtracefs.spec b/SPECS/libtracefs.spec index 7914fd9..35185ca 100644 --- a/SPECS/libtracefs.spec +++ b/SPECS/libtracefs.spec @@ -11,7 +11,7 @@ Name: libtracefs Version: 1.0.2 -Release: 5%{?dist} +Release: 7%{?dist} License: LGPLv2+ and GPLv2+ Summary: Library for access kernel tracefs @@ -23,6 +23,7 @@ URL: https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ #Source0: libtracefs-%%{version}.tar.gz #Source0: https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/snapshot/libtracefs-%%{commit}.tar.gz Source0: https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/snapshot/libtracefs-%{version}.tar.gz +Patch0: libtracefs-1.0.2-harden-linking.patch BuildRequires: gcc BuildRequires: make BuildRequires: pkgconfig(libtraceevent) @@ -41,12 +42,16 @@ Development headers of %{name} %prep %setup -q +%patch0 -p1 %build %set_build_flags +export GCCLDFLAGS="-Wl,-z,now" %make_build prefix=%{_prefix} libdir=%{_libdir} all %install +%set_build_flags +export GCCLDFLAGS="-Wl,-z,now" %make_install prefix=%{_prefix} libdir=%{_libdir} rm -rf %{buildroot}/%{_libdir}/libtracefs.a @@ -62,6 +67,14 @@ rm -rf %{buildroot}/%{_libdir}/libtracefs.a %{_libdir}/%{name}.so %changelog +* Fri Jan 14 2022 Michael Petlan - 1.0.2-7 +- Harden library linking; add the flags to install section too + Related: rhbz#2038853 + +* Wed Jan 12 2022 Michael Petlan - 1.0.2-6 +- Harden library linking + Related: rhbz#2038853 + * Mon Aug 09 2021 Mohan Boddu - 1.0.2-5 - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags Related: rhbz#1991688