Re: don't let mmap allocate down to zero

From: William Lee Irwin III
Date: Thu Jan 27 2005 - 10:14:18 EST


On Thu, Jan 27, 2005 at 04:52:54AM -0800, William Lee Irwin III wrote:
>> FIRST_USER_PGD_NR is a matter of killing the entire box dead where it
>> exists, not any kind of process' preference. Userspace should be
>> prevented from setting up vmas below FIRST_USER_PGD_NR.

On Thu, Jan 27, 2005 at 02:25:00PM +0000, Russell King wrote:
> No it should not. The PGD index is FAR to coarse to use - each PGD on
> ARM maps 1MB of virtual address space. Userspace text starts at 32K.
> The protection against mmap() MAP_FIXED fiddling with the first page is
> handled by the arch-specific mmap() wrappers, so generic code doesn't
> have to worry about it.
> What generic code _does_ have to worry about is:
>
> (a) not removing the very first page.
> (b) not removing the very first pointer to the 2nd level table in the
> 1st level tables.
> and that is all. Maybe FIRST_USER_PGD_NR was a bad way of achieving
> this, but in the instance of the VM upon which it was originally
> implemented (somewhere between 2.2 and 2.4), it was deemed (by others
> iirc) to be the best way of achieving it at the time.

The only claim above is the effect of clobbering virtual page 0 and
referring to this phenomenon by the macro. I was rather careful not to
claim a specific lower boundary to the address space.


-- wli
-
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/