Skip to content

Commit 52825e9

Browse files
committed
[𝘀𝗽𝗿] initial version
Created using spr 1.3.6-beta.1
2 parents 2fc1b3d + e3a638c commit 52825e9

File tree

11 files changed

+43
-11
lines changed

11 files changed

+43
-11
lines changed

compiler-rt/lib/gwp_asan/tests/basic.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,12 @@ TEST_F(DefaultGuardedPoolAllocator, NonPowerOfTwoAlignment) {
6565

6666
// Added multi-page slots? You'll need to expand this test.
6767
TEST_F(DefaultGuardedPoolAllocator, TooBigForSinglePageSlots) {
68-
EXPECT_EQ(nullptr, GPA.allocate(0x1001, 0));
69-
EXPECT_EQ(nullptr, GPA.allocate(0x1001, 1));
70-
EXPECT_EQ(nullptr, GPA.allocate(0x1001, 0x1000));
71-
EXPECT_EQ(nullptr, GPA.allocate(1, 0x2000));
72-
EXPECT_EQ(nullptr, GPA.allocate(0, 0x2000));
68+
size_t PageSize = sysconf(_SC_PAGESIZE);
69+
EXPECT_EQ(nullptr, GPA.allocate(PageSize + 1, 0));
70+
EXPECT_EQ(nullptr, GPA.allocate(PageSize + 1, 1));
71+
EXPECT_EQ(nullptr, GPA.allocate(PageSize + 1, PageSize));
72+
EXPECT_EQ(nullptr, GPA.allocate(1, 2 * PageSize));
73+
EXPECT_EQ(nullptr, GPA.allocate(0, 2 * PageSize));
7374
}
7475

7576
TEST_F(CustomGuardedPoolAllocator, AllocAllSlots) {

compiler-rt/lib/gwp_asan/tests/never_allocated.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
#include "gwp_asan/tests/harness.h"
1414

1515
TEST_P(BacktraceGuardedPoolAllocatorDeathTest, NeverAllocated) {
16+
size_t PageSize = sysconf(_SC_PAGESIZE);
17+
1618
SCOPED_TRACE("");
17-
void *Ptr = GPA.allocate(0x1000);
19+
void *Ptr = GPA.allocate(PageSize);
1820
GPA.deallocate(Ptr);
1921

2022
std::string DeathNeedle =
@@ -23,7 +25,7 @@ TEST_P(BacktraceGuardedPoolAllocatorDeathTest, NeverAllocated) {
2325
// Trigger a guard page in a completely different slot that's never allocated.
2426
// Previously, there was a bug that this would result in nullptr-dereference
2527
// in the posix crash handler.
26-
char *volatile NeverAllocatedPtr = static_cast<char *>(Ptr) + 0x3000;
28+
char *volatile NeverAllocatedPtr = static_cast<char *>(Ptr) + 3 * PageSize;
2729
if (!Recoverable) {
2830
EXPECT_DEATH(*NeverAllocatedPtr = 0, DeathNeedle);
2931
return;
@@ -37,8 +39,8 @@ TEST_P(BacktraceGuardedPoolAllocatorDeathTest, NeverAllocated) {
3739
GetOutputBuffer().clear();
3840
for (size_t i = 0; i < 100; ++i) {
3941
*NeverAllocatedPtr = 0;
40-
*(NeverAllocatedPtr + 0x2000) = 0;
41-
*(NeverAllocatedPtr + 0x3000) = 0;
42+
*(NeverAllocatedPtr + 2 * PageSize) = 0;
43+
*(NeverAllocatedPtr + 3 * PageSize) = 0;
4244
ASSERT_TRUE(GetOutputBuffer().empty());
4345
}
4446

compiler-rt/test/asan/TestCases/Linux/release_to_os_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// RUN: %env_asan_opts=allocator_release_to_os_interval_ms=-1 %run %t force 2>&1 | FileCheck %s --check-prefix=FORCE_RELEASE
77

88
// REQUIRES: x86_64-target-arch
9+
// REQUIRES: page-size-4096
910

1011
#include <algorithm>
1112
#include <assert.h>

compiler-rt/test/cfi/cross-dso/lit.local.cfg.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@ def getRoot(config):
1212
# Android O (API level 26) has support for cross-dso cfi in libdl.so.
1313
if config.android and "android-26" not in config.available_features:
1414
config.unsupported = True
15+
16+
# The runtime library only supports 4K pages.
17+
if "page-size-4096" not in config.available_features:
18+
config.unsupported = True

compiler-rt/test/dfsan/atomic.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
// RUN: %clangxx_dfsan %s -fno-exceptions -o %t && %run %t
2-
// RUN: %clangxx_dfsan -DORIGIN_TRACKING -mllvm -dfsan-track-origins=1 %s -fno-exceptions -o %t && %run %t
1+
// RUN: %clangxx_dfsan %s -fno-exceptions -D_GLIBCXX_NO_ASSERTIONS -o %t && %run %t
2+
// RUN: %clangxx_dfsan -DORIGIN_TRACKING -mllvm -dfsan-track-origins=1 %s -fno-exceptions -D_GLIBCXX_NO_ASSERTIONS -o %t && %run %t
33
//
44
// Use -fno-exceptions to turn off exceptions to avoid instrumenting
55
// __cxa_begin_catch, std::terminate and __gxx_personality_v0.
66
//
7+
// Use -D_GLIBCXX_NO_ASSERTIONS to avoid depending on
8+
// std::__glibcxx_assert_fail with gcc >= 15.
9+
//
710
// TODO: Support builtin atomics. For example, https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html
811
// DFSan instrumentation pass cannot identify builtin callsites yet.
912

compiler-rt/test/lit.common.cfg.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,16 @@ def is_windows_lto_supported():
965965
else:
966966
config.available_features.add("memprof-shadow-scale-3")
967967

968+
def target_page_size():
969+
try:
970+
proc = subprocess.Popen(f"{emulator or ""} python3", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
971+
out, err = proc.communicate(b'import os; print(os.sysconf("SC_PAGESIZE"))')
972+
return int(out)
973+
except:
974+
return 4096
975+
976+
config.available_features.add(f"page-size-{target_page_size()}")
977+
968978
if config.expensive_checks:
969979
config.available_features.add("expensive_checks")
970980

compiler-rt/test/msan/dtls_test.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
1212
// Reports use-of-uninitialized-value, not analyzed
1313
XFAIL: target={{.*netbsd.*}}
14+
XFAIL: aarch64-target-arch
1415
1516
*/
1617

compiler-rt/test/sanitizer_common/TestCases/Linux/odd_stack_size.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %clangxx -O1 %s -o %t && %run %t
2+
// REQUIRES: page-size-4096
23
// UNSUPPORTED: android
34

45
// Fail on powerpc64 bots with:

compiler-rt/test/sanitizer_common/TestCases/Linux/release_to_os_test.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
// FIXME: This mode uses 32bit allocator without purge.
1212
// UNSUPPORTED: hwasan-aliasing
1313

14+
// Page size is hardcoded below, but test still fails even if not hardcoded.
15+
// REQUIRES: page-size-4096
16+
1417
#include <algorithm>
1518
#include <assert.h>
1619
#include <fcntl.h>

compiler-rt/test/sanitizer_common/TestCases/Linux/resize_tls_dynamic.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
// FIXME: Investigate
1212
// UNSUPPORTED: target=powerpc64{{.*}}
1313

14+
// Fails because AArch64 uses TLSDESC instead of __tls_get_addr.
15+
// UNSUPPORTED: aarch64-target-arch
16+
1417
#include <string.h>
1518

1619
#ifndef BUILD_DSO

0 commit comments

Comments
 (0)