Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
e55d896
Clean out temp files in test fixture SetUp too
davidtrevelyan Jun 1, 2024
a4fc510
One round of renaming
cjappl May 7, 2024
57532bb
Another round of style cleanups
cjappl May 7, 2024
4668153
more auto removal, more case fixing
cjappl May 7, 2024
1292476
Missing end of namespace comment
cjappl May 7, 2024
47c7b7b
Fix one naming issue
cjappl May 8, 2024
ddd5179
No more unistd
cjappl May 13, 2024
fab7170
Radsan context moved to impl
cjappl May 13, 2024
3de5ba9
Promise lit tests later
cjappl May 13, 2024
f46daf4
Move radsan_test and add helper comment to top of file
cjappl May 13, 2024
07483d3
Only link radsan statically
cjappl May 13, 2024
605e53d
Fix comments in radsan.h
cjappl May 15, 2024
5976e98
Replace inlined exit with selected action stub
davidtrevelyan May 16, 2024
11ecbcb
Codeowners
cjappl May 16, 2024
519e0c7
Fix python formatting errors
cjappl May 16, 2024
7864f16
Fix cpp style issues
cjappl May 16, 2024
77ee4a8
PR: Delete python header comment
cjappl May 20, 2024
d786168
PR: Change main namespace name to __radsan
cjappl May 20, 2024
ce7df2e
PR: Fix stack trace namespace
cjappl May 20, 2024
e784b87
PR: Fix incorrect C++ style comments
cjappl May 20, 2024
8c95990
PR: Prefix external API with dunderscores
cjappl May 20, 2024
ec71e55
PR: Fix variable naming cases for variables, leave lambdas for now
cjappl May 20, 2024
18da2b4
PR: Fix style nit
cjappl May 20, 2024
d7c3337
PR: Fix small style fallout
cjappl May 20, 2024
7cddba8
Update comment and TU-local function style
davidtrevelyan May 21, 2024
9be12a9
PR: Remove too early inclusion of sanitizer common lit tests
cjappl May 21, 2024
c9accb3
Test failure: fix initialization of pthread_cond_t
cjappl May 30, 2024
0934d34
Test failure: Try again with initialization of pthread_cond_t
cjappl May 30, 2024
b1fb268
Fix code formatting on unit test
cjappl May 30, 2024
69d81c6
Ensure all pthread_cond_t are initialized in unit tests
cjappl May 30, 2024
d30cc80
Fix issue where CREAT flag was not properly passing mode (#23)
cjappl May 31, 2024
2f84934
Fix issue where fcntl was not using last arg correctly (#24)
cjappl May 31, 2024
4197052
Introduce test fixture for temporary files (#25)
cjappl Jun 1, 2024
3a562d5
Rename RADSan to RTSan
davidtrevelyan Jun 3, 2024
84f4b06
First working rtsan driver tests
cjappl Jun 5, 2024
8f671be
Add linux working test
cjappl Jun 5, 2024
1073294
Another test for openBSD
cjappl Jun 5, 2024
3fa642a
Add feature for realtime sanitizer, add incompatible sanitizers
cjappl Jun 5, 2024
62d2149
More incompatabilities added
cjappl Jun 5, 2024
4ddf290
rtsan tests to fsanitize
cjappl Jun 5, 2024
9ab67b2
Deleted rtsan.c
cjappl Jun 5, 2024
89c0f83
Code formatting
cjappl Jun 5, 2024
8bb9fd3
Fix python styling
cjappl Jun 26, 2024
0f4a241
PR: Get rid of clang components only leave compiler-rt
cjappl Jul 3, 2024
428e17e
PR: MaskRay comments
cjappl Jul 3, 2024
ef8bc6b
A few pieces of cruft from the rebase/merge
cjappl Jul 9, 2024
403acd0
Revert "PR: Get rid of clang components only leave compiler-rt"
cjappl Jul 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions clang/include/clang/Basic/Features.def
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ FEATURE(memory_sanitizer,
FEATURE(thread_sanitizer, LangOpts.Sanitize.has(SanitizerKind::Thread))
FEATURE(dataflow_sanitizer, LangOpts.Sanitize.has(SanitizerKind::DataFlow))
FEATURE(scudo, LangOpts.Sanitize.hasOneOf(SanitizerKind::Scudo))
FEATURE(realtime_sanitizer, LangOpts.Sanitize.hasOneOf(SanitizerKind::Realtime))
FEATURE(ptrauth_intrinsics, LangOpts.PointerAuthIntrinsics)
FEATURE(ptrauth_calls, LangOpts.PointerAuthCalls)
FEATURE(ptrauth_returns, LangOpts.PointerAuthReturns)
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Driver/SanitizerArgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class SanitizerArgs {
bool needsStableAbi() const { return StableABI; }

bool needsMemProfRt() const { return NeedsMemProfRt; }
bool needsRadsanRt() const { return Sanitizers.has(SanitizerKind::Realtime); }
bool needsRtsanRt() const { return Sanitizers.has(SanitizerKind::Realtime); }
bool needsAsanRt() const { return Sanitizers.has(SanitizerKind::Address); }
bool needsHwasanRt() const {
return Sanitizers.has(SanitizerKind::HWAddress);
Expand Down
13 changes: 8 additions & 5 deletions clang/lib/Driver/SanitizerArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,11 +552,14 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
SanitizerKind::Leak | SanitizerKind::Thread |
SanitizerKind::Memory | SanitizerKind::KernelAddress |
SanitizerKind::Scudo | SanitizerKind::SafeStack),
std::make_pair(SanitizerKind::MemTag,
SanitizerKind::Address | SanitizerKind::KernelAddress |
SanitizerKind::HWAddress |
SanitizerKind::KernelHWAddress),
std::make_pair(SanitizerKind::KCFI, SanitizerKind::Function)};
std::make_pair(SanitizerKind::MemTag, SanitizerKind::Address |
SanitizerKind::KernelAddress |
SanitizerKind::HWAddress |
SanitizerKind::KernelHWAddress),
std::make_pair(SanitizerKind::KCFI, SanitizerKind::Function),
std::make_pair(SanitizerKind::Realtime,
SanitizerKind::Address | SanitizerKind::Thread |
SanitizerKind::Undefined | SanitizerKind::Memory)};
// Enable toolchain specific default sanitizers if not explicitly disabled.
SanitizerMask Default = TC.getDefaultSanitizers() & ~AllRemove;

Expand Down
7 changes: 2 additions & 5 deletions clang/lib/Driver/ToolChains/CommonArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1439,8 +1439,6 @@ collectSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
if (!Args.hasArg(options::OPT_shared))
HelperStaticRuntimes.push_back("hwasan-preinit");
}
if (SanArgs.needsRadsanRt() && SanArgs.linkRuntimes())
SharedRuntimes.push_back("radsan");
}

// The stats_client library is also statically linked into DSOs.
Expand All @@ -1466,9 +1464,8 @@ collectSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
StaticRuntimes.push_back("asan_cxx");
}

if (!SanArgs.needsSharedRt() && SanArgs.needsRadsanRt() && SanArgs.linkRuntimes()) {
StaticRuntimes.push_back("radsan");
}
if (!SanArgs.needsSharedRt() && SanArgs.needsRtsanRt())
StaticRuntimes.push_back("rtsan");

if (!SanArgs.needsSharedRt() && SanArgs.needsMemProfRt()) {
StaticRuntimes.push_back("memprof");
Expand Down
10 changes: 5 additions & 5 deletions clang/lib/Driver/ToolChains/Darwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1496,7 +1496,7 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
const char *sanitizer = nullptr;
if (Sanitize.needsUbsanRt()) {
sanitizer = "UndefinedBehaviorSanitizer";
} else if (Sanitize.needsRadsanRt()) {
} else if (Sanitize.needsRtsanRt()) {
sanitizer = "RealtimeSanitizer";
} else if (Sanitize.needsAsanRt()) {
sanitizer = "AddressSanitizer";
Expand All @@ -1520,10 +1520,10 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
AddLinkSanitizerLibArgs(Args, CmdArgs, "asan");
}
}
if(Sanitize.needsRadsanRt())
{
assert(Sanitize.needsSharedRt() && "Static sanitizer runtimes not supported");
AddLinkSanitizerLibArgs(Args, CmdArgs, "radsan");
if (Sanitize.needsRtsanRt()) {
assert(Sanitize.needsSharedRt() &&
"Static sanitizer runtimes not supported");
AddLinkSanitizerLibArgs(Args, CmdArgs, "rtsan");
}
if (Sanitize.needsLsanRt())
AddLinkSanitizerLibArgs(Args, CmdArgs, "lsan");
Expand Down
2 changes: 1 addition & 1 deletion clang/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND EXISTS ${COMPILER_RT_SRC_ROOT}/)
check-lsan
check-msan
check-profile
check-radsan
check-rtsan
check-safestack
check-sanitizer
check-tsan
Expand Down
47 changes: 47 additions & 0 deletions clang/test/Driver/fsanitize.c
Original file line number Diff line number Diff line change
Expand Up @@ -1038,3 +1038,50 @@
// RUN: not %clang --target=aarch64-none-elf -fsanitize=dataflow %s -### 2>&1 | FileCheck %s -check-prefix=UNSUPPORTED-BAREMETAL
// RUN: not %clang --target=arm-arm-none-eabi -fsanitize=shadow-call-stack %s -### 2>&1 | FileCheck %s -check-prefix=UNSUPPORTED-BAREMETAL
// UNSUPPORTED-BAREMETAL: unsupported option '-fsanitize={{.*}}' for target

// RUN: %clang --target=x86_64-apple-darwin -fsanitize=realtime %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-RTSAN-X86-64-DARWIN
// CHECK-RTSAN-X86-64-DARWIN-NOT: unsupported option

// RUN: %clang --target=x86_64-apple-darwin -fsanitize=realtime %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-RTSAN-X86-64-DARWIN
// CHECK-RTSAN-X86-64-DARWIN-NOT: unsupported option
// RUN: %clang --target=x86_64-apple-macos -fsanitize=realtime %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-RTSAN-X86-64-MACOS
// CHECK-RTSAN-X86-64-MACOS-NOT: unsupported option
// RUN: %clang --target=arm64-apple-macos -fsanitize=realtime %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-RTSAN-ARM64-MACOS
// CHECK-RTSAN-ARM64-MACOS-NOT: unsupported option

// RUN: %clang --target=arm64-apple-ios-simulator -fsanitize=realtime %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-RTSAN-ARM64-IOSSIMULATOR
// CHECK-RTSAN-ARM64-IOSSIMULATOR-NOT: unsupported option

// RUN: %clang --target=arm64-apple-watchos-simulator -fsanitize=realtime %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-RTSAN-ARM64-WATCHOSSIMULATOR
// CHECK-RTSAN-ARM64-WATCHOSSIMULATOR-NOT: unsupported option

// RUN: %clang --target=arm64-apple-tvos-simulator -fsanitize=realtime %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-RTSAN-ARM64-TVOSSIMULATOR
// CHECK-RTSAN-ARM64-TVOSSIMULATOR-NOT: unsupported option

// RUN: %clang --target=x86_64-apple-ios-simulator -fsanitize=realtime %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-RTSAN-X86-64-IOSSIMULATOR
// CHECK-RTSAN-X86-64-IOSSIMULATOR-NOT: unsupported option

// RUN: %clang --target=x86_64-apple-watchos-simulator -fsanitize=realtime %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-RTSAN-X86-64-WATCHOSSIMULATOR
// CHECK-RTSAN-X86-64-WATCHOSSIMULATOR-NOT: unsupported option

// RUN: %clang --target=x86_64-apple-tvos-simulator -fsanitize=realtime %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-RTSAN-X86-64-TVOSSIMULATOR
// CHECK-RTSAN-X86-64-TVOSSIMULATOR-NOT: unsupported option

// RUN: %clang --target=x86_64-linux-gnu -fsanitize=realtime %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-RTSAN-X86-64-LINUX
// CHECK-RTSAN-X86-64-LINUX-NOT: unsupported option

// RUN: not %clang --target=i386-pc-openbsd -fsanitize=realtime %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-RTSAN-OPENBSD
// CHECK-RTSAN-OPENBSD: unsupported option '-fsanitize=realtime' for target 'i386-pc-openbsd'

// RUN: not %clang --target=x86_64-linux-gnu -fsanitize=realtime,thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-REALTIME-TSAN
// CHECK-REALTIME-TSAN: error: invalid argument '-fsanitize=realtime' not allowed with '-fsanitize=thread'

// RUN: not %clang --target=x86_64-linux-gnu -fsanitize=realtime,address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-REALTIME-ASAN
// CHECK-REALTIME-ASAN: error: invalid argument '-fsanitize=realtime' not allowed with '-fsanitize=address'

// RUN: not %clang --target=x86_64-linux-gnu -fsanitize=realtime,memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-REALTIME-MSAN
// CHECK-REALTIME-MSAN: error: invalid argument '-fsanitize=realtime' not allowed with '-fsanitize=memory'

// RUN: not %clang --target=x86_64-linux-gnu -fsanitize=realtime,undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-REALTIME-UBSAN
// CHECK-REALTIME-UBSAN: error: invalid argument '-fsanitize=realtime' not allowed with '-fsanitize=undefined'

4 changes: 4 additions & 0 deletions compiler-rt/CODE_OWNERS.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,7 @@ D: ThreadSanitizer
N: Bill Wendling
E: [email protected]
D: Profile runtime library

N: Christopher Apple, David Trevelyan
E: [email protected], [email protected]
D: Realtime Sanitizer (RTSan)
2 changes: 1 addition & 1 deletion compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
${LOONGARCH64})
set(ALL_ASAN_ABI_SUPPORTED_ARCH ${X86_64} ${ARM64} ${ARM64_32})
set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64} ${LOONGARCH64})
set(ALL_RADSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
set(ALL_RTSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON}
${LOONGARCH64})

Expand Down
16 changes: 8 additions & 8 deletions compiler-rt/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ if(APPLE)
set(MIN_OSX_VERSION ${DEFAULT_SANITIZER_MIN_OSX_VERSION})
endif()

# Note: In order to target x86_64h on OS X the minimum deployment target must
# Note: In order to target x86_64h on OS X the minimum deployment target must
# be 10.8 or higher.
if(MIN_OSX_VERSION VERSION_LESS "10.7")
message(FATAL_ERROR "macOS deployment target '${SANITIZER_MIN_OSX_VERSION}' is too old.")
Expand Down Expand Up @@ -597,8 +597,8 @@ if(APPLE)
list_intersect(ASAN_SUPPORTED_ARCH
ALL_ASAN_SUPPORTED_ARCH
SANITIZER_COMMON_SUPPORTED_ARCH)
list_intersect(RADSAN_SUPPORTED_ARCH
ALL_RADSAN_SUPPORTED_ARCH
list_intersect(RTSAN_SUPPORTED_ARCH
ALL_RTSAN_SUPPORTED_ARCH
SANITIZER_COMMON_SUPPORTED_ARCH)
list_intersect(DFSAN_SUPPORTED_ARCH
ALL_DFSAN_SUPPORTED_ARCH
Expand Down Expand Up @@ -666,7 +666,7 @@ else()
filter_available_targets(UBSAN_COMMON_SUPPORTED_ARCH
${SANITIZER_COMMON_SUPPORTED_ARCH})
filter_available_targets(ASAN_SUPPORTED_ARCH ${ALL_ASAN_SUPPORTED_ARCH})
filter_available_targets(RADSAN_SUPPORTED_ARCH ${ALL_RADSAN_SUPPORTED_ARCH})
filter_available_targets(RTSAN_SUPPORTED_ARCH ${ALL_RTSAN_SUPPORTED_ARCH})
filter_available_targets(FUZZER_SUPPORTED_ARCH ${ALL_FUZZER_SUPPORTED_ARCH})
filter_available_targets(DFSAN_SUPPORTED_ARCH ${ALL_DFSAN_SUPPORTED_ARCH})
filter_available_targets(LSAN_SUPPORTED_ARCH ${ALL_LSAN_SUPPORTED_ARCH})
Expand Down Expand Up @@ -720,7 +720,7 @@ if(COMPILER_RT_SUPPORTED_ARCH)
endif()
message(STATUS "Compiler-RT supported architectures: ${COMPILER_RT_SUPPORTED_ARCH}")

set(ALL_SANITIZERS asan;radsan;dfsan;msan;hwasan;tsan;safestack;cfi;scudo_standalone;ubsan_minimal;gwp_asan;nsan;asan_abi)
set(ALL_SANITIZERS asan;rtsan;dfsan;msan;hwasan;tsan;safestack;cfi;scudo_standalone;ubsan_minimal;gwp_asan;nsan;asan_abi)
set(COMPILER_RT_SANITIZERS_TO_BUILD all CACHE STRING
"sanitizers to build if supported on the target (all;${ALL_SANITIZERS})")
list_replace(COMPILER_RT_SANITIZERS_TO_BUILD all "${ALL_SANITIZERS}")
Expand Down Expand Up @@ -751,10 +751,10 @@ else()
set(COMPILER_RT_HAS_ASAN FALSE)
endif()

if (COMPILER_RT_HAS_SANITIZER_COMMON AND RADSAN_SUPPORTED_ARCH)
set(COMPILER_RT_HAS_RADSAN TRUE)
if (COMPILER_RT_HAS_SANITIZER_COMMON AND RTSAN_SUPPORTED_ARCH)
set(COMPILER_RT_HAS_RTSAN TRUE)
else()
set(COMPILER_RT_HAS_RADSAN FALSE)
set(COMPILER_RT_HAS_RTSAN FALSE)
endif()

if (OS_NAME MATCHES "Linux|FreeBSD|Windows|NetBSD|SunOS")
Expand Down
92 changes: 0 additions & 92 deletions compiler-rt/lib/radsan/CMakeLists.txt

This file was deleted.

32 changes: 0 additions & 32 deletions compiler-rt/lib/radsan/radsan.cpp

This file was deleted.

Loading