lkml.org 
[lkml]   [2009]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Security fix for remapping of page 0 (was [PATCH] Change ZERO_SIZE_PTR to point at unmapped space)


On Wed, 3 Jun 2009, Christoph Lameter wrote:
>
> Ok. So what we need to do is stop this toying around with remapping of
> page 0. The following patch contains a fix and a test program that
> demonstrates the issue.

No, we _need_ to be able to map to address zero.

It may not be very common, but things like vm86 require it - vm86 mode
always starts at virtual address zero.

For similar reasons, some other emulation environments will want it too,
simply because they want to emulate another environment that has an
address space starting at 0, and don't want to add a base to all address
calculations.

There are historically even some crazy optimizing compilers that decided
that they need to be able to optimize accesses of a pointer across a NULL
pointer check, so that they can turn code like

if (!ptr)
return;
val = ptr->member;
into doing the load early. In order to support that optimization, they
have a runtime that always maps some garbage at virtual address zero.

(I don't remember who did this, but my dim memory wants to say it was some
HP-UX compiler. Scheduling loads early can be a big deal on especially
in-order machines with nonblocking cache accesses).

The point being that we do need to support mmap at zero. Not necessarily
universally, but it can't be some fixed "we don't allow that".

Linus


\
 
 \ /
  Last update: 2009-10-18 23:28    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site