Messages in this thread | | | Date | Fri, 29 May 1998 16:00:37 -0400 | From | Bill Hawes <> | Subject | Re: 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
| |