WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] qemu/fdc: Sector size overflow

To: qemu-devel@xxxxxxxxxx, Xen Development Mailing List <xen-devel@xxxxxxxxxxxxxxxxxxx>, Keir Fraser <keir@xxxxxxxxxxxxx>
Subject: [Xen-devel] qemu/fdc: Sector size overflow
From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 27 Nov 2006 14:51:59 +1100
Delivery-date: Sun, 26 Nov 2006 19:52:31 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.9i
Hi:

[QEMU] fdc: Limit sector size to 16K

In fdctrl_start_transfer the sector size field (fifo[5]) is not checked
for overflows.  This allows an arbitrarily large sector size to be used,
which can in turn result in a negative data_len field that is then used
for DMA transfers.

This can lead to the corrpuption of qemu state because some subsequent
checks on the transfer length is conducted using signed integers.

This patch limits the value fifo[5] to 7 which is the standard limit
on floppy sector size.

Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff -r 91951de7592c tools/ioemu/hw/fdc.c
--- a/tools/ioemu/hw/fdc.c      Sun Nov 26 17:35:00 2006 +0000
+++ b/tools/ioemu/hw/fdc.c      Mon Nov 27 14:47:31 2006 +1100
@@ -898,7 +898,7 @@ static void fdctrl_start_transfer (fdctr
         fdctrl->data_len = fdctrl->fifo[8];
     } else {
        int tmp;
-        fdctrl->data_len = 128 << fdctrl->fifo[5];
+        fdctrl->data_len = 128 << (fdctrl->fifo[5] > 7 ? 7 : fdctrl->fifo[5]);
         tmp = (cur_drv->last_sect - ks + 1);
         if (fdctrl->fifo[0] & 0x80)
             tmp += cur_drv->last_sect;

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] qemu/fdc: Sector size overflow, Herbert Xu <=