Re: don't let mmap allocate down to zero

From: Dave Jones
Date: Thu Jan 27 2005 - 00:20:20 EST


On Wed, Jan 26, 2005 at 09:09:27PM -0800, William Lee Irwin III wrote:
> On Wed, Jan 26, 2005 at 11:18:08AM -0500, Rik van Riel wrote:
> >> With some programs the 2.6 kernel can end up allocating memory
> >> at address zero, for a non-MAP_FIXED mmap call! This causes
> >> problems with some programs and is generally rude to do. This
> >> simple patch fixes the problem in my tests.
> >> Make sure that we don't allocate memory all the way down to zero,
> >> so the NULL pointer never gets covered up with anonymous memory
> >> and we don't end up violating the C standard.
> >> Signed-off-by: Rik van Riel <riel@xxxxxxxxxx>
>
> On Wed, Jan 26, 2005 at 09:25:38AM -0800, William Lee Irwin III wrote:
> > SHLIB_BASE does not appear to be present in 2.6.9; perhaps something
> > else is going on.
> > I think we are better off:
> > (a) checking for hitting zero explicitly as opposed to
> > enforcing a randomly-chosen lower limit for addresses
> > (b) enforcing vma allocation above FIRST_USER_PGD_NR*PGDIR_SIZE,
> > to which SHLIB_BASE bears no relation.
>
> There's a long discussion here, in which no one appears to have noticed
> that SHLIB_BASE does not exist in mainline. Is anyone else awake here?

It's an exec-shield'ism. Rik likely was working off a Red Hat/Fedora kernel tree.

Dave

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/