Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions compiler-rt/lib/radsan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ set(RADSAN_CXX_SOURCES
radsan.cpp
radsan_context.cpp
radsan_stack.cpp
radsan_interceptors.cpp
radsan_user_interface.cpp)
radsan_interceptors.cpp)

set(RADSAN_PREINIT_SOURCES
radsan_preinit.cpp)
Expand Down
14 changes: 6 additions & 8 deletions compiler-rt/lib/radsan/radsan_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <sanitizer_common/sanitizer_allocator_internal.h>
#include <sanitizer_common/sanitizer_stacktrace.h>

#include <new>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
Expand All @@ -29,10 +30,7 @@ void internalFree(void *ptr) { InternalFree(ptr); }

namespace radsan {

Context::Context() : Context(createErrorActionGetter()) {}

Context::Context(std::function<OnErrorAction()> get_error_action)
: get_error_action_(get_error_action) {}
Context::Context() = default;

void Context::realtimePush() { realtime_depth_++; }

Expand All @@ -46,10 +44,10 @@ void Context::expectNotRealtime(const char *intercepted_function_name) {
if (inRealtimeContext() && !isBypassed()) {
bypassPush();
printDiagnostics(intercepted_function_name);
if (get_error_action_() == OnErrorAction::ExitWithFailure) {
exit(EXIT_FAILURE);
}
bypassPop();

// TODO: re-implement "continue" with normal sanitizer options
exit(EXIT_FAILURE);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now just die without any option to do anything otherwise. This is a loss of functionality in favor of getting C back up and running. I also think this is the most reasonable default of the modes we have right now

// bypassPop();
}
}

Expand Down
6 changes: 0 additions & 6 deletions compiler-rt/lib/radsan/radsan_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@

#pragma once

#include <radsan/radsan_user_interface.h>

#include <functional>

namespace radsan {

class Context {
public:
Context();
Context(std::function<OnErrorAction()> get_error_action);

void realtimePush();
void realtimePop();
Expand All @@ -34,7 +29,6 @@ class Context {

int realtime_depth_{0};
int bypass_depth_{0};
std::function<OnErrorAction()> get_error_action_;
};

Context &getContextForThisThread();
Expand Down
55 changes: 0 additions & 55 deletions compiler-rt/lib/radsan/radsan_user_interface.cpp

This file was deleted.

14 changes: 0 additions & 14 deletions compiler-rt/lib/radsan/radsan_user_interface.h

This file was deleted.

11 changes: 0 additions & 11 deletions compiler-rt/lib/radsan/tests/radsan_test_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "radsan_test_utilities.h"

#include "radsan_context.h"
#include "radsan_user_interface.h"

TEST(TestRadsanContext, canCreateContext) { auto context = radsan::Context{}; }

Expand Down Expand Up @@ -68,14 +67,4 @@ TEST(TestRadsanContext,
}

TEST(TestRadsanContext, onlyDiesIfExitWithFailureReturnedFromUser) {
auto fake_action = radsan::OnErrorAction::Continue;
auto action_getter = [&fake_action]() { return fake_action; };

auto context = radsan::Context{action_getter};
context.realtimePush();

context.expectNotRealtime("do_some_stuff_expecting_continue");

fake_action = radsan::OnErrorAction::ExitWithFailure;
EXPECT_DEATH(context.expectNotRealtime("do_some_stuff_expecting_exit"), "");
}
4 changes: 2 additions & 2 deletions compiler-rt/test/radsan/TestCases/test_continue_mode.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %clangxx -fsanitize=realtime %s -o %t
// RUN: env RADSAN_ERROR_MODE=continue %run %t 2>&1 | FileCheck %s
// RUN: not env %run %t 2>&1 | FileCheck %s
// UNSUPPORTED: ios

// Intent: Ensure that Continue mode does not exit on the first violation.
Expand All @@ -8,6 +8,7 @@
// aka "not env RADSAN_ERROR_MODE=continue %run %t 2>&1 | FileCheck %s"
// but running in continue mode does not exit non-zero
// https://trello.com/c/vNaKEFty/66-running-in-mode-continue-does-not-exit-non-zero-to-indicate-error
// This test doesn't even currently support "continue mode" because of the c fiasco
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It goes without saying this test is now not doing much


#include <stdlib.h>

Expand All @@ -29,5 +30,4 @@ int main() {
return 0;
// CHECK: {{.*Real-time violation.*}}
// CHECK: {{.*malloc*}}
// CHECK: {{.*free*}}
}