Skip to content

Commit a1e9b7e

Browse files
authored
Revert "[clang][rtsan] Introduce realtime sanitizer codegen and drive… (llvm#105744)
…r (llvm#102622)" This reverts commit d010ec6. Build failure: https://lab.llvm.org/buildbot/#/builders/159/builds/4466
1 parent 911e246 commit a1e9b7e

16 files changed

+5
-208
lines changed

clang/docs/RealtimeSanitizer.rst

Lines changed: 0 additions & 85 deletions
This file was deleted.

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -454,11 +454,6 @@ Moved checkers
454454

455455
Sanitizers
456456
----------
457-
- Introduced Realtime Sanitizer, activated by using the -fsanitize=realtime
458-
flag. This sanitizer detects unsafe system library calls, such as memory
459-
allocations and mutex locks. If any such function is called during invocation
460-
of a function marked with the ``[[clang::nonblocking]]`` attribute, an error
461-
is printed to the console and the process exits non-zero.
462457

463458
- Added the ``-fsanitize-undefined-ignore-overflow-pattern`` flag which can be
464459
used to disable specific overflow-dependent code patterns. The supported

clang/docs/UsersManual.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,8 +2068,6 @@ are listed below.
20682068
integrity.
20692069
- ``-fsanitize=safe-stack``: :doc:`safe stack <SafeStack>`
20702070
protection against stack-based memory corruption errors.
2071-
- ``-fsanitize=realtime``: :doc:`RealtimeSanitizer`,
2072-
a real-time safety checker.
20732071

20742072
There are more fine-grained checks available: see
20752073
the :ref:`list <ubsan-checks>` of specific kinds of

clang/docs/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ Using Clang as a Compiler
3232
UndefinedBehaviorSanitizer
3333
DataFlowSanitizer
3434
LeakSanitizer
35-
RealtimeSanitizer
3635
SanitizerCoverage
3736
SanitizerStats
3837
SanitizerSpecialCaseList

clang/include/clang/Basic/Sanitizers.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ SANITIZER("thread", Thread)
7979
// Numerical stability sanitizer.
8080
SANITIZER("numerical", NumericalStability)
8181

82-
// RealtimeSanitizer
83-
SANITIZER("realtime", Realtime)
84-
8582
// LeakSanitizer
8683
SANITIZER("leak", Leak)
8784

clang/include/clang/Driver/SanitizerArgs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ class SanitizerArgs {
107107
bool needsNsanRt() const {
108108
return Sanitizers.has(SanitizerKind::NumericalStability);
109109
}
110-
bool needsRtsanRt() const { return Sanitizers.has(SanitizerKind::Realtime); }
111110

112111
bool hasMemTag() const {
113112
return hasMemtagHeap() || hasMemtagStack() || hasMemtagGlobals();

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
#include "llvm/Transforms/Instrumentation/MemorySanitizer.h"
7979
#include "llvm/Transforms/Instrumentation/NumericalStabilitySanitizer.h"
8080
#include "llvm/Transforms/Instrumentation/PGOInstrumentation.h"
81-
#include "llvm/Transforms/Instrumentation/RealtimeSanitizer.h"
8281
#include "llvm/Transforms/Instrumentation/SanitizerBinaryMetadata.h"
8382
#include "llvm/Transforms/Instrumentation/SanitizerCoverage.h"
8483
#include "llvm/Transforms/Instrumentation/ThreadSanitizer.h"
@@ -991,13 +990,6 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
991990
FPM.addPass(BoundsCheckingPass());
992991
});
993992

994-
if (LangOpts.Sanitize.has(SanitizerKind::Realtime))
995-
PB.registerScalarOptimizerLateEPCallback(
996-
[](FunctionPassManager &FPM, OptimizationLevel Level) {
997-
RealtimeSanitizerOptions Opts;
998-
FPM.addPass(RealtimeSanitizerPass(Opts));
999-
});
1000-
1001993
// Don't add sanitizers if we are here from ThinLTO PostLink. That already
1002994
// done on PreLink stage.
1003995
if (!IsThinLTOPostLink) {

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -845,13 +845,6 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
845845
if (SanOpts.has(SanitizerKind::ShadowCallStack))
846846
Fn->addFnAttr(llvm::Attribute::ShadowCallStack);
847847

848-
if (SanOpts.has(SanitizerKind::Realtime))
849-
if (FD && FD->getASTContext().hasAnyFunctionEffects())
850-
for (const FunctionEffectWithCondition &Fe : FD->getFunctionEffects()) {
851-
if (Fe.Effect.kind() == FunctionEffect::Kind::NonBlocking)
852-
Fn->addFnAttr(llvm::Attribute::SanitizeRealtime);
853-
}
854-
855848
// Apply fuzzing attribute to the function.
856849
if (SanOpts.hasOneOf(SanitizerKind::Fuzzer | SanitizerKind::FuzzerNoLink))
857850
Fn->addFnAttr(llvm::Attribute::OptForFuzzing);

clang/lib/Driver/SanitizerArgs.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -558,15 +558,11 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
558558
SanitizerKind::Leak | SanitizerKind::Thread |
559559
SanitizerKind::Memory | SanitizerKind::KernelAddress |
560560
SanitizerKind::Scudo | SanitizerKind::SafeStack),
561-
std::make_pair(SanitizerKind::MemTag, SanitizerKind::Address |
562-
SanitizerKind::KernelAddress |
563-
SanitizerKind::HWAddress |
564-
SanitizerKind::KernelHWAddress),
565-
std::make_pair(SanitizerKind::KCFI, SanitizerKind::Function),
566-
std::make_pair(SanitizerKind::Realtime,
567-
SanitizerKind::Address | SanitizerKind::Thread |
568-
SanitizerKind::Undefined | SanitizerKind::Memory)};
569-
561+
std::make_pair(SanitizerKind::MemTag,
562+
SanitizerKind::Address | SanitizerKind::KernelAddress |
563+
SanitizerKind::HWAddress |
564+
SanitizerKind::KernelHWAddress),
565+
std::make_pair(SanitizerKind::KCFI, SanitizerKind::Function)};
570566
// Enable toolchain specific default sanitizers if not explicitly disabled.
571567
SanitizerMask Default = TC.getDefaultSanitizers() & ~AllRemove;
572568

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,8 +1456,6 @@ collectSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
14561456
if (!Args.hasArg(options::OPT_shared))
14571457
HelperStaticRuntimes.push_back("hwasan-preinit");
14581458
}
1459-
if (SanArgs.needsRtsanRt() && SanArgs.linkRuntimes())
1460-
SharedRuntimes.push_back("rtsan");
14611459
}
14621460

14631461
// The stats_client library is also statically linked into DSOs.
@@ -1483,10 +1481,6 @@ collectSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
14831481
StaticRuntimes.push_back("asan_cxx");
14841482
}
14851483

1486-
if (!SanArgs.needsSharedRt() && SanArgs.needsRtsanRt() &&
1487-
SanArgs.linkRuntimes())
1488-
StaticRuntimes.push_back("rtsan");
1489-
14901484
if (!SanArgs.needsSharedRt() && SanArgs.needsMemProfRt()) {
14911485
StaticRuntimes.push_back("memprof");
14921486
if (SanArgs.linkCXXRuntimes())

0 commit comments

Comments
 (0)