mem/hugetlb: Find an empty region to use in hugemmap02.c

the testcase 'hugemmap02' always failed on s390x as:
----------
hugemmap02    0  TINFO  :  set nr_hugepages to 128
hugemmap02    1  TPASS  :  huge mmap succeeded (64-bit)
./hugemmap02: relocation error: ./hugemmap02: symbol , version GLIBC_2.2 not defined in file libc.so.6 with link time reference
----------

it is caused by mapping in zero where libc.so.6 was loaded and resulting in
the dynamic loader finding no information about versions for the library.

running the program, we could obviously see the region area:
---------------
program address:
80000000-80001000 r--s 00000000 00:05 2644                               /dev/zero
80001000-80012000 r-xp 00001000 fd:00 35121302                           /mnt/tests/kernel/distribution/ltp/generic/ltp-full-20150903/testcases/kernel/mem/hugetlb/hugemmap/hugemmap02
80012000-80013000 r--p 00011000 fd:00 35121302                           /mnt/tests/kernel/distribution/ltp/generic/ltp-full-20150903/testcases/kernel/mem/hugetlb/hugemmap/hugemmap02
80013000-80014000 rw-p 00012000 fd:00 35121302                           /mnt/tests/kernel/distribution/ltp/generic/ltp-full-20150903/testcases/kernel/mem/hugetlb/hugemmap/hugemmap02
80014000-80017000 rw-p 00000000 00:00 0
90000000-90200000 rw-s 00000000 00:29 75950                              /tmp/hugme85Xf/mmapfile41071
9c14f000-9c170000 rw-p 00000000 00:00 0                                  [heap]
3ffad342000-3ffbd342000 r--s 00000000 00:05 2644                         /dev/zero
3ffbd342000-3ffcd342000 r--s 00000000 00:05 2644                         /dev/zero
3ffcd342000-3ffdd342000 r--s 00000000 00:05 2644                         /dev/zero
3ffdd342000-3ffed342000 r--s 00000000 00:05 2644                         /dev/zero
3ffed342000-3fffd342000 r--s 00000000 00:05 2644                         /dev/zero
3fffd342000-3fffd344000 rw-p 00000000 00:00 0
3fffd344000-3fffd4db000 r-xp 00000000 fd:00 5438                         /usr/lib64/libc-2.17.so
3fffd4db000-3fffd4df000 r--p 00196000 fd:00 5438                         /usr/lib64/libc-2.17.so
3fffd4df000-3fffd4e1000 rw-p 0019a000 fd:00 5438                         /usr/lib64/libc-2.17.so
3fffd4e1000-3fffd4e6000 rw-p 00000000 00:00 0
3fffd4e6000-3fffd4fe000 r-xp 00000000 fd:00 5464                         /usr/lib64/libpthread-2.17.so
3fffd4fe000-3fffd4ff000 r--p 00017000 fd:00 5464                         /usr/lib64/libpthread-2.17.so
3fffd4ff000-3fffd500000 rw-p 00018000 fd:00 5464                         /usr/lib64/libpthread-2.17.so
3fffd500000-3fffd504000 rw-p 00000000 00:00 0
3fffd50c000-3fffd510000 rw-p 00000000 00:00 0
3fffd510000-3fffd512000 r-xp 00000000 00:00 0                            [vdso]
3fffd512000-3fffd534000 r-xp 00000000 fd:00 5431                         /usr/lib64/ld-2.17.so
3fffd534000-3fffd535000 r--p 00022000 fd:00 5431                         /usr/lib64/ld-2.17.so
3fffd535000-3fffd536000 rw-p 00023000 fd:00 5431                         /usr/lib64/ld-2.17.so
3fffd536000-3fffd537000 rw-p 00000000 00:00 0
3ffffaaf000-3ffffad0000 rw-p 00000000 00:00 0                            [stack]
-------------

Signed-off-by: Li Wang <liwang@redhat.com>
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
3 files changed