]> git.ipfire.org Git - thirdparty/valgrind.git/commit
fix 338995 shmat with hugepages (SHM_HUGETLB) fails with EINVAL
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sat, 1 Nov 2014 22:00:50 +0000 (22:00 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sat, 1 Nov 2014 22:00:50 +0000 (22:00 +0000)
commit80ae5a239562e237437ef7011440156765383dbd
tree65c68bc8ef9402878b37092a8d41041d6f19b7e9
parent41610f34c2b8dbed9064ca9000bab27457eaf01e
fix 338995  shmat with hugepages (SHM_HUGETLB) fails with EINVAL

Bug is not really fixed, instead the SHM_HUGETLB flag is ignored.
Note that it is not straightforward to properly fix this,
as this implies either to learn aspacemgr what huge pages are.
Also, the trick used in the fix for 333051 cannot be used easily,
because the SHM_HUGETLB flag is given in shmget, while the mmap
is done in shmat.

So, the easiest is to just ignore the SHM_HUGETLB flag.

SHM_HUGETLB is supposed to only give a performance impact.
Ignoring it should be benign.
Theoretically, the caller might expect a sucessful shmget(SHM_HUGETLB)+shmat
to give pages aligned on e.g. 1MB.
In this case, bad luck, the program will misbehave under valgrind.
To warn of this, a warning is given (once) when SHM_HUGETLB is seen.

The map_unmap.c test has been restructured somewaht to allow
TEST_SHM_HUGETLB to be tested independently (or not) of the TEST_MAP_HUGETLB.

Note also that by default, testing  MAP_HUGETLB and SHM_HUGETLB
is disabled as usually, huge pages are not enabled.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14683
NEWS
coregrind/m_syswrap/syswrap-darwin.c
coregrind/m_syswrap/syswrap-linux.c
include/vki/vki-linux.h
none/tests/map_unmap.c