lkml.org 
[lkml]   [1998]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: mmap bug?
Dean Gaudet wrote:

> I'm surprised that you never answered the important question: If you're
> mapping 0 bytes then how the hell do you get a SEGV? You shouldn't be
> referencing anything at the address. Your program is at fault as much or
> more than linux. (I can't find a reference which claims that 0 is not a
> valid response.)

Hi Dean,

If do_mmap didn't immediately return from the len == 0 case, the call to
get_unmapped_area routine would have changed a 0 addr into
TASK_UNMAPPED_BASE, so it seems clear that returning a 0 addr is not
intended. At the very least, if we're going to allow 0 length maps, they
probably need to have a vma so that the length can be tracked. Otherwise
you could get funny edge conditions where another map at the same
address could be created, making the original 0 length map now appear
valid.

I think it's best to return an error if len == 0.

Regards,
Bill

-
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.056 / U:0.748 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site