25 lines · cpp
1// Test that sanitizers suppress mlock.2// RUN: %clang %s -o %t && %run %t3 4// No shadow, so no need to disable mlock.5// XFAIL: ubsan, lsan6 7// FIXME: Implement.8// XFAIL: hwasan9 10#include <assert.h>11#include <sys/mman.h>12 13int main() {14#if defined(__has_feature)15# if __has_feature(hwaddress_sanitizer)16 // Don't mlock, it may claim all memory.17 abort();18# endif19#endif20 assert(0 == mlockall(MCL_CURRENT));21 assert(0 == mlock((void *)0x12345, 0x5678));22 assert(0 == munlockall());23 assert(0 == munlock((void *)0x987, 0x654));24}25