[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Testing mmap overflow



I fairly quickly discovered that the ia32 value for
VSRT_ADDR_SPACE_PAGES wasn't the right one for
Itanium :-)

Today I did some work on determining the right value,
and made some progress, which also raised a question.
Three tests had failed due to not having a suitable
value:  mmap_P 29 and 34, and munmap_P 4. Some other 
tests use this value, but don't fail as a result of 
it being too small, so I'm ignoring them for now.

The test method for mmap_P 29 is:

mmap VSRT_ADDR_SPACE_PAGES/2 pages to make sure plenty
 of address space is in use
mmap VSRT_ADDR_SPACE_PAGES, which should fail with
 ENOMEM (that's "success"; no failure, or failue with
 another error code, EINVAL being most likely, is a failing test)

It's not too hard to pick a value that works here.

The test method for mmap_P 34 uses MAP_FIXED and thus is 
a little different:

mmap VSRT_ADDR_SPACE_PAGES/2 pages to make sure plenty
 of address space is in use
mmap 3 pages, save address
munmap those 3 pages
mmap VSRT_ADDR_SPACE_PAGES MAP_FIXED using the address
 obtained from the mmap of 3 pages

In this circumstance, I can't seem to pick a value for
VSRT_ADDR_SPACE_PAGES that results in ENOMEM, it's
either success, or EINVAL.

I've tried this with a simpler test program and
confirmed that I can't pick a value that won't map,
and yet fails with ENOMEM.


What I can't quite figure is what this means.  Is it
an implementation deficiency, or is this a bad test
assumption?  implementation-chosed and programmer-chosen
addresses are known to be handled a bit differently.
Does it even make sense to ask the implementation
to pick an address, then use that address for a
MAP_FIXED?




Reply to: