[PATCH] D35779: Disable RWX mapping tests in unittests/Support/MemoryTest
Kamil Rytarowski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 23 08:54:41 PDT 2017
krytarowski created this revision.
RWX mapping is not allowed on all operating
systems (W^X restrictions).
This fixes all unexpected failures on NetBSD 8.0(beta).
RWX allocations require different interface,
AllocateRWX.
Sponsored by <The NetBSD Foundation>
Repository:
rL LLVM
https://reviews.llvm.org/D35779
Files:
unittests/Support/MemoryTest.cpp
Index: unittests/Support/MemoryTest.cpp
===================================================================
--- unittests/Support/MemoryTest.cpp
+++ unittests/Support/MemoryTest.cpp
@@ -33,9 +33,8 @@
case Memory::MF_READ|Memory::MF_WRITE:
return Memory::MF_READ|Memory::MF_WRITE;
case Memory::MF_READ|Memory::MF_EXEC:
- case Memory::MF_READ|Memory::MF_WRITE|Memory::MF_EXEC:
case Memory::MF_EXEC:
- return Memory::MF_READ|Memory::MF_WRITE|Memory::MF_EXEC;
+ return Memory::MF_READ|Memory::MF_EXEC;
}
// Default in case values are added to the enum, as required by some compilers
return Memory::MF_READ|Memory::MF_WRITE;
@@ -180,6 +179,9 @@
}
TEST_P(MappedMemoryTest, EnabledWrite) {
+ if (Flags & Memory::MF_EXEC)
+ return;
+
std::error_code EC;
MemoryBlock M1 = Memory::allocateMappedMemory(2 * sizeof(int), nullptr, Flags,
EC);
@@ -349,13 +351,13 @@
// Note that Memory::MF_WRITE is not supported exclusively across
// operating systems and architectures and can imply MF_READ|MF_WRITE
+// RWX mapping is not allowed on all operating systems (W^X restrictions)
unsigned MemoryFlags[] = {
Memory::MF_READ,
Memory::MF_WRITE,
Memory::MF_READ|Memory::MF_WRITE,
Memory::MF_EXEC,
- Memory::MF_READ|Memory::MF_EXEC,
- Memory::MF_READ|Memory::MF_WRITE|Memory::MF_EXEC
+ Memory::MF_READ|Memory::MF_EXEC
};
INSTANTIATE_TEST_CASE_P(AllocationTests,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35779.107834.patch
Type: text/x-patch
Size: 1509 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170723/76e618f5/attachment.bin>
More information about the llvm-commits
mailing list