[PATCH] D54080: [unittest] Skip W+X MappedMemoryTests when MPROTECT is enabled
Michał Górny via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 3 15:01:29 PDT 2018
mgorny added inline comments.
================
Comment at: unittests/Support/MemoryTest.cpp:90
+// MPROTECT prevents W+X mmaps
+#define CHECK_UNSUPPORTED() \
+ do { \
----------------
krytarowski wrote:
> I would further refactor this into:
>
> ```
> // MPROTECT prevents W+X mmaps
> #define CHECK_UNSUPPORTED(f) \
> do { \
> if ((f & (Memory::MF_WRITE | Memory::MF_EXEC)) && \
> IsMPROTECT()) \
> return; \
> } while (0)
> ```
>
> And use `CHECK_UNSUPPORTED(Flags)` or `CHECK_UNSUPPORTED(Flags | Memory::MF_WRITE)` for `EnabledWrite`.
Nah, that's too smart. Would go against KISS.
https://reviews.llvm.org/D54080
More information about the llvm-commits
mailing list