From 1d5918a750b969d366f593ae10cde0c5d37a555b Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 24 Aug 2021 17:16:30 +0100 Subject: [PATCH] Annocheck: Fix memory corruption. (#1996963) spec file: Add the creation of a gcc-plugin version info file in /usr/lib/rpm/redhat. --- ...flegacy-pass-manager-option-to-the-t.patch | 27 ------------ annobin.spec | 43 ++++++++++++++++--- sources | 2 +- 3 files changed, 38 insertions(+), 34 deletions(-) delete mode 100644 0001-llvm-plugin-Add-flegacy-pass-manager-option-to-the-t.patch diff --git a/0001-llvm-plugin-Add-flegacy-pass-manager-option-to-the-t.patch b/0001-llvm-plugin-Add-flegacy-pass-manager-option-to-the-t.patch deleted file mode 100644 index 17a1626..0000000 --- a/0001-llvm-plugin-Add-flegacy-pass-manager-option-to-the-t.patch +++ /dev/null @@ -1,27 +0,0 @@ -From bda340f0754972944ec115a72f1a8547ffa21f1c Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Mon, 16 Aug 2021 18:04:53 +0000 -Subject: [PATCH] llvm-plugin: Add -flegacy-pass-manager option to the test - case - -The plugin does not work with the new pass manager yet. ---- - llvm-plugin/Makefile.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/llvm-plugin/Makefile.in b/llvm-plugin/Makefile.in -index bdd8b19..92bcc9a 100644 ---- a/llvm-plugin/Makefile.in -+++ b/llvm-plugin/Makefile.in -@@ -48,7 +48,7 @@ PLUGIN_TEST_OPTIONS = \ - # -fcf-protection \ - - check: @srcdir@/hello.c -- @ $(CLANG) -Xclang -load -Xclang $(PLUGIN) $(PLUGIN_TEST_OPTIONS) -c @srcdir@/hello.c -+ @ $(CLANG) -flegacy-pass-manager -Xclang -load -Xclang $(PLUGIN) $(PLUGIN_TEST_OPTIONS) -c @srcdir@/hello.c - @ $(READELF) --wide --notes hello.o > llvm-plugin-test.out - @ grep --silent -e "annobin built by llvm version" llvm-plugin-test.out - @ grep --silent -e "running on LLVM version" llvm-plugin-test.out --- -2.26.2 - diff --git a/annobin.spec b/annobin.spec index 1a8204c..eb38cf5 100644 --- a/annobin.spec +++ b/annobin.spec @@ -1,7 +1,7 @@ Name: annobin Summary: Annotate and examine compiled binary files -Version: 9.90 +Version: 9.92 Release: 1%{?dist} License: GPLv3+ # Maintainer: nickc@redhat.com @@ -231,6 +231,15 @@ Requires: (gcc >= %{gcc_major} with gcc < %{gcc_next}) Requires: gcc %endif +# The next line has been stolen from redhat-rpm-config.spec. +# We install a version info file into this directory, rather than gcc's plugin +# directory, because there is no reliable way for redhat-rpm-config to +# determine the name of gcc's plugin directory. +%global rrcdir /usr/lib/rpm/redhat + +# Information about the gcc plugin is recorded in this file. +%global aver %{rrcdir}/annobin-plugin-version-info + %description plugin-gcc Installs an annobin plugin that can be used by gcc. @@ -279,6 +288,7 @@ Installs an annobin plugin that can be used by Clang. #--------------------------------------------------------------------------------- %prep + if [ -z "%{gcc_vr}" ]; then echo "*** Missing gcc_vr spec file macro, cannot continue." >&2 exit 1 @@ -339,7 +349,7 @@ CONFIG_ARGS="$CONFIG_ARGS --without-annocheck" %else # Fedora supports AArch64's -mbranch-protection=bti, RHEL does not. %if 0%{?fedora} != 0 -export CFLAGS="$CFLAGS -DAARCh64_BRANCH_PROTECTION_SUPPORTED=1" +export CFLAGS="$CFLAGS -DAARCH64_BRANCH_PROTECTION_SUPPORTED=1" %endif %endif @@ -354,8 +364,6 @@ export CLANG_TARGET_OPTIONS="-fcf-protection" %make_build -#--------------------------------------------------------------------------------- - %if %{with plugin_rebuild} # Rebuild the plugin(s), this time using the plugin itself! This # ensures that the plugin works, and that it contains annotations @@ -397,15 +405,28 @@ make -C llvm-plugin all CXXFLAGS="%{optflags} $BUILD_FLAGS" #--------------------------------------------------------------------------------- -# PLUGIN_INSTALL_DIR is used by the Clang and LLVM makefiles... %install + +# PLUGIN_INSTALL_DIR is used by the Clang and LLVM makefiles... %make_install PLUGIN_INSTALL_DIR=%{buildroot}/%{llvm_plugin_dir} %if %{with clangplugin} -# Move clang plugin to a seperate directory. +# Move the clang plugin to a seperate directory. mkdir -p %{buildroot}/%{clang_plugin_dir} mv %{buildroot}/%{llvm_plugin_dir}/annobin-for-clang.so %{buildroot}/%{clang_plugin_dir} %endif + +%if %{with gccplugin} +# Record the version of gcc that built this plugin. +mkdir -p %{buildroot}%{rrcdir} +rm -f %{buildroot}%{aver} +# Note - the comparison logic in redhat-rpm-config's %%triggger macros require +# that the plugin builder information appear as the first three numbers in the file. +echo %{gcc_vr} > %{buildroot}%{aver} +# Provide a more complete version information string on the second line. +echo "%{ANNOBIN_GCC_PLUGIN_DIR}/annobin.so.0.0.0 was built by gcc version %{gcc_vr} from the %{version} sources" >> %{buildroot}%{aver} +%endif + rm -f %{buildroot}%{_infodir}/dir #--------------------------------------------------------------------------------- @@ -414,6 +435,8 @@ rm -f %{buildroot}%{_infodir}/dir %check # Change the following line to "make check || :" on RHEL7 or if you need to see the # test suite logs in order to diagnose a test failure. +# Change the following line to: make check CLANG_TESTS="check-pre-clang-13" +# if you need to run the tests on a machine with an earlier version of Clang installed. make -k check if [ -f tests/test-suite.log ]; then cat tests/test-suite.log @@ -447,6 +470,7 @@ fi %if %{with gccplugin} %files plugin-gcc %{ANNOBIN_GCC_PLUGIN_DIR} +%{aver} %endif %if %{with annocheck} @@ -458,6 +482,13 @@ fi #--------------------------------------------------------------------------------- %changelog +* Tue Aug 24 2021 Nick Clifton - 9.92-1 +- Annocheck: Fix memory corruption. (#1996963) +- spec file: Add the creation of a gcc-plugin version info file in /usr/lib/rpm/redhat. + +* Wed Aug 18 2021 Nick Clifton - 9.91-1 +- Annocheck: Fix conditionalization of AArch64's PAC+BTI detection. + * Wed Aug 18 2021 Nick Clifton - 9.90-1 - Annocheck: Add linker generated function for ppc64le exceptions. (#1981410) - LLVM Plugin: Allow checks to be selected from the command line. diff --git a/sources b/sources index 8c60d1f..0bf131b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (annobin-9.90.tar.xz) = 1dd320ad25f14d17c3a6973582a2c58912e3d5ffba51d459a09fc423bef2465fecb54c5a9d9202df8d68071cb5205eef2e2175d02c91fd7ba85abc103d324585 +SHA512 (annobin-9.92.tar.xz) = 6edd56c7959b80254ecf08ff3aa2a59ff31146494cd20856e52f1f632bfd0e7d5a264dcf7227215f74b5e036aaad3d7c56d40ff4d57929446eafd33620e17b50