import compiler-rt-10.0.1-1.module+el8.3.0+7459+90c24896

This commit is contained in:
CentOS Sources 2020-11-03 07:10:10 -05:00 committed by Andrew Lukoshko
parent 981e67f1a9
commit 02b9b7af25
9 changed files with 139 additions and 148 deletions

View File

@ -1 +1,2 @@
b35bc6ed7ce40f18ac45c81f4cf02ffd1f14de82 SOURCES/compiler-rt-9.0.1.src.tar.xz
ee6077b4728b3c750e476938cead11cea45b49ff SOURCES/compiler-rt-10.0.1.src.tar.xz
32fa4b0193960f05064f2ab31b5a89c7cf48a0b9 SOURCES/hans-gpg-key.asc

3
.gitignore vendored
View File

@ -1 +1,2 @@
SOURCES/compiler-rt-9.0.1.src.tar.xz
SOURCES/compiler-rt-10.0.1.src.tar.xz
SOURCES/hans-gpg-key.asc

View File

@ -7,9 +7,9 @@ Subject: [PATCH] Drop -fno-stack-protector from the compiler flags
compiler-rt/CMakeLists.txt | 1 -
1 file changed, 1 deletion(-)
diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
diff --git compiler-rt.orig/CMakeLists.txt compiler-rt/CMakeLists.txt
index f26ae25..a6ac032 100644
--- a/compiler-rt/CMakeLists.txt
--- compiler-rt.orig/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -271,7 +271,6 @@ if(NOT COMPILER_RT_DEBUG AND NOT APPLE)
append_list_if(COMPILER_RT_HAS_FOMIT_FRAME_POINTER_FLAG -fomit-frame-pointer SANITIZER_COMMON_CFLAGS)

View File

@ -1,84 +0,0 @@
From 25395eb64390546dffe2a2494876909d27b999c3 Mon Sep 17 00:00:00 2001
From: Evgenii Stepanov <eugenis@google.com>
Date: Mon, 25 Nov 2019 13:52:17 -0800
Subject: [PATCH] Fix sanitizer-common build with glibc 2.31
Summary:
As mentioned in D69104, glibc changed ABI recently with the [[ https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=2f959dfe849e0646e27403f2e4091536496ac0f0| 2f959dfe ]] change.
D69104 dealt with just 32-bit ARM, but that is just one of the many affected architectures.
E.g. x86_64, i?86, riscv64, sparc 32-bit, s390 31-bit are affected too (and various others).
This patch instead of adding a long list of further architectures that wouldn't be checked ever next to arm 32-bit changes the structures to match the 2.31 layout and performs the checking on Linux for ipc_perm mode position/size only on non-Linux or on Linux with glibc 2.31 or later. I think this matches what is done for aarch64 already.
If needed, we could list architectures that haven't changed ABI (e.g. powerpc), so that they would be checked even with older glibcs. AFAIK sanitizers don't actually use ipc_perm.mode and
so all they care about is the size and alignment of the whole structure.
Note, s390 31-bit and arm 32-bit big-endian changed ABI even further, there will now be shmctl with old symbol version and shmctl@@GLIBC_2.31 which will be incompatible. I'm afraid this isn't really solvable unless the sanitizer libraries are symbol versioned and use matching symbol versions to glibc symbols for stuff they intercept, plus use dlvsym.
This patch doesn't try to address that.
Patch by Jakub Jelinek.
Reviewers: kcc, eugenis, dvyukov
Reviewed By: eugenis
Subscribers: jyknight, kristof.beyls, fedor.sergeev, simoncook, PkmX, s.egerton, steven.zhang, #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D70662
---
.../sanitizer_common/sanitizer_platform_limits_posix.cc | 5 +++--
.../sanitizer_common/sanitizer_platform_limits_posix.h | 15 +--------------
2 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
index b7fa6e8..abdf794 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -1126,8 +1126,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */
+#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
+/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
+ on many architectures. */
CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
#endif
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
index f1a4fd7..029a209 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -203,26 +203,13 @@ namespace __sanitizer {
u64 __unused1;
u64 __unused2;
#elif defined(__sparc__)
-#if defined(__arch64__)
unsigned mode;
- unsigned short __pad1;
-#else
- unsigned short __pad1;
- unsigned short mode;
unsigned short __pad2;
-#endif
unsigned short __seq;
unsigned long long __unused1;
unsigned long long __unused2;
-#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__)
- unsigned int mode;
- unsigned short __seq;
- unsigned short __pad1;
- unsigned long __unused1;
- unsigned long __unused2;
#else
- unsigned short mode;
- unsigned short __pad1;
+ unsigned int mode;
unsigned short __seq;
unsigned short __pad2;
#if defined(__x86_64__) && !defined(_LP64)
--
1.8.3.1

View File

@ -0,0 +1,68 @@
From af38074874c605f9e598ae3f7e5d4befa3fe92bb Mon Sep 17 00:00:00 2001
From: serge-sans-paille <sguelton@redhat.com>
Date: Thu, 28 May 2020 17:50:31 +0200
Subject: [PATCH] Fix strict aliasing warning in msan.cpp
Use internal_memcpy instead.
Differential Revision: https://reviews.llvm.org/D80732
---
compiler-rt/lib/msan/msan.cpp | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git compiler-rt.orig/lib/msan/msan.cpp compiler-rt/lib/msan/msan.cpp
index 7095ee1bf20..8c789901adc 100644
--- compiler-rt.orig/lib/msan/msan.cpp
+++ compiler-rt/lib/msan/msan.cpp
@@ -617,34 +617,41 @@ u32 __msan_get_umr_origin() {
}
u16 __sanitizer_unaligned_load16(const uu16 *p) {
- *(uu16 *)&__msan_retval_tls[0] = *(uu16 *)MEM_TO_SHADOW((uptr)p);
+ internal_memcpy(&__msan_retval_tls[0], (void *)MEM_TO_SHADOW((uptr)p),
+ sizeof(uu16));
if (__msan_get_track_origins())
__msan_retval_origin_tls = GetOriginIfPoisoned((uptr)p, sizeof(*p));
return *p;
}
u32 __sanitizer_unaligned_load32(const uu32 *p) {
- *(uu32 *)&__msan_retval_tls[0] = *(uu32 *)MEM_TO_SHADOW((uptr)p);
+ internal_memcpy(&__msan_retval_tls[0], (void *)MEM_TO_SHADOW((uptr)p),
+ sizeof(uu32));
if (__msan_get_track_origins())
__msan_retval_origin_tls = GetOriginIfPoisoned((uptr)p, sizeof(*p));
return *p;
}
u64 __sanitizer_unaligned_load64(const uu64 *p) {
- __msan_retval_tls[0] = *(uu64 *)MEM_TO_SHADOW((uptr)p);
+ internal_memcpy(&__msan_retval_tls[0], (void *)MEM_TO_SHADOW((uptr)p),
+ sizeof(uu64));
if (__msan_get_track_origins())
__msan_retval_origin_tls = GetOriginIfPoisoned((uptr)p, sizeof(*p));
return *p;
}
void __sanitizer_unaligned_store16(uu16 *p, u16 x) {
- u16 s = *(uu16 *)&__msan_param_tls[1];
- *(uu16 *)MEM_TO_SHADOW((uptr)p) = s;
+ static_assert(sizeof(uu16) == sizeof(u16), "incompatible types");
+ u16 s;
+ internal_memcpy(&s, &__msan_param_tls[1], sizeof(uu16));
+ internal_memcpy((void *)MEM_TO_SHADOW((uptr)p), &s, sizeof(uu16));
if (s && __msan_get_track_origins())
if (uu32 o = __msan_param_origin_tls[2])
SetOriginIfPoisoned((uptr)p, (uptr)&s, sizeof(s), o);
*p = x;
}
void __sanitizer_unaligned_store32(uu32 *p, u32 x) {
- u32 s = *(uu32 *)&__msan_param_tls[1];
- *(uu32 *)MEM_TO_SHADOW((uptr)p) = s;
+ static_assert(sizeof(uu32) == sizeof(u32), "incompatible types");
+ u32 s;
+ internal_memcpy(&s, &__msan_param_tls[1], sizeof(uu32));
+ internal_memcpy((void *)MEM_TO_SHADOW((uptr)p), &s, sizeof(uu32));
if (s && __msan_get_track_origins())
if (uu32 o = __msan_param_origin_tls[2])
SetOriginIfPoisoned((uptr)p, (uptr)&s, sizeof(s), o);
--
2.25.2

View File

@ -0,0 +1,28 @@
diff -ru compiler-rt-8.0.0rc1.src.orig/lib/fuzzer/FuzzerDefs.h compiler-rt-8.0.0rc1.src/lib/fuzzer/FuzzerDefs.h
--- compiler-rt-8.0.0rc1.src.orig/lib/fuzzer/FuzzerDefs.h 2019-01-09 21:46:09.000000000 +0000
+++ compiler-rt-8.0.0rc1.src/lib/fuzzer/FuzzerDefs.h 2019-02-12 14:03:32.971147814 +0000
@@ -176,6 +176,12 @@
template<class Other>
struct rebind { typedef fuzzer_allocator<Other> other; };
+
+ template< class U, class... Args >
+ void construct( U* p, Args&&... args ) {
+ std::allocator<T>::construct(p, std::forward<Args>(args)...);
+ }
+
};
template<typename T>
diff -ru compiler-rt-8.0.0rc1.src.orig/lib/fuzzer/FuzzerDriver.cpp compiler-rt-8.0.0rc1.src/lib/fuzzer/FuzzerDriver.cpp
--- compiler-rt-8.0.0rc1.src.orig/lib/fuzzer/FuzzerDriver.cpp 2019-01-15 22:12:51.000000000 +0000
+++ compiler-rt-8.0.0rc1.src/lib/fuzzer/FuzzerDriver.cpp 2019-02-12 13:05:15.965113872 +0000
@@ -252,7 +252,7 @@
std::thread Pulse(PulseThread);
Pulse.detach();
for (unsigned i = 0; i < NumWorkers; i++)
- V.push_back(std::thread(WorkerThread, std::ref(Cmd), &Counter, NumJobs, &HasErrors));
+ V.emplace_back(WorkerThread, std::ref(Cmd), &Counter, NumJobs, &HasErrors);
for (auto &T : V)
T.join();
return HasErrors ? 1 : 0;

View File

@ -1,43 +0,0 @@
From 45e85d0673a603618a4000c3839b0bd96c263762 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Fri, 20 Dec 2019 11:17:22 -0800
Subject: [PATCH] std thread copy fix
---
compiler-rt/lib/fuzzer/FuzzerDefs.h | 6 ++++++
compiler-rt/lib/fuzzer/FuzzerDriver.cpp | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/compiler-rt/lib/fuzzer/FuzzerDefs.h b/compiler-rt/lib/fuzzer/FuzzerDefs.h
index 320b37d..37c4b2c 100644
--- a/compiler-rt/lib/fuzzer/FuzzerDefs.h
+++ b/compiler-rt/lib/fuzzer/FuzzerDefs.h
@@ -183,6 +183,12 @@ template<typename T>
template<class Other>
struct rebind { typedef fuzzer_allocator<Other> other; };
+
+ template< class U, class... Args >
+ void construct( U* p, Args&&... args ) {
+ std::allocator<T>::construct(p, std::forward<Args>(args)...);
+ }
+
};
template<typename T>
diff --git a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
index 54c7ff0..47cd7ab 100644
--- a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
@@ -264,7 +264,7 @@ static int RunInMultipleProcesses(const Vector<std::string> &Args,
std::thread Pulse(PulseThread);
Pulse.detach();
for (unsigned i = 0; i < NumWorkers; i++)
- V.push_back(std::thread(WorkerThread, std::ref(Cmd), &Counter, NumJobs, &HasErrors));
+ V.emplace_back(WorkerThread, std::ref(Cmd), &Counter, NumJobs, &HasErrors);
for (auto &T : V)
T.join();
return HasErrors ? 1 : 0;
--
1.8.3.1

Binary file not shown.

View File

@ -3,22 +3,35 @@
%global debug_package %{nil}
%endif
#%%global rc_ver 3
%global baserelease 2
#%%global rc_ver 6
%global baserelease 1
%global crt_srcdir compiler-rt-%{version}%{?rc_ver:rc%{rc_ver}}.src
# see https://sourceware.org/bugzilla/show_bug.cgi?id=25271
%global optflags %(echo %{optflags} -D_DEFAULT_SOURCE)
# see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93615
%global optflags %(echo %{optflags} -Dasm=__asm__)
Name: compiler-rt
Version: 9.0.1
Version: 10.0.1
Release: %{baserelease}%{?rc_ver:.rc%{rc_ver}}%{?dist}
Summary: LLVM "compiler-rt" runtime libraries
License: NCSA or MIT
URL: http://llvm.org
Source0: http://%{?rc_ver:pre}releases.llvm.org/%{version}/%{?rc_ver:rc%{rc_ver}}/%{crt_srcdir}.tar.xz
%if 0%{?rc_ver:1}
Source0: https://prereleases.llvm.org/%{version}/rc%{rc_ver}/%{crt_srcdir}.tar.xz
Source1: https://prereleases.llvm.org/%{version}/rc%{rc_ver}/%{crt_srcdir}.tar.xz.sig
%else
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{crt_srcdir}.tar.xz
Source3: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{crt_srcdir}.tar.xz.sig
%endif
Source2: https://prereleases.llvm.org/%{version}/hans-gpg-key.asc
Patch0: 0001-std-thread-copy-fix.patch
Patch1: 0001-Fix-sanitizer-common-build-with-glibc-2.31.patch
Patch0: 0001-PATCH-std-thread-copy.patch
Patch1: 0001-Fix-strict-aliasing-warning-in-msan.cpp.patch
# RHEL-specific patches
Patch100: 0001-Drop-fno-stack-protector-from-the-compiler-flags.patch
@ -39,9 +52,9 @@ code generation, sanitizer runtimes and profiling library for code
instrumentation, and Blocks C language extension.
%prep
%autosetup -n %{crt_srcdir} -p2
%autosetup -n %{crt_srcdir} -p1
pathfix.py -i %{__python3} -pn .
pathfix.py -i %{__python3} -pn lib/hwasan/scripts/hwasan_symbolize
%build
mkdir -p _build
@ -63,18 +76,13 @@ make %{?_smp_mflags}
cd _build
make install DESTDIR=%{buildroot}
mkdir -p %{buildroot}%{_libdir}/clang/%{version}/lib
%ifarch aarch64
%global aarch64_blacklists hwasan_blacklist.txt
%endif
for file in %{aarch64_blacklists} asan_blacklist.txt msan_blacklist.txt dfsan_blacklist.txt cfi_blacklist.txt dfsan_abilist.txt hwasan_blacklist.txt; do
mv -v %{buildroot}%{_datadir}/${file} %{buildroot}%{_libdir}/clang/%{version}/ || :
done
# move blacklist/abilist files to where clang expect them
mkdir -p %{buildroot}%{_libdir}/clang/%{version}/share
mv -v %{buildroot}%{_datadir}/*list.txt %{buildroot}%{_libdir}/clang/%{version}/share/
# move sanitizer libs to better place
%global libclang_rt_installdir lib/linux
mkdir -p %{buildroot}%{_libdir}/clang/%{version}/lib
mv -v %{buildroot}%{_prefix}/%{libclang_rt_installdir}/*clang_rt* %{buildroot}%{_libdir}/clang/%{version}/lib
mkdir -p %{buildroot}%{_libdir}/clang/%{version}/lib/linux/
pushd %{buildroot}%{_libdir}/clang/%{version}/lib
@ -118,8 +126,20 @@ fi
%files
%{_includedir}/*
%{_libdir}/clang/%{version}
%ifarch x86_64 aarch64
%{_bindir}/hwasan_symbolize
%endif
%changelog
* Fri Jul 24 2020 sguelton@redhat.com - 10.0.1-1
- 10.0.1 release
* Mon Jun 15 2020 sguelton@redhat.com - 10.0.0-2
- Fix msan compilation warnings, see rhbz#1841165
* Wed Apr 8 2020 sguelton@redhat.com - 10.0.0-1
- 10.0.0 final
* Mon Jan 06 2020 Tom Stellard <tstellar@redhat.com> - 9.0.1-2
- Update fno-stack-protector patch to apply with -p2