/* Change to PROT_READ|PROT_WRITE if you dont't want the SIGSEGV */
m = mmap(a, getpagesize(), PROT_NONE,
MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED, -1, 0);
printf("mmap = %p, errno = %d\n", m, errno);
a = 0;
posix_memalign(&a, getpagesize(), 1024);
printf("posix2 = %p, usable = %d, errno = %d\n", a,
Tried this with various glibc versions from 2.12 to 2.27 on different distros.
The allocation sizes have a play but haven't figured out the exact relationship
yet. In this example, if you change the first posix_memalign size to 4168 on
Debian with 2.24, then it doesn't crash but does at 4169 bytes. However, on
Fedora with 2.27, changing it to 4168 still causes a SIGSEGV.
You are receiving this mail because:
You are on the CC list for the bug.