lkml.org 
[lkml]   [1998]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: 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

\
 
 \ /
  Last update: 2005-03-22 13:42    [W:0.152 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site