diff --git a/95796.patch b/95796.patch new file mode 100644 index 0000000..25185e2 --- /dev/null +++ b/95796.patch @@ -0,0 +1,55 @@ +From 1df9fd71f76a7731f198a174da19deaab50f10bb Mon Sep 17 00:00:00 2001 +From: Tulio Magno Quites Machado Filho +Date: Mon, 17 Jun 2024 11:25:36 -0300 +Subject: [PATCH] [hwasan][aarch64] Fix missing DT_AARCH64_BTI_PLT flag + +When building hwasan on aarch64, the DT_AARCH64_BTI_PLT flag is missing +from libclang_rt.hwasan.so because some object files without +DT_AARCH64_BTI_PLT are linked in the final DSO. +These files are specific to riscv64 and x86_64, ending up with no +aarch64 code in them. + +Avoid building and linking architecture-specific files unless the +architecture is listed in HWASAN_SUPPORTED_ARCH. +--- + compiler-rt/lib/hwasan/CMakeLists.txt | 22 +++++++++++++++++----- + 1 file changed, 17 insertions(+), 5 deletions(-) + +diff --git a/compiler-rt/lib/hwasan/CMakeLists.txt b/compiler-rt/lib/hwasan/CMakeLists.txt +index 6f75baa7e354f..086079c7536e5 100644 +--- a/compiler-rt/lib/hwasan/CMakeLists.txt ++++ b/compiler-rt/lib/hwasan/CMakeLists.txt +@@ -15,16 +15,28 @@ set(HWASAN_RTL_SOURCES + hwasan_memintrinsics.cpp + hwasan_poisoning.cpp + hwasan_report.cpp +- hwasan_setjmp_aarch64.S +- hwasan_setjmp_riscv64.S +- hwasan_setjmp_x86_64.S +- hwasan_tag_mismatch_aarch64.S +- hwasan_tag_mismatch_riscv64.S + hwasan_thread.cpp + hwasan_thread_list.cpp + hwasan_type_test.cpp + ) + ++foreach(arch ${HWASAN_SUPPORTED_ARCH}) ++ if(${arch} MATCHES "aarch64") ++ list(APPEND HWASAN_RTL_SOURCES ++ hwasan_setjmp_aarch64.S ++ hwasan_tag_mismatch_aarch64.S) ++ endif() ++ if(${arch} MATCHES "riscv64") ++ list(APPEND HWASAN_RTL_SOURCES ++ hwasan_setjmp_riscv64.S ++ hwasan_tag_mismatch_riscv64.S) ++ endif() ++ if(${arch} MATCHES "x86_64") ++ list(APPEND HWASAN_RTL_SOURCES ++ hwasan_setjmp_x86_64.S) ++ endif() ++endforeach() ++ + set(HWASAN_RTL_CXX_SOURCES + hwasan_new_delete.cpp + ) diff --git a/95839.patch b/95839.patch new file mode 100644 index 0000000..134855d --- /dev/null +++ b/95839.patch @@ -0,0 +1,66 @@ +From 723a13c41dca89e37f3e02120c9385b33ee73439 Mon Sep 17 00:00:00 2001 +From: Tulio Magno Quites Machado Filho +Date: Mon, 17 Jun 2024 16:47:04 -0300 +Subject: [PATCH] [tsan][aarch64] Fix branch protection in interceptors + +Start functions with BTI in order to identify the function as a valid +branch target. +Also add the BTI marker to tsan_rtl_aarch64.S. + +With this patch, libclang_rt.tsan.so can now be generated with +DT_AARCH64_BTI_PLT when built with -mbranch-protection=standard. +--- + compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S b/compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S +index c6162659b8766..7d920bee4a2db 100644 +--- a/compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S ++++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S +@@ -2,6 +2,7 @@ + #if defined(__aarch64__) + + #include "sanitizer_common/sanitizer_asm.h" ++#include "builtins/assembly.h" + + #if !defined(__APPLE__) + .section .text +@@ -16,6 +17,7 @@ ASM_HIDDEN(__tsan_setjmp) + ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(setjmp)) + ASM_SYMBOL_INTERCEPTOR(setjmp): + CFI_STARTPROC ++ BTI_C + + // Save frame/link register + stp x29, x30, [sp, -32]! +@@ -66,6 +68,7 @@ ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(setjmp)) + ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(_setjmp)) + ASM_SYMBOL_INTERCEPTOR(_setjmp): + CFI_STARTPROC ++ BTI_C + + // Save frame/link register + stp x29, x30, [sp, -32]! +@@ -116,6 +119,7 @@ ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(_setjmp)) + ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(sigsetjmp)) + ASM_SYMBOL_INTERCEPTOR(sigsetjmp): + CFI_STARTPROC ++ BTI_C + + // Save frame/link register + stp x29, x30, [sp, -32]! +@@ -168,6 +172,7 @@ ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(sigsetjmp)) + ASM_TYPE_FUNCTION(ASM_SYMBOL_INTERCEPTOR(__sigsetjmp)) + ASM_SYMBOL_INTERCEPTOR(__sigsetjmp): + CFI_STARTPROC ++ BTI_C + + // Save frame/link register + stp x29, x30, [sp, -32]! +@@ -217,4 +222,6 @@ ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(__sigsetjmp)) + + NO_EXEC_STACK_DIRECTIVE + ++GNU_PROPERTY_BTI_PAC ++ + #endif diff --git a/compiler-rt.spec b/compiler-rt.spec index 8432f41..0e518af 100644 --- a/compiler-rt.spec +++ b/compiler-rt.spec @@ -16,7 +16,7 @@ %global maj_ver 18 %global min_ver 1 -%global patch_ver 2 +%global patch_ver 8 #global rc_ver 4 %if %{with snapshot_build} %global maj_ver %{llvm_snapshot_version_major} @@ -42,7 +42,7 @@ Name: %{pkg_name} Version: %{compiler_rt_version}%{?rc_ver:~rc%{rc_ver}}%{?llvm_snapshot_version_suffix:~%{llvm_snapshot_version_suffix}} -Release: 4%{?dist} +Release: 1%{?dist} Summary: LLVM "compiler-rt" runtime libraries License: Apache-2.0 WITH LLVM-exception OR NCSA OR MIT @@ -57,6 +57,12 @@ Source2: release-keys.asc %endif Patch0: 0001-compiler-rt-Fix-FLOAT16-feature-detection.patch +# The following 2 patches fix issues reported by annocheck. +# They're backports from: +# https://github.com/llvm/llvm-project/pull/95796 +# https://github.com/llvm/llvm-project/pull/95839 +Patch1: 95796.patch +Patch2: 95839.patch BuildRequires: clang BuildRequires: cmake @@ -145,6 +151,9 @@ ln -s i386-redhat-linux-gnu %{buildroot}%{_prefix}/lib/clang/%{maj_ver}/lib/%{_t #%endif %changelog +* Tue Jul 23 2024 Tulio Magno Quites Machado Filho - 18.1.8-1 +- Update to LLVM 18.1.2 (RHEL-28056) + * Mon Jun 24 2024 Troy Dawson - 18.1.2-4 - Bump release for June 2024 mass rebuild diff --git a/sources b/sources index 995ce2c..952704f 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (compiler-rt-18.1.2.src.tar.xz) = a17a80cac9050bd3349ad18e1e4d87002ae2667e42047fc6889c9dd10db493780a1dc05f0171ce0cc91291158e5bb7ee04f83e275b697e3e31fcb8e2f7aac297 -SHA512 (compiler-rt-18.1.2.src.tar.xz.sig) = b484728da7ac5074e37501a9407f8b05ca23cdc8a108ec7cfcf77e7964a7fcc0073db2a8268488d3266409a03d44a643b6a26663fe8b20ddade255575d75b9c8 +SHA512 (compiler-rt-18.1.8.src.tar.xz) = fb8795bd51c9b005c2ad1975591e9e2715740d6407ccad41379f136ef2e8d24ded8b97b01165a3ae4bd377119a6a1049ca05d3220404fc12bee86114ff2bff0d +SHA512 (compiler-rt-18.1.8.src.tar.xz.sig) = 06d90afa46fb8c7ad6879564d1eb35e45711768593b580cf59e9908ed89efd459a312ae3c317c38119b0142ce0f96bcc0f8e6010ec8b31d9620c5e8f6d2f932e