forked from OSchip/llvm-project
[scudo] Remove disableMemoryTagChecksTestOnly
And replace with ScopedDisableMemoryTagChecks. Differential Revision: https://reviews.llvm.org/D103708
This commit is contained in:
parent
72177e9fa5
commit
39f928ed01
|
@ -116,22 +116,6 @@ inline void enableSystemMemoryTaggingTestOnly() {
|
|||
|
||||
#endif // SCUDO_LINUX
|
||||
|
||||
inline void disableMemoryTagChecksTestOnly() {
|
||||
__asm__ __volatile__(
|
||||
R"(
|
||||
.arch_extension memtag
|
||||
msr tco, #1
|
||||
)");
|
||||
}
|
||||
|
||||
inline void enableMemoryTagChecksTestOnly() {
|
||||
__asm__ __volatile__(
|
||||
R"(
|
||||
.arch_extension memtag
|
||||
msr tco, #0
|
||||
)");
|
||||
}
|
||||
|
||||
class ScopedDisableMemoryTagChecks {
|
||||
uptr PrevTCO;
|
||||
|
||||
|
@ -279,14 +263,6 @@ inline void enableSystemMemoryTaggingTestOnly() {
|
|||
UNREACHABLE("memory tagging not supported");
|
||||
}
|
||||
|
||||
inline void disableMemoryTagChecksTestOnly() {
|
||||
UNREACHABLE("memory tagging not supported");
|
||||
}
|
||||
|
||||
inline void enableMemoryTagChecksTestOnly() {
|
||||
UNREACHABLE("memory tagging not supported");
|
||||
}
|
||||
|
||||
struct ScopedDisableMemoryTagChecks {
|
||||
ScopedDisableMemoryTagChecks() {}
|
||||
};
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "memtag.h"
|
||||
#include "tests/scudo_unit_test.h"
|
||||
|
||||
#include "allocator_config.h"
|
||||
|
@ -398,7 +399,7 @@ SCUDO_TYPED_TEST(ScudoCombinedTest, DisableMemoryTagging) {
|
|||
// Check that disabling memory tagging works correctly.
|
||||
void *P = Allocator->allocate(2048, Origin);
|
||||
EXPECT_DEATH(reinterpret_cast<char *>(P)[2048] = 0xaa, "");
|
||||
scudo::disableMemoryTagChecksTestOnly();
|
||||
scudo::ScopedDisableMemoryTagChecks NoTagChecks;
|
||||
Allocator->disableMemoryTagging();
|
||||
reinterpret_cast<char *>(P)[2048] = 0xaa;
|
||||
Allocator->deallocate(P, Origin);
|
||||
|
@ -409,10 +410,6 @@ SCUDO_TYPED_TEST(ScudoCombinedTest, DisableMemoryTagging) {
|
|||
Allocator->deallocate(P, Origin);
|
||||
|
||||
Allocator->releaseToOS();
|
||||
|
||||
// Disabling memory tag checks may interfere with subsequent tests.
|
||||
// Re-enable them now.
|
||||
scudo::enableMemoryTagChecksTestOnly();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue