1 | // Test that sanitizers suppress mlock. |
2 | // RUN: %clang %s -o %t && %run %t |
3 | |
4 | // No shadow, so no need to disable mlock. |
5 | // XFAIL: ubsan, lsan |
6 | |
7 | // FIXME: Implement. |
8 | // XFAIL: hwasan |
9 | |
10 | #include <assert.h> |
11 | #include <sys/mman.h> |
12 | |
13 | int main() { |
14 | #if defined(__has_feature) |
15 | # if __has_feature(hwaddress_sanitizer) |
16 | // Don't mlock, it may claim all memory. |
17 | abort(); |
18 | # endif |
19 | #endif |
20 | 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 | |