The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Adam Jackson <ajackson@redhat.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Protection for exploiting null dereference using mmap
Date: Wed, 20 Jun 2007 19:48:03 +0000 (UTC)	[thread overview]
Message-ID: <loom.20070620T212046-804@post.gmane.org> (raw)
In-Reply-To: 1181111433.3978.48.camel@localhost.localdomain

Eric Paris <eparis <at> redhat.com> writes:
> On Tue, 2007-06-05 at 17:16 -0400, Alan Cox wrote:
> > On Tue, Jun 05, 2007 at 05:00:51PM -0400, James Morris wrote:
> > > This should be an unsigned long.
> > > 
> > > I wonder if the default should be for this value to be zero (i.e. preserve 
> > > existing behavior).  It could break binaries, albeit potentially insecure 
> > 
> > Agreed - DOSemu type apps and lrmi need to map at zero for vm86
> 
> And so it shall be!

X also needs to be able to map at zero for vm86, which makes this a lot less
useful.  In particular, the interrupt vectors need to point to the right place
within the VBIOS we're calling into, so we have to be able to map the zero page.
(And often write to it, if we're posting a non-primary card.)  Obviously this
isn't so much an issue for non-x86, where you have to use the emulator anyway.
And I'm pretty convinced that calling vm86 in a SMP environment is just suicide
so you _ought_ to use the emulator even on real x86.

We've already got the infrastructure in place to completely fake the real mode
address space for the emulator.  IWBNI we had some way of presenting a set of
virtual-address-space pages as contiguous to the vm86 task, since if we had that
we could just malloc 1M, copy in the bits we need, and go.  I don't know if vm86
mode supports that in silicon; it certainly isn't exposed in the API.  Anyone
know?

Actually it's a little worse than that.  Some chips have an escape hatch where
they remap banks of registers into the 64k VGA aperture, and the BIOS relies on
this.  So some of the pages need to be backed by device mappings, and some by
plain memory.  You'd really need either an array of pointers to userspace pages,
or a trap handler like how vm86 handles I/O cycles.  Again, I don't know offhand
whether vm86 can do this, but if it does then fixing X to take advantage of it
is pretty easy.

- ajax


  parent reply	other threads:[~2007-06-20 20:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1180561713.3633.27.camel@dhcp231-215.rdu.redhat.com>
     [not found] ` <20070603205653.GE25869@devserv.devel.redhat.com>
     [not found]   ` <1180964306.14220.34.camel@moss-spartans.epoch.ncsc.mil>
2007-06-05 20:34     ` [PATCH] Protection for exploiting null dereference using mmap Eric Paris
2007-06-05 21:00       ` James Morris
2007-06-05 21:16         ` Alan Cox
2007-06-05 21:28           ` Eric Paris
2007-06-05 22:46             ` H. Peter Anvin
2007-06-07 14:28               ` Pavel Machek
2007-06-06 12:47             ` Stephen Smalley
2007-06-07 16:58               ` Jan Engelhardt
2007-06-06  6:30           ` Eric Paris
2007-06-06 13:21             ` James Morris
2007-06-06 17:30             ` Stephen Smalley
2007-06-06 18:01               ` James Morris
2007-06-06 18:06             ` Chris Wright
2007-06-20 19:48             ` Adam Jackson [this message]
2007-06-05 22:49       ` Chris Wright
2007-06-05 22:53       ` Chris Wright
2007-06-06 12:12         ` Stephen Smalley
2007-06-06  9:01       ` Russell Coker
2007-06-06 12:18         ` Stephen Smalley

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=loom.20070620T212046-804@post.gmane.org \
    --to=ajackson@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /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