if (mmap((caddr_t)(1UL << (POINTER_SIZE - 1)) - pagesize,
(size_t)((1UL << (POINTER_SIZE - 1)) - pagesize),
PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_FIXED| MAP_SHARED, 0, 0)
!= (caddr_t)-1)
With 32-bit userland, this boils down to:
| mmap addr 0x7fff0000 size 0x7fff0000
| mmap returned 0x7fff0000
i.e. mmap() succeeds,
but (1) the test expects it to fail, so the test returns
TFAIL,
but (2) ltp-pan still reports that the tests passed?
In addition, sometimes mmapstress03 fails due to SEGV. I created a small test
program that just does the above mmap(), and depending on the distro and what
else I print later it crashes with a SEGV, too. Probably this happens because
the mmap() did succeed, and corrupted some existing mappings,
JFYI, with 64-bit userland, this boils down to:
| mmap addr 0x7fffffffffff0000 size 0x7fffffffffff0000
| mmap returned 0xffffffffffffffff
i.e. mmap() fails as expected, and the test succeeds.
Does all of this sound OK?