virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Andrew Morton <akpm@osdl.org>
Cc: lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>,
	virtualization <virtualization@lists.osdl.org>
Subject: [PATCH 1/4] Prep for paravirt: Be careful about touching BIOS address space
Date: Fri, 27 Oct 2006 13:42:14 +1000	[thread overview]
Message-ID: <1161920535.17807.33.camel@localhost.localdomain> (raw)
In-Reply-To: <1161920325.17807.29.camel@localhost.localdomain>

(Andrew had already taken that last one, I meant to send this)

Subject: Be careful about touching BIOS address space

BIOS ROM areas may not be mapped into the guest address space, so be careful
when touching those addresses to make sure they appear to be mapped.

Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

===================================================================
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -270,7 +270,14 @@ static struct resource standard_io_resou
 	.flags	= IORESOURCE_BUSY | IORESOURCE_IO
 } };
 
-#define romsignature(x) (*(unsigned short *)(x) == 0xaa55)
+static inline int romsignature(const unsigned char *x)
+{
+     unsigned short sig;
+     int ret = 0;
+     if (__get_user(sig, (const unsigned short *)x) == 0)
+	  ret = (sig == 0xaa55);
+     return ret;
+}
 
 static int __init romchecksum(unsigned char *rom, unsigned long length)
 {
===================================================================
--- a/arch/i386/pci/pcbios.c
+++ b/arch/i386/pci/pcbios.c
@@ -5,6 +5,7 @@
 #include <linux/pci.h>
 #include <linux/init.h>
 #include <linux/module.h>
+#include <asm/uaccess.h>
 #include "pci.h"
 #include "pci-functions.h"
 
@@ -301,7 +302,7 @@ static struct pci_raw_ops pci_bios_acces
 
 static struct pci_raw_ops * __devinit pci_find_bios(void)
 {
-	union bios32 *check;
+	union bios32 *check, sig;
 	unsigned char sum;
 	int i, length;
 
@@ -314,6 +315,10 @@ static struct pci_raw_ops * __devinit pc
 	for (check = (union bios32 *) __va(0xe0000);
 	     check <= (union bios32 *) __va(0xffff0);
 	     ++check) {
+		long sig;
+		if (__get_user(sig, &check->fields.signature))
+			continue;
+
 		if (check->fields.signature != BIOS32_SIGNATURE)
 			continue;
 		length = check->fields.length * 16;

-- 
 ccontrol: http://ccontrol.ozlabs.org

  reply	other threads:[~2006-10-27  3:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-27  3:38 [PATCH 1/4] Prep for paravirt: move pagetable includes Rusty Russell
2006-10-27  3:42 ` Rusty Russell [this message]
2006-10-27  3:43   ` [PATCH 2/4] Prep for paravirt: cpu_detect extraction Rusty Russell
2006-10-27  3:45     ` [PATCH 3/4] Prep for paravirt: desc.h clearer parameter names, some code motion Rusty Russell
2006-10-27  3:46       ` [PATCH 4/4] Prep for paravirt: rearrange processor.h Rusty Russell
2006-10-29 20:01       ` [PATCH] Re: [PATCH 3/4] Prep for paravirt: desc.h clearer parameter names, some code motion Don Mullis
2006-10-29 21:06         ` Andi Kleen
2006-10-29 21:44           ` Don Mullis
2006-10-30  0:05             ` Rusty Russell
2006-10-27 11:30   ` [PATCH 1/4] Prep for paravirt: Be careful about touching BIOS address space Pavel Machek
2006-10-27 21:31     ` Jeremy Fitzhardinge
2006-10-27 21:41       ` Andrew Morton
2006-10-28  4:33         ` Jeremy Fitzhardinge
2006-10-28  4:50           ` Andrew Morton
2006-10-30  2:35             ` Rusty Russell
2006-10-29 20:01   ` Don Mullis
2006-10-27 10:30 ` [PATCH 1/4] Prep for paravirt: move pagetable includes Zachary Amsden

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=1161920535.17807.33.camel@localhost.localdomain \
    --to=rusty@rustcorp.com.au \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=virtualization@lists.osdl.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;
as well as URLs for NNTP newsgroup(s).