Re: mmap bug?

Chris Evans (chris@ferret.lmh.ox.ac.uk)
Fri, 29 May 1998 20:36:30 +0100 (BST)


On Fri, 29 May 1998, Dean Gaudet wrote:

> > Thank you.
> >
> > I was surprised at the number of people prepared to tell me not to
> > mmap zero length areas. Here's a trivial patch to fix this, although
> > I don't know if this will affect many programs.
>
> 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

I'm surprised you've failed to read the thread properly. As mentioned, the
problem is in glibc. It stat()'s a file then mmap()'s it with the length
returned by stat. I think it assumes a certain length on the file...

The file is LC_MESSAGES related and cropped up investigating possible
insecurities in glibc. It happily trusts whatever the user sets LANG to
when running suid programs. Having these then crash isn't great.

Chris

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu