public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Russell King <rmk+lkml@arm.linux.org.uk>
To: William Lee Irwin III <wli@holomorphy.com>
Cc: Mikael Pettersson <mikpe@csd.uu.se>,
	Rik van Riel <riel@redhat.com>, Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org,
	James Antill <james.antill@redhat.com>,
	Bryn Reeves <breeves@redhat.com>
Subject: Re: don't let mmap allocate down to zero
Date: Thu, 27 Jan 2005 14:25:00 +0000	[thread overview]
Message-ID: <20050127142500.A775@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20050127125254.GZ10843@holomorphy.com>; from wli@holomorphy.com on Thu, Jan 27, 2005 at 04:52:54AM -0800

On Thu, Jan 27, 2005 at 04:52:54AM -0800, William Lee Irwin III wrote:
> On Thu, Jan 27, 2005 at 10:29:12AM +0100, Mikael Pettersson wrote:
> > About the only kernel-level enforcement I would feel comfortable with is
> > to have non-fixed mmap()s refuse to grab the _page_ at address 0. Any range
> > larger than this is policy, and hence needs a user-space override mechanism.
> > Also, if user-space wants to catch accesses in a larger region above 0 then
> > it can do that itself, by checking the result of mmap(), or by doing a fixed
> > mmap() at address 0 with suitable size and rwx protection disabled.
> 
> 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.

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.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

  reply	other threads:[~2005-01-27 14:25 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-26 16:18 don't let mmap allocate down to zero Rik van Riel
2005-01-26 16:38 ` linux-os
2005-01-26 17:05   ` Sytse Wielinga
2005-01-26 17:34   ` Chris Friesen
2005-01-26 17:57     ` Bryn Reeves
2005-01-26 18:37       ` linux-os
2005-01-26 18:54         ` Rik van Riel
2005-01-26 19:09           ` linux-os
2005-01-26 19:13         ` Chris Friesen
2005-01-26 19:08       ` Chris Friesen
2005-01-26 18:10   ` Olivier Galibert
2005-01-26 18:20     ` linux-os
2005-01-26 18:31       ` Olivier Galibert
2005-01-26 18:39         ` linux-os
2005-01-26 19:41   ` Arjan van de Ven
2005-01-26 20:26   ` Andy Isaacson
2005-01-26 20:42     ` Rik van Riel
2005-01-26 22:12   ` Kyle Moffett
2005-01-26 23:31   ` Brian Gerst
2005-01-26 17:25 ` William Lee Irwin III
2005-01-27  5:09   ` William Lee Irwin III
2005-01-27  5:18     ` Dave Jones
2005-01-27  5:28       ` William Lee Irwin III
2005-01-27  9:29     ` Mikael Pettersson
2005-01-27 12:52       ` William Lee Irwin III
2005-01-27 14:25         ` Russell King [this message]
2005-01-27 15:12           ` William Lee Irwin III
2005-01-27 19:22             ` Rik van Riel
2005-01-27 20:44               ` William Lee Irwin III
2005-01-27 20:58                 ` Rik van Riel
2005-01-27 21:13                   ` William Lee Irwin III
2005-01-27 21:28                     ` Rik van Riel
2005-01-28  5:30                       ` William Lee Irwin III
2005-01-28 13:01                         ` Rik van Riel
2005-01-28 14:14                           ` Hugh Dickins
2005-01-28 14:26                             ` William Lee Irwin III
2005-01-28 15:41                             ` Rik van Riel
2005-01-28 15:53                               ` Hugh Dickins
2005-01-27 21:58                     ` linux-os
2005-01-27 14:26         ` Mikael Pettersson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050127142500.A775@flint.arm.linux.org.uk \
    --to=rmk+lkml@arm.linux.org.uk \
    --cc=akpm@osdl.org \
    --cc=breeves@redhat.com \
    --cc=james.antill@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikpe@csd.uu.se \
    --cc=riel@redhat.com \
    --cc=wli@holomorphy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox