1 /* 2 * Test very large vma allocations. 3 * The qemu out-of-memory condition was within the mmap syscall itself. 4 * If the syscall actually returns with MAP_FAILED, the test succeeded. 5 */ 6 #include <sys/mman.h> 7 main()8int main() 9 { 10 int n = sizeof(size_t) == 4 ? 32 : 45; 11 12 for (int i = 28; i < n; i++) { 13 size_t l = (size_t)1 << i; 14 void *p = mmap(0, l, PROT_NONE, 15 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0); 16 if (p == MAP_FAILED) { 17 break; 18 } 19 munmap(p, l); 20 } 21 return 0; 22 } 23