summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libartbase/base/mem_map.cc20
-rw-r--r--libartbase/base/mem_map_test.cc5
-rw-r--r--runtime/exec_utils_test.cc42
-rw-r--r--runtime/native_stack_dump.cc5
4 files changed, 22 insertions, 50 deletions
diff --git a/libartbase/base/mem_map.cc b/libartbase/base/mem_map.cc
index 9ba1d6c139..d53480d4ca 100644
--- a/libartbase/base/mem_map.cc
+++ b/libartbase/base/mem_map.cc
@@ -647,21 +647,11 @@ void MemMap::MadviseDontNeedAndZero() {
}
bool MemMap::Sync() {
- bool result;
- if (redzone_size_ != 0) {
- // To avoid errors when running on a memory tool, temporarily lift the lower-end noaccess
- // protection before passing it to msync() as it only accepts page-aligned base address,
- // and exclude the higher-end noaccess protection from the msync range. b/27552451.
- // TODO: Valgrind is no longer supported, but Address Sanitizer is:
- // check whether this special case is needed for ASan.
- uint8_t* base_begin = reinterpret_cast<uint8_t*>(base_begin_);
- MEMORY_TOOL_MAKE_DEFINED(base_begin, begin_ - base_begin);
- result = msync(BaseBegin(), End() - base_begin, MS_SYNC) == 0;
- MEMORY_TOOL_MAKE_NOACCESS(base_begin, begin_ - base_begin);
- } else {
- result = msync(BaseBegin(), BaseSize(), MS_SYNC) == 0;
- }
- return result;
+ // Historical note: To avoid Valgrind errors, we temporarily lifted the lower-end noaccess
+ // protection before passing it to msync() when `redzone_size_` was non-null, as Valgrind
+ // only accepts page-aligned base address, and excludes the higher-end noaccess protection
+ // from the msync range. b/27552451.
+ return msync(BaseBegin(), BaseSize(), MS_SYNC) == 0;
}
bool MemMap::Protect(int prot) {
diff --git a/libartbase/base/mem_map_test.cc b/libartbase/base/mem_map_test.cc
index 4a78bdcabe..c575c7a31f 100644
--- a/libartbase/base/mem_map_test.cc
+++ b/libartbase/base/mem_map_test.cc
@@ -471,9 +471,8 @@ TEST_F(MemMapTest, MapAnonymousExactAddr32bitHighAddr) {
// cannot allocate in the 2GB-4GB region.
TEST_DISABLED_FOR_MIPS();
- // This test may not work under Valgrind.
- // TODO: Valgrind is no longer supported, but Address Sanitizer is:
- // check whether this test works with ASan.
+ // This test does not work under AddressSanitizer.
+ // Historical note: This test did not work under Valgrind either.
TEST_DISABLED_FOR_MEMORY_TOOL();
CommonInit();
diff --git a/runtime/exec_utils_test.cc b/runtime/exec_utils_test.cc
index a9c1ea2ae0..c138ce3f9e 100644
--- a/runtime/exec_utils_test.cc
+++ b/runtime/exec_utils_test.cc
@@ -36,12 +36,9 @@ TEST_F(ExecUtilsTest, ExecSuccess) {
command.push_back("/usr/bin/id");
}
std::string error_msg;
- if (!(kRunningOnMemoryTool && kMemoryToolDetectsLeaks)) {
- // Running on Valgrind fails due to some memory that leaks in thread alternate signal stacks.
- // TODO: Valgrind is no longer supported, but Address Sanitizer is:
- // check whether the following code works with ASan.
- EXPECT_TRUE(Exec(command, &error_msg));
- }
+ // Historical note: Running on Valgrind failed due to some memory
+ // that leaks in thread alternate signal stacks.
+ EXPECT_TRUE(Exec(command, &error_msg));
EXPECT_EQ(0U, error_msg.size()) << error_msg;
}
@@ -52,13 +49,10 @@ TEST_F(ExecUtilsTest, ExecError) {
std::vector<std::string> command;
command.push_back("bogus");
std::string error_msg;
- if (!(kRunningOnMemoryTool && kMemoryToolDetectsLeaks)) {
- // Running on Valgrind fails due to some memory that leaks in thread alternate signal stacks.
- // TODO: Valgrind is no longer supported, but Address Sanitizer is:
- // check whether the following code works with ASan.
- EXPECT_FALSE(Exec(command, &error_msg));
- EXPECT_FALSE(error_msg.empty());
- }
+ // Historical note: Running on Valgrind failed due to some memory
+ // that leaks in thread alternate signal stacks.
+ EXPECT_FALSE(Exec(command, &error_msg));
+ EXPECT_FALSE(error_msg.empty());
}
TEST_F(ExecUtilsTest, EnvSnapshotAdditionsAreNotVisible) {
@@ -76,13 +70,10 @@ TEST_F(ExecUtilsTest, EnvSnapshotAdditionsAreNotVisible) {
}
command.push_back(kModifiedVariable);
std::string error_msg;
- if (!(kRunningOnMemoryTool && kMemoryToolDetectsLeaks)) {
- // Running on Valgrind fails due to some memory that leaks in thread alternate signal stacks.
- // TODO: Valgrind is no longer supported, but Address Sanitizer is:
- // check whether the following code works with ASan.
- EXPECT_FALSE(Exec(command, &error_msg));
- EXPECT_NE(0U, error_msg.size()) << error_msg;
- }
+ // Historical note: Running on Valgrind failed due to some memory
+ // that leaks in thread alternate signal stacks.
+ EXPECT_FALSE(Exec(command, &error_msg));
+ EXPECT_NE(0U, error_msg.size()) << error_msg;
}
TEST_F(ExecUtilsTest, EnvSnapshotDeletionsAreNotVisible) {
@@ -103,13 +94,10 @@ TEST_F(ExecUtilsTest, EnvSnapshotDeletionsAreNotVisible) {
}
command.push_back(kDeletedVariable);
std::string error_msg;
- if (!(kRunningOnMemoryTool && kMemoryToolDetectsLeaks)) {
- // Running on Valgrind fails due to some memory that leaks in thread alternate signal stacks.
- // TODO: Valgrind is no longer supported, but Address Sanitizer is:
- // check whether the following code works with ASan.
- EXPECT_TRUE(Exec(command, &error_msg));
- EXPECT_EQ(0U, error_msg.size()) << error_msg;
- }
+ // Historical note: Running on Valgrind failed due to some memory
+ // that leaks in thread alternate signal stacks.
+ EXPECT_TRUE(Exec(command, &error_msg));
+ EXPECT_EQ(0U, error_msg.size()) << error_msg;
// Restore the variable's value.
EXPECT_EQ(setenv(kDeletedVariable, save_value, kOverwrite), 0);
}
diff --git a/runtime/native_stack_dump.cc b/runtime/native_stack_dump.cc
index b3a47c3053..ce295aacde 100644
--- a/runtime/native_stack_dump.cc
+++ b/runtime/native_stack_dump.cc
@@ -290,11 +290,6 @@ void DumpNativeStack(std::ostream& os,
void* ucontext_ptr,
bool skip_frames) {
// Historical note: This was disabled when running under Valgrind (b/18119146).
- // TODO: Valgrind is no longer supported, but Address Sanitizer is:
- // check whether this test works with ASan.
- if (kRunningOnMemoryTool) {
- return;
- }
BacktraceMap* map = existing_map;
std::unique_ptr<BacktraceMap> tmp_map;