Messages in this thread | | | From | (Mike "Ford" Ditto) | Date | Fri, 29 May 98 14:01:03 -0700 | Subject | Re: mmap bug? |
| |
FYI, from the original SVR4.0 to the latest Solaris, mmap(2) says:
When the system selects a value for pa, it will never place a mapping at address 0... and: ERRORS EINVAL The argument len has a value less than or equal to 0.
As some people have pointed out, the application (or libc rather) is definitely at fault for attempting to dereference the return value of a zero-length mmap(). This is just a degenerate case of referencing memory at an address >= addr+len, which is always improper. Even if mmap did support zero-length mappings, such a mapping would span zero bytes, and therefore, obviously, not contain any bytes which can be accessed.
Zero is not an acceptable thing for mmap() to return unless the caller specified MAP_FIXED and a zero requested address, explicitly requesting something to be mapped at address 0.
I recommend that mmap return error EINVAL when len == 0.
-=] Ford [=-
"A just machine to make big decisions (In Real Life: Mike Ditto) programmed by fellows with compassion ford@omnicron.com and vision." - Donald Fagen, "IGY" http://www.omnicron.com/~ford/ford.html
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu
| |