[Midnightbsd-cvs] mports: emulators/qemu: add security patches, install new ifup/down

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Wed Sep 17 19:33:45 EDT 2008


Log Message:
-----------
add security patches, install new ifup/down scripts

Modified Files:
--------------
    mports/emulators/qemu:
        Makefile (r1.5 -> r1.6)
        distinfo (r1.2 -> r1.3)
        pkg-plist (r1.1 -> r1.2)
    mports/emulators/qemu/files:
        patch-90_security (r1.1 -> r1.2)
        patch-Makefile (r1.1 -> r1.2)
        patch-ac (r1.1 -> r1.2)
        patch-bd (r1.1 -> r1.2)
        patch-be (r1.1 -> r1.2)
        patch-bg (r1.2 -> r1.3)
        patch-bk (r1.1 -> r1.2)
        patch-bsdusb.patch (r1.2 -> r1.3)
        patch-bt (r1.1 -> r1.2)
        patch-fbsd (r1.1 -> r1.2)
        patch-fpu-softfloat-native.c (r1.1 -> r1.2)
        patch-qemu-img.c (r1.1 -> r1.2)
        patch-qemu-img.texi (r1.1 -> r1.2)
        patch-vl.c (r1.2 -> r1.3)
        patch-vl.c-nographic (r1.1 -> r1.2)
        patch-vl.c-ppbus (r1.2 -> r1.3)

Added Files:
-----------
    mports/emulators/qemu/files:
        patch-CVE-2008-0928 (r1.1)
        patch-Makefile.target (r1.3)
        patch-hw-eepro100.c (r1.1)
        patch-hw-vmware_vga.c (r1.1)

Removed Files:
-------------
    mports/emulators/qemu/files:
        patch-PRId64
        patch-audio::ossaudio.c
        patch-bh
        patch-block-raw.c

-------------- next part --------------
Index: pkg-plist
===================================================================
RCS file: /home/cvs/mports/emulators/qemu/pkg-plist,v
retrieving revision 1.1
retrieving revision 1.2
diff -L emulators/qemu/pkg-plist -L emulators/qemu/pkg-plist -u -r1.1 -r1.2
--- emulators/qemu/pkg-plist
+++ emulators/qemu/pkg-plist
@@ -1,20 +1,37 @@
 bin/qemu
 bin/qemu-img
 bin/qemu-system-arm
+bin/qemu-system-cris
+bin/qemu-system-m68k
 bin/qemu-system-mips
+bin/qemu-system-mips64
+bin/qemu-system-mips64el
 bin/qemu-system-mipsel
 bin/qemu-system-ppc
+bin/qemu-system-ppc64
+bin/qemu-system-ppcemb
+bin/qemu-system-sh4
+bin/qemu-system-sh4eb
 bin/qemu-system-sparc
 bin/qemu-system-x86_64
+ at unexec if cmp -s %D/etc/qemu-ifup.sample %D/etc/qemu-ifup; then rm -f %D/etc/qemu-ifup; fi
+etc/qemu-ifup.sample
+ at exec if [ ! -f %D/etc/qemu-ifup ] ; then cp -p %D/%F %B/qemu-ifup; fi
+ at unexec if cmp -s %D/etc/qemu-ifdown.sample %D/etc/qemu-ifdown; then rm -f %D/etc/qemu-ifdown; fi
+etc/qemu-ifdown.sample
+ at exec if [ ! -f %D/etc/qemu-ifdown ] ; then cp -p %D/%F %B/qemu-ifdown; fi
 %%PORTDOCS%%%%DOCSDIR%%/qemu-doc.html
 %%PORTDOCS%%%%DOCSDIR%%/qemu-tech.html
+%%PORTDOCS%%@dirrm %%DOCSDIR%%
 %%DATADIR%%/bios.bin
-%%DATADIR%%/linux_boot.bin
 %%DATADIR%%/vgabios.bin
 %%DATADIR%%/vgabios-cirrus.bin
 %%DATADIR%%/ppc_rom.bin
 %%DATADIR%%/openbios-sparc32
 %%DATADIR%%/video.x
+%%DATADIR%%/pxe-ne2k_pci.bin
+%%DATADIR%%/pxe-rtl8139.bin
+%%DATADIR%%/pxe-pcnet.bin
 %%DATADIR%%/keymaps/ar
 %%DATADIR%%/keymaps/common
 %%DATADIR%%/keymaps/da
@@ -52,4 +69,3 @@
 %%DATADIR%%/keymaps/tr
 @dirrm %%DATADIR%%/keymaps
 @dirrm %%DATADIR%%
-%%PORTDOCS%%@dirrm %%DOCSDIR%%
Index: Makefile
===================================================================
RCS file: /home/cvs/mports/emulators/qemu/Makefile,v
retrieving revision 1.5
retrieving revision 1.6
diff -L emulators/qemu/Makefile -L emulators/qemu/Makefile -u -r1.5 -r1.6
--- emulators/qemu/Makefile
+++ emulators/qemu/Makefile
@@ -4,73 +4,74 @@
 #
 # $MidnightBSD$
 # $FreeBSD: ports/emulators/qemu/Makefile,v 1.56 2006/08/25 21:16:20 miwi Exp $
-#
 
 PORTNAME=	qemu
-PORTVERSION=	0.9.0
-PORTREVISION=	1
+PORTVERSION=	0.9.1
+PORTREVISION=	5
 CATEGORIES=	emulators
-MASTER_SITES=	http://www.qemu.org/:release \
-		http://people.fruitsalad.org/nox/qemu/:snapshot \
-		http://www.volny.cz/xnavara/qemu/:snapshot \
-		http://qemu.dad-answers.com/download/qemu/:snapshot \
-		http://people.brandeis.edu/~jcoiner/qemu_idedma/:idedma \
-		http://people.freebsd.org/~maho/qemu/:misc \
-		http://people.freebsd.org/~jkim/:bios
-DISTFILES=	${DISTNAME}${EXTRACT_SUFX}:release \
-		qemu-bios.bin:bios
+MASTER_SITES=	http://bellard.org/qemu/:release \
+		http://qemu.org/:release \
+		http://people.freebsd.org/~maho/qemu/:misc
+DISTFILES=	${DISTNAME}${EXTRACT_SUFX}:release
 DIST_SUBDIR=	qemu
 EXTRACT_ONLY=	${DISTNAME}${EXTRACT_SUFX}
 
 MAINTAINER=	ports at MidnightBSD.org
 COMMENT=	QEMU CPU Emulator
 LICENSE=        gpl2
+
 HAS_CONFIGURE=	yes
 USE_GMAKE=	yes
-USE_GETOPT_LONG=	yes
 USE_PERL5=	yes
-USE_GCC=	3.4
-PATCH_STRIP=	-p1
+PATCH_STRIP=	-lp1
 CONFIGURE_ARGS+=	--prefix=${PREFIX} --cc=${CC}
 MAKE_ENV+=	BSD_MAKE="${MAKE}" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
 MAN1=		qemu.1 qemu-img.1
 ONLY_FOR_ARCHS=	amd64 i386
 CONFLICTS=	qemu-devel-[0-9]*
+
 OPTIONS=	KQEMU "Build with (alpha!) accelerator module" Off \
-		HACKS_CIRRUS "Large display speedup (buggy!)" Off \
 		RTL8139_TIMER "allow use of re(4) nic with FreeBSD guests" Off \
 		SAMBA "samba dependency (for -smb)" Off \
 		SDL "SDL/X dependency (graphical output)" On \
+		GNUTLS "gnutls dependency (vnc encryption)" On \
 		CDROM_DMA "IDE CDROM DMA" On
-  	 
+
 .include <bsd.port.pre.mk>
+
 WITHOUT_CPU_CFLAGS=yes	#to avoid problems with register allocation
+CFLAGS:=	${CFLAGS:C/-fno-tree-vrp//}
 
 .if defined(WITHOUT_SDL)
-CONFIGURE_ARGS+=        --disable-sdl --disable-gfx-check
+CONFIGURE_ARGS+=	--disable-sdl --disable-gfx-check
 .else
-USE_SDL=        sdl
+USE_SDL=	sdl
 .endif
-  	 
+
+.if defined(WITHOUT_GNUTLS)
+CONFIGURE_ARGS+=       --disable-vnc-tls
+.else
+LIB_DEPENDS+=	gnutls:${PORTSDIR}/security/gnutls
+.endif
+
 .if defined (WITH_HACKS_CIRRUS) || defined (WITH_HACKS)
-DISTFILES+=     patch3_cirrus:misc
+DISTFILES+=	patch3_cirrus:misc
 .endif
-  	 
+
 .if defined(WITH_SAMBA)
-RUN_DEPENDS+=   ${LOCALBASE}/sbin/smbd:${PORTSDIR}/net/samba3
+RUN_DEPENDS+=	${LOCALBASE}/sbin/smbd:${PORTSDIR}/net/samba3
 .endif
 
 .if defined(WITH_KQEMU)
-BUILD_DEPENDS+= kqemu-kmod>=1.3.0pre5:${PORTSDIR}/emulators/kqemu-kmod
-CONFIGURE_ARGS+=	--enable-kqemu
+BUILD_DEPENDS+=	kqemu-kmod>=1.3.0pre5:${PORTSDIR}/emulators/kqemu-kmod
 .else
 CONFIGURE_ARGS+=	--disable-kqemu
 .endif
 
 .if defined(NOPORTDOCS)
-MAKE_ARGS+=     NOPORTDOCS=${NOPORTDOCS}
+MAKE_ARGS+=	NOPORTDOCS=${NOPORTDOCS}
 .else
-BUILD_DEPENDS+= texi2html:${PORTSDIR}/textproc/texi2html
+BUILD_DEPENDS+=	texi2html:${PORTSDIR}/textproc/texi2html
 .endif
 
 .if ${ARCH} == "amd64"
@@ -81,7 +82,6 @@
 	@${MKDIR} ${WRKSRC}/kqemu
 	@${TOUCH} ${WRKSRC}/kqemu/Makefile
 	@${ECHO} all: > ${WRKSRC}/kqemu/Makefile.freebsd
-	@${CP} -p ${_DISTDIR}/qemu-bios.bin ${WRKSRC}/pc-bios/bios.bin
 
 pre-patch:
 	@for A in ${ONLY_FOR_ARCHS}; do \
@@ -89,9 +89,6 @@
 	done
 
 post-patch:
-.if defined(WITH_HACKS_CIRRUS) || defined (WITH_HACKS)
-	@cd ${WRKSRC} ; ${PATCH} --quiet < ${DISTDIR}/${DIST_SUBDIR}/patch3_cirrus
-.endif
 .if defined(WITH_RTL8139_TIMER)
 	@cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/rtl8139-re-patch
 .endif
@@ -106,6 +103,15 @@
 		-e "s,^(CFLAGS=).*,\1${CFLAGS} -fno-strict-aliasing -I.," \
 		-e "s,^(LDFLAGS=).*,\1${LDFLAGS}," \
 		${WRKSRC}/Makefile
-	@${REINPLACE_CMD} -e 's|/usr/bin/perl|${LOCALBASE_REL}/bin/perl|' ${WRKSRC}/texi2pod.pl
+
+post-install:
+	@${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifup.sample ${PREFIX}/etc
+	@${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifdown.sample ${PREFIX}/etc
+	@if [ ! -f ${PREFIX}/etc/qemu-ifup ]; then \
+	    ${CP} -p ${PREFIX}/etc/qemu-ifup.sample ${PREFIX}/etc/qemu-ifup ; \
+	fi
+	@if [ ! -f ${PREFIX}/etc/qemu-ifdown ]; then \
+	    ${CP} -p ${PREFIX}/etc/qemu-ifdown.sample ${PREFIX}/etc/qemu-ifdown ; \
+	fi
 
 .include <bsd.port.post.mk>
Index: distinfo
===================================================================
RCS file: /home/cvs/mports/emulators/qemu/distinfo,v
retrieving revision 1.2
retrieving revision 1.3
diff -L emulators/qemu/distinfo -L emulators/qemu/distinfo -u -r1.2 -r1.3
--- emulators/qemu/distinfo
+++ emulators/qemu/distinfo
@@ -1,9 +1,6 @@
-MD5 (qemu/qemu-0.9.0.tar.gz) = ab11a03ba30cf4a70641f0f170473d69
-SHA256 (qemu/qemu-0.9.0.tar.gz) = 491facf9335654967ee53d8fb3540a274bfcbdcc225506bd38c4ee8e9ab405c1
-SIZE (qemu/qemu-0.9.0.tar.gz) = 1901741
-MD5 (qemu/qemu-bios.bin) = 173e256f17b4ac1f6e3249c83071e8f5
-SHA256 (qemu/qemu-bios.bin) = 452d863ec8ac9e2246950ac204410e847cdeba880d7bec2aeb79c4f2fbb0ad17
-SIZE (qemu/qemu-bios.bin) = 131072
+MD5 (qemu/qemu-0.9.1.tar.gz) = 6591df8e9270eb358c881de4ebea1262
+SHA256 (qemu/qemu-0.9.1.tar.gz) = 4756d0b4a4dc7dd88354bc6b37d381e4462dd328d0feef94803e90c0455835a5
+SIZE (qemu/qemu-0.9.1.tar.gz) = 2804104
 MD5 (qemu/patch3_cirrus) = ebe7ed9fce804c49e024bc93bfdfc810
 SHA256 (qemu/patch3_cirrus) = e862371834b7d895a896fbdb84fd9f70d17b5729a6f6789a48a61504fc941e11
 SIZE (qemu/patch3_cirrus) = 8817
Index: patch-bsdusb.patch
===================================================================
RCS file: /home/cvs/mports/emulators/qemu/files/patch-bsdusb.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -L emulators/qemu/files/patch-bsdusb.patch -L emulators/qemu/files/patch-bsdusb.patch -u -r1.2 -r1.3
--- emulators/qemu/files/patch-bsdusb.patch
+++ emulators/qemu/files/patch-bsdusb.patch
@@ -35,16 +35,16 @@
  
  for target in $target_list; do
  target_dir="$target"
-Index: qemu/Makefile.target
-@@ -329,7 +329,7 @@
- VL_OBJS+= scsi-disk.o cdrom.o lsi53c895a.o
+Index: qemu/Makefile
+@@ -61,7 +61,7 @@
+ OBJS+=ssd0303.o ssd0323.o ads7846.o stellaris_input.o
+ OBJS+=scsi-disk.o cdrom.o
+ OBJS+=scsi-generic.o
+-OBJS+=usb.o usb-hub.o usb-linux.o usb-hid.o usb-msd.o usb-wacom.o
++OBJS+=usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o
+ OBJS+=sd.o ssi-sd.o
  
- # USB layer
--VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o
-+VL_OBJS+= usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-ohci.o usb-msd.o
- 
- # PCI network cards
- VL_OBJS+= ne2000.o rtl8139.o pcnet.o
+ ifdef CONFIG_WIN32
 Index: qemu/usb-stub.c
 @@ -0,0 +1,11 @@
 +#include "vl.h"
@@ -59,7 +59,7 @@
 +    return NULL;
 +}
 Index: qemu/usb-bsd.c
-@@ -0,0 +1,600 @@
+@@ -0,0 +1,601 @@
 +/*
 + * BSD host USB redirector
 + *
@@ -86,7 +86,8 @@
 + * THE SOFTWARE.
 + */
 +
-+#include "vl.h"
++#include "qemu-common.h"
++#include "hw/usb.h"
 +
 +/* usb.h declares these */
 +#undef USB_SPEED_HIGH
Index: patch-Makefile
===================================================================
RCS file: /home/cvs/mports/emulators/qemu/files/patch-Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -L emulators/qemu/files/patch-Makefile -L emulators/qemu/files/patch-Makefile -u -r1.1 -r1.2
--- emulators/qemu/files/patch-Makefile
+++ emulators/qemu/files/patch-Makefile
@@ -1,6 +1,6 @@
 Index: qemu/Makefile
-@@ -20,6 +20,10 @@
- LDFLAGS+=-static
+@@ -19,7 +19,11 @@
+ BASE_LDFLAGS += -static
  endif
  ifdef BUILD_DOCS
 +ifdef NOPORTDOCS
@@ -10,17 +10,8 @@
 +endif
  else
  DOCS=
-@@ -28,7 +28,8 @@
- ifndef CONFIG_DARWIN
- ifndef CONFIG_WIN32
- ifndef CONFIG_SOLARIS
--LIBS+=-lrt
-+# XXX need ifndef CONFIG_BSD
-+# LIBS+=-lrt
- endif
- endif
  endif
-@@ -72,8 +75,10 @@
+@@ -60,8 +64,10 @@
  common  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      pt  sl     tr
  
  install-doc: $(DOCS)
Index: patch-90_security
===================================================================
RCS file: /home/cvs/mports/emulators/qemu/files/patch-90_security,v
retrieving revision 1.1
retrieving revision 1.2
diff -L emulators/qemu/files/patch-90_security -L emulators/qemu/files/patch-90_security -u -r1.1 -r1.2
--- emulators/qemu/files/patch-90_security
+++ emulators/qemu/files/patch-90_security
@@ -1,7 +1,4 @@
 Index: qemu-0.8.2/hw/cirrus_vga.c
-===================================================================
---- qemu-0.8.2.orig/hw/cirrus_vga.c	2007-04-20 06:05:59.000000000 +0300
-+++ qemu-0.8.2/hw/cirrus_vga.c	2007-04-20 06:05:59.000000000 +0300
 @@ -217,6 +217,20 @@
  #define CIRRUS_HOOK_NOT_HANDLED 0
  #define CIRRUS_HOOK_HANDLED 1
@@ -23,7 +20,7 @@
  struct CirrusVGAState;
  typedef void (*cirrus_bitblt_rop_t) (struct CirrusVGAState *s,
                                       uint8_t * dst, const uint8_t * src,
-@@ -589,7 +603,7 @@ static void cirrus_invalidate_region(Cir
+@@ -636,7 +650,7 @@
  
      for (y = 0; y < lines; y++) {
  	off_cur = off_begin;
@@ -32,20 +29,20 @@
  	off_cur &= TARGET_PAGE_MASK;
  	while (off_cur < off_cur_end) {
  	    cpu_physical_memory_set_dirty(s->vram_offset + off_cur);
-@@ -604,7 +618,11 @@ static int cirrus_bitblt_common_patternc
+@@ -651,7 +665,11 @@
  {
      uint8_t *dst;
  
 -    dst = s->vram_ptr + s->cirrus_blt_dstaddr;
 +    dst = s->vram_ptr + (s->cirrus_blt_dstaddr & s->cirrus_addr_mask);
-+    
++ 
 +    if (BLTUNSAFE(s))
 +        return 0;
 +
      (*s->cirrus_rop) (s, dst, src,
                        s->cirrus_blt_dstpitch, 0, 
                        s->cirrus_blt_width, s->cirrus_blt_height);
-@@ -620,8 +638,11 @@ static int cirrus_bitblt_solidfill(Cirru
+@@ -667,8 +685,11 @@
  {
      cirrus_fill_t rop_func;
  
@@ -58,7 +55,7 @@
               s->cirrus_blt_dstpitch,
               s->cirrus_blt_width, s->cirrus_blt_height);
      cirrus_invalidate_region(s, s->cirrus_blt_dstaddr,
-@@ -640,8 +661,8 @@ static int cirrus_bitblt_solidfill(Cirru
+@@ -687,8 +708,8 @@
  static int cirrus_bitblt_videotovideo_patterncopy(CirrusVGAState * s)
  {
      return cirrus_bitblt_common_patterncopy(s,
@@ -69,9 +66,9 @@
  }
  
  static void cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
-@@ -691,8 +712,10 @@ static void cirrus_do_copy(CirrusVGAStat
+@@ -738,8 +759,10 @@
      if (notify)
- 	video_hw_update();
+ 	vga_hw_update();
  
 -    (*s->cirrus_rop) (s, s->vram_ptr + s->cirrus_blt_dstaddr,
 -		      s->vram_ptr + s->cirrus_blt_srcaddr,
@@ -82,7 +79,7 @@
  		      s->cirrus_blt_dstpitch, s->cirrus_blt_srcpitch,
  		      s->cirrus_blt_width, s->cirrus_blt_height);
  
-@@ -718,8 +741,14 @@ static int cirrus_bitblt_videotovideo_co
+@@ -765,8 +788,14 @@
  		       s->cirrus_blt_srcaddr - s->start_addr,
  		       s->cirrus_blt_width, s->cirrus_blt_height);
      } else {
@@ -99,7 +96,7 @@
  			  s->cirrus_blt_dstpitch, s->cirrus_blt_srcpitch,
  			  s->cirrus_blt_width, s->cirrus_blt_height);
  
-@@ -751,8 +780,9 @@ static void cirrus_bitblt_cputovideo_nex
+@@ -798,8 +827,9 @@
          } else {
              /* at least one scan line */
              do {
@@ -111,7 +108,7 @@
                  cirrus_invalidate_region(s, s->cirrus_blt_dstaddr, 0,
                                           s->cirrus_blt_width, 1);
                  s->cirrus_blt_dstaddr += s->cirrus_blt_dstpitch;
-@@ -1852,7 +1882,7 @@ static void cirrus_mem_writeb_mode4and5_
+@@ -1917,7 +1947,7 @@
      unsigned val = mem_value;
      uint8_t *dst;
  
@@ -120,7 +117,7 @@
      for (x = 0; x < 8; x++) {
  	if (val & 0x80) {
  	    *dst = s->cirrus_shadow_gr1;
-@@ -1875,7 +1905,7 @@ static void cirrus_mem_writeb_mode4and5_
+@@ -1940,7 +1970,7 @@
      unsigned val = mem_value;
      uint8_t *dst;
  
@@ -166,69 +163,20 @@
  }
  
 Index: qemu-0.8.2/hw/fdc.c
-===================================================================
---- qemu-0.8.2.orig/hw/fdc.c	2006-07-22 20:23:34.000000000 +0300
-+++ qemu-0.8.2/hw/fdc.c	2007-04-20 06:05:59.000000000 +0300
-@@ -1110,8 +1110,13 @@ static uint32_t fdctrl_read_data (fdctrl
+@@ -1247,7 +1247,12 @@
              len = fdctrl->data_len - fdctrl->data_pos;
              if (len > FD_SECTOR_LEN)
                  len = FD_SECTOR_LEN;
--            bdrv_read(cur_drv->bs, fd_sector(cur_drv),
--                      fdctrl->fifo, len);
+-            bdrv_read(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1);
 +            if (cur_drv->bs) {
-+                bdrv_read(cur_drv->bs, fd_sector(cur_drv),
-+                          fdctrl->fifo, len);
++                bdrv_read(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1);
 +            } else {
 +                FLOPPY_ERROR("can't read data from drive\n");
 +                return 0;
-+            }
++           }
          }
      }
      retval = fdctrl->fifo[pos];
-Index: qemu-0.8.2/hw/i8259.c
-===================================================================
---- qemu-0.8.2.orig/hw/i8259.c	2006-07-22 20:23:34.000000000 +0300
-+++ qemu-0.8.2/hw/i8259.c	2007-04-20 06:05:59.000000000 +0300
-@@ -292,9 +292,11 @@ static void pic_ioport_write(void *opaqu
-             s->init_state = 1;
-             s->init4 = val & 1;
-             if (val & 0x02)
--                hw_error("single mode not supported");
-+                /* hw_error("single mode not supported"); */
-+                return;
-             if (val & 0x08)
--                hw_error("level sensitive irq not supported");
-+                /* hw_error("level sensitive irq not supported"); */
-+                return;
-         } else if (val & 0x08) {
-             if (val & 0x04)
-                 s->poll = 1;
-Index: qemu-0.8.2/hw/ne2000.c
-===================================================================
---- qemu-0.8.2.orig/hw/ne2000.c	2007-04-20 06:05:59.000000000 +0300
-+++ qemu-0.8.2/hw/ne2000.c	2007-04-20 06:05:59.000000000 +0300
-@@ -230,7 +230,7 @@ static void ne2000_receive(void *opaque,
- {
-     NE2000State *s = opaque;
-     uint8_t *p;
--    int total_len, next, avail, len, index, mcast_idx;
-+    unsigned int total_len, next, avail, len, index, mcast_idx;
-     uint8_t buf1[60];
-     static const uint8_t broadcast_macaddr[6] = 
-         { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-@@ -299,7 +299,11 @@ static void ne2000_receive(void *opaque,
- 
-     /* write packet data */
-     while (size > 0) {
--        avail = s->stop - index;
-+        /* taviso: this can wrap, so check its okay. */
-+        if (index <= s->stop)
-+            avail = s->stop - index;
-+        else
-+            avail = 0;
-         len = size;
-         if (len > avail)
-             len = avail;
 Index: qemu-0.8.2/hw/pc.c
 ===================================================================
 --- qemu-0.8.2.orig/hw/pc.c	2007-04-20 06:05:58.000000000 +0300
@@ -290,20 +238,6 @@
 ===================================================================
 --- qemu-0.8.2.orig/target-i386/translate.c	2006-07-22 20:23:34.000000000 +0300
 +++ qemu-0.8.2/target-i386/translate.c	2007-04-20 06:05:59.000000000 +0300
-@@ -5244,7 +5244,12 @@ static target_ulong disas_insn(DisasCont
-         if (CODE64(s))
-             goto illegal_op;
-         val = ldub_code(s->pc++);
--        gen_op_aam(val);
-+        /* taviso: operand can be zero */
-+        if (val) {
-+            gen_op_aam(val);
-+        } else {
-+            gen_exception(s, EXCP00_DIVZ, s->pc - s->cs_base);
-+        }
-         s->cc_op = CC_OP_LOGICB;
-         break;
-     case 0xd5: /* aad */
 @@ -5292,6 +5297,7 @@ static target_ulong disas_insn(DisasCont
          gen_jmp_im(pc_start - s->cs_base);
          gen_op_into(s->pc - pc_start);
@@ -379,3 +313,14 @@
      }
      if (drv->bdrv_pwrite) {
          int ret, len;
+Index: qemu/hw/i8259.c
+@@ -302,7 +302,8 @@
+             s->init4 = val & 1;
+             s->single_mode = val & 2;
+             if (val & 0x08)
+-                hw_error("level sensitive irq not supported");
++                /* hw_error("level sensitive irq not supported"); */
++		return;
+         } else if (val & 0x08) {
+             if (val & 0x04)
+                 s->poll = 1;
Index: patch-fpu-softfloat-native.c
===================================================================
RCS file: /home/cvs/mports/emulators/qemu/files/patch-fpu-softfloat-native.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -L emulators/qemu/files/patch-fpu-softfloat-native.c -L emulators/qemu/files/patch-fpu-softfloat-native.c -u -r1.1 -r1.2
--- emulators/qemu/files/patch-fpu-softfloat-native.c
+++ emulators/qemu/files/patch-fpu-softfloat-native.c
@@ -14,4 +14,4 @@
 +#endif
  }
  
- float64 float64_round_to_int( float64 a STATUS_PARAM )
\ No newline at end of file
+ float64 float64_round_to_int( float64 a STATUS_PARAM )
--- /dev/null
+++ emulators/qemu/files/patch-hw-eepro100.c
@@ -0,0 +1,50 @@
+Index: qemu/hw/eepro100.c
+@@ -729,6 +729,7 @@
+                 logout
+                     ("TBD (simplified mode): buffer address 0x%08x, size 0x%04x\n",
+                      tx_buffer_address, tx_buffer_size);
++                assert(size + tx_buffer_size <= sizeof(buf));
+                 cpu_physical_memory_read(tx_buffer_address, &buf[size],
+                                          tx_buffer_size);
+                 size += tx_buffer_size;
+@@ -749,9 +750,13 @@
+                         logout
+                             ("TBD (extended mode): buffer address 0x%08x, size 0x%04x\n",
+                              tx_buffer_address, tx_buffer_size);
+-                        cpu_physical_memory_read(tx_buffer_address, &buf[size],
+-                                                 tx_buffer_size);
+-                        size += tx_buffer_size;
++                        if (size + tx_buffer_size > sizeof(buf)) {
++                            logout("bad extended TCB with size 0x%04x\n", tx_buffer_size);
++                        } else {
++                            cpu_physical_memory_read(tx_buffer_address, &buf[size],
++                                                     tx_buffer_size);
++                            size += tx_buffer_size;
++                        }
+                         if (tx_buffer_el & 1) {
+                             break;
+                         }
+@@ -766,14 +771,20 @@
+                     logout
+                         ("TBD (flexible mode): buffer address 0x%08x, size 0x%04x\n",
+                          tx_buffer_address, tx_buffer_size);
+-                    cpu_physical_memory_read(tx_buffer_address, &buf[size],
+-                                             tx_buffer_size);
+-                    size += tx_buffer_size;
++                    if (size + tx_buffer_size > sizeof(buf)) {
++                        logout("bad flexible TCB with size 0x%04x\n", tx_buffer_size);
++                    } else {
++                        cpu_physical_memory_read(tx_buffer_address, &buf[size],
++                                                 tx_buffer_size);
++                        size += tx_buffer_size;
++                    }
+                     if (tx_buffer_el & 1) {
+                         break;
+                     }
+                 }
+             }
++            logout("%p sending frame, len=%d,%s\n", s, size, nic_dump(buf, size));
++            assert(size <= sizeof(buf));
+             qemu_send_packet(s->vc, buf, size);
+             s->statistics.tx_good_frames++;
+             /* Transmit with bad status would raise an CX/TNO interrupt.
Index: patch-bg
===================================================================
RCS file: /home/cvs/mports/emulators/qemu/files/patch-bg,v
retrieving revision 1.2
retrieving revision 1.3
diff -L emulators/qemu/files/patch-bg -L emulators/qemu/files/patch-bg -u -r1.2 -r1.3
--- emulators/qemu/files/patch-bg
+++ emulators/qemu/files/patch-bg
@@ -9,11 +9,11 @@
  ifndef CONFIG_USER_ONLY
  LIBS+=-lz
 Index: qemu/vl.c
-@@ -89,10 +89,12 @@
- #include "exec-all.h"
+@@ -133,10 +133,12 @@
  
  #define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
-+#ifndef SMBD_COMMAND
+ #define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
++#ifndef SMBD_COMMAND 
  #ifdef __sun__
  #define SMBD_COMMAND "/usr/sfw/sbin/smbd"
  #else
--- emulators/qemu/files/patch-bh
+++ /dev/null
@@ -1,26 +0,0 @@
-Index: qemu/dyngen-exec.h
-===================================================================
-RCS file: /cvsroot/qemu/qemu/dyngen-exec.h,v
-retrieving revision 1.12
-diff -w -u -d -r1.12 dyngen-exec.h
---- dyngen-exec.h	12 May 2004 19:32:15 -0000	1.12
-+++ dyngen-exec.h	21 May 2004 15:00:41 -0000
-@@ -21,6 +21,8 @@
- #define __DYNGEN_EXEC_H__
- 
- #include <stddef.h>
-+#include <stdio.h>
-+#include "config.h"
- 
- typedef unsigned char uint8_t;
- typedef unsigned short uint16_t;
-@@ -54,9 +56,6 @@
- #define UINT32_MAX		(4294967295U)
- #define UINT64_MAX		((uint64_t)(18446744073709551615))
- 
--typedef struct FILE FILE;
--extern int fprintf(FILE *, const char *, ...);
--extern int printf(const char *, ...);
- #undef NULL
- #define NULL 0
- #ifdef _BSD
--- emulators/qemu/files/patch-PRId64
+++ /dev/null
@@ -1,113 +0,0 @@
-Index: qemu/vl.h
-@@ -30,6 +30,12 @@
- #include <stdarg.h>
- #include <string.h>
- #include <inttypes.h>
-+#ifndef PRId64
-+#define	PRId64	"lld"	/* int64_t */
-+#define	PRIo64	"llo"	/* int64_t */
-+#define	PRIx64	"llx"	/* int64_t */
-+#define	PRIu64	"llu"	/* int64_t */
-+#endif
- #include <limits.h>
- #include <time.h>
- #include <ctype.h>
-Index: qemu/dis-asm.h
-@@ -13,6 +13,12 @@
- #include <stdio.h>
- #include <string.h>
- #include <inttypes.h>
-+#ifndef PRId64
-+#define	PRId64	"lld"	/* int64_t */
-+#define	PRIo64	"llo"	/* int64_t */
-+#define	PRIx64	"llx"	/* int64_t */
-+#define	PRIu64	"llu"	/* int64_t */
-+#endif
- 
- #define PARAMS(x) x
- typedef void *PTR;
-Index: qemu/kqemu.c
-@@ -33,6 +33,12 @@
- #include <errno.h>
- #include <unistd.h>
- #include <inttypes.h>
-+#ifndef PRId64
-+#define	PRId64	"lld"	/* int64_t */
-+#define	PRIo64	"llo"	/* int64_t */
-+#define	PRIx64	"llx"	/* int64_t */
-+#define	PRIu64	"llu"	/* int64_t */
-+#endif
- 
- #include "cpu.h"
- #include "exec-all.h"
-Index: qemu/translate-all.c
-@@ -22,6 +22,12 @@
- #include <stdio.h>
- #include <string.h>
- #include <inttypes.h>
-+#ifndef PRId64
-+#define	PRId64	"lld"	/* int64_t */
-+#define	PRIo64	"llo"	/* int64_t */
-+#define	PRIx64	"llx"	/* int64_t */
-+#define	PRIu64	"llu"	/* int64_t */
-+#endif
- 
- #include "config.h"
- 
-Index: qemu/target-i386/helper.c
-@@ -21,6 +21,13 @@
- 
- //#define DEBUG_PCALL
- 
-+#ifndef PRId64
-+#define	PRId64	"lld"	/* int64_t */
-+#define	PRIo64	"llo"	/* int64_t */
-+#define	PRIx64	"llx"	/* int64_t */
-+#define	PRIu64	"llu"	/* int64_t */
-+#endif
-+
- #if 0
- #define raise_exception_err(a, b)\
- do {\
-Index: qemu/target-i386/helper2.c
-@@ -22,6 +22,12 @@
- #include <stdio.h>
- #include <string.h>
- #include <inttypes.h>
-+#ifndef PRId64
-+#define	PRId64	"lld"	/* int64_t */
-+#define	PRIo64	"llo"	/* int64_t */
-+#define	PRIx64	"llx"	/* int64_t */
-+#define	PRIu64	"llu"	/* int64_t */
-+#endif
- #include <signal.h>
- #include <assert.h>
- 
-Index: qemu/target-ppc/translate.c
-@@ -22,6 +22,12 @@
- #include <stdio.h>
- #include <string.h>
- #include <inttypes.h>
-+#ifndef PRId64
-+#define	PRId64	"lld"	/* int64_t */
-+#define	PRIo64	"llo"	/* int64_t */
-+#define	PRIx64	"llx"	/* int64_t */
-+#define	PRIu64	"llu"	/* int64_t */
-+#endif
- 
- #include "cpu.h"
- #include "exec-all.h"
-Index: qemu/target-sparc/helper.c
-@@ -22,6 +22,12 @@
- #include <stdio.h>
- #include <string.h>
- #include <inttypes.h>
-+#ifndef PRId64
-+#define	PRId64	"lld"	/* int64_t */
-+#define	PRIo64	"llo"	/* int64_t */
-+#define	PRIx64	"llx"	/* int64_t */
-+#define	PRIu64	"llu"	/* int64_t */
-+#endif
- #include <signal.h>
- #include <assert.h>
- 
--- /dev/null
+++ emulators/qemu/files/patch-hw-vmware_vga.c
@@ -0,0 +1,12 @@
+Index: qemu/hw/vmware_vga.c
+@@ -26,8 +26,8 @@
+ #define VERBOSE
+ #define EMBED_STDVGA
+ #undef DIRECT_VRAM
+-#define HW_RECT_ACCEL
+-#define HW_FILL_ACCEL
++/* #define HW_RECT_ACCEL */
++/* #define HW_FILL_ACCEL */
+ #define HW_MOUSE_ACCEL
+ 
+ #ifdef EMBED_STDVGA
Index: patch-vl.c-nographic
===================================================================
RCS file: /home/cvs/mports/emulators/qemu/files/patch-vl.c-nographic,v
retrieving revision 1.1
retrieving revision 1.2
diff -L emulators/qemu/files/patch-vl.c-nographic -L emulators/qemu/files/patch-vl.c-nographic -u -r1.1 -r1.2
--- emulators/qemu/files/patch-vl.c-nographic
+++ emulators/qemu/files/patch-vl.c-nographic
@@ -1,8 +1,8 @@
 Index: qemu/vl.c
-@@ -4668,6 +4668,7 @@
+@@ -7131,6 +7131,7 @@
              case QEMU_OPTION_nographic:
-                 pstrcpy(monitor_device, sizeof(monitor_device), "stdio");
                  pstrcpy(serial_devices[0], sizeof(serial_devices[0]), "stdio");
+                 pstrcpy(monitor_device, sizeof(monitor_device), "stdio");
 +                pstrcpy(parallel_devices[0], sizeof(parallel_devices[0]), "null");
                  nographic = 1;
                  break;
Index: patch-bd
===================================================================
RCS file: /home/cvs/mports/emulators/qemu/files/patch-bd,v
retrieving revision 1.1
retrieving revision 1.2
diff -L emulators/qemu/files/patch-bd -L emulators/qemu/files/patch-bd -u -r1.1 -r1.2
--- emulators/qemu/files/patch-bd
+++ emulators/qemu/files/patch-bd
@@ -1,10 +1,10 @@
 Index: qemu/configure
-@@ -286,7 +286,7 @@
- if test -z "$prefix" ; then
-     prefix="/usr/local"
- fi
--mandir="$prefix/share/man"
-+mandir="$prefix/man"
- datadir="$prefix/share/qemu"
- docdir="$prefix/share/doc/qemu"
- bindir="$prefix/bin"
+@@ -570,7 +570,7 @@
+   if test -z "$prefix" ; then
+       prefix="/usr/local"
+   fi
+-  mansuffix="/share/man"
++  mansuffix="/man"
+   datasuffix="/share/qemu"
+   docsuffix="/share/doc/qemu"
+   binsuffix="/bin"
Index: patch-bt
===================================================================
RCS file: /home/cvs/mports/emulators/qemu/files/patch-bt,v
retrieving revision 1.1
retrieving revision 1.2
diff -L emulators/qemu/files/patch-bt -L emulators/qemu/files/patch-bt -u -r1.1 -r1.2
--- emulators/qemu/files/patch-bt
+++ emulators/qemu/files/patch-bt
@@ -1,15 +1,17 @@
 Index: qemu/vl.c
-@@ -43,6 +43,9 @@
- #ifndef __APPLE__
- #include <libutil.h>
+@@ -76,6 +76,11 @@
+ #endif
+ #endif
  #endif
 +#ifdef __FreeBSD__
++#include <sys/param.h>
 +#include <sys/module.h>
++#include <sys/linker.h>
 +#endif
- #else
- #include <linux/if.h>
- #include <linux/if_tun.h>
-@@ -1059,6 +1062,34 @@
+ 
+ #if defined(CONFIG_SLIRP)
+ #include "libslirp.h"
+@@ -3407,6 +3410,34 @@
  
  #endif /* CONFIG_SLIRP */
  
@@ -42,9 +44,9 @@
 +#endif
 +
  #if !defined(_WIN32)
- #ifdef _BSD
- static int tun_open(char *ifname, int ifname_size)
-@@ -1067,11 +1098,55 @@
+ 
+ typedef struct TAPState {
+@@ -3470,11 +3501,59 @@
      char *dev;
      struct stat s;
  
@@ -61,12 +63,14 @@
 +    i = 0;
 +#endif
 +    for (; i < 10; i++) {
-+        if (i == -1)
-+	    strcpy(dname, "/dev/tap");
++        if (*ifname)
++            snprintf(dname, sizeof dname, "/dev/%s", ifname);
++        else if (i == -1)
++            strcpy(dname, "/dev/tap");
 +        else
-+	    snprintf(dname, sizeof dname, "%s%d",
-+		     "/dev/tap", i);
-+        fd = open(dname, O_RDWR);
++            snprintf(dname, sizeof dname, "%s%d",
++        	     "/dev/tap", i);
++        TFR(fd = open(dname, O_RDWR));
 +        if (fd >= 0)
 +            break;
 +        else if (errno == ENXIO || errno == ENOENT) {
@@ -81,17 +85,19 @@
 +            }
 +            if (errno != ENOENT || ++enoentcount > 3) {
 +                err = errno;
-+	        break;
++                break;
 +            }
 +        } else
 +            err = errno;
++        if (*ifname)
++            break;
 +    }
 +    if (fd < 0) {
 +        fprintf(stderr, "warning: could not open %s (%s): no virtual network emulation\n", dname, strerror(err));
 +        return -1;
 +    }
 +#else
-     fd = open("/dev/tap", O_RDWR);
+     TFR(fd = open("/dev/tap", O_RDWR));
      if (fd < 0) {
 -        fprintf(stderr, "warning: could not open /dev/tap: no virtual network emulation\n");
 +        fprintf(stderr, "warning: could not open /dev/tap (%s): no virtual network emulation\n", strerror(errno));
Index: patch-vl.c
===================================================================
RCS file: /home/cvs/mports/emulators/qemu/files/patch-vl.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L emulators/qemu/files/patch-vl.c -L emulators/qemu/files/patch-vl.c -u -r1.2 -r1.3
--- emulators/qemu/files/patch-vl.c
+++ emulators/qemu/files/patch-vl.c
@@ -1,21 +1,4 @@
 Index: qemu/vl.c
-@@ -1510,7 +1510,7 @@
-     return chr;
- }
- 
--#if defined(__linux__)
-+#if defined(__linux__) || defined(__FreeBSD__)
- static CharDriverState *qemu_chr_open_pty(void)
- {
-     struct termios tty;
-@@ -1665,6 +1665,7 @@
-     return chr;
- }
- 
-+#if defined(__linux__)
- static int pp_ioctl(CharDriverState *chr, int cmd, void *arg)
- {
-     int fd = (int)chr->opaque;
 @@ -1727,6 +1728,7 @@
      chr->chr_ioctl = pp_ioctl;
      return chr;
@@ -24,3 +7,49 @@
  
  #else
  CharDriverState *qemu_chr_open_pty(void)
+@@ -1771,14 +1771,14 @@
+     return chr;
+ }
+ 
+-#if defined(__linux__) || defined(__sun__)
++#if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__)
+ static CharDriverState *qemu_chr_open_pty(void)
+ {
+     struct termios tty;
+     char slave_name[1024];
+     int master_fd, slave_fd;
+  
+-#if defined(__linux__)
++#if defined(__linux__) || defined(__FreeBSD__)
+     /* Not satisfying */
+     if (openpty(&master_fd, &slave_fd, slave_name, NULL, NULL) < 0) {
+         return NULL;
+@@ -3036,7 +3036,7 @@
+         return qemu_chr_open_pp(filename);
+     } else 
+ #endif
+-#if defined(__linux__) || defined(__sun__)
++#if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__)
+     if (strstart(filename, "/dev/", NULL)) {
+         return qemu_chr_open_tty(filename);
+     } else
+@@ -8423,6 +8423,11 @@
+     nb_nics = 0;
+     /* default mac address of the first network interface */
+ 
++#ifdef __FreeBSD__
++    if (modfind("aio") == -1)
++        fprintf(stderr, "warning: aio not (kld)loaded, may cause `Invalid system call' traps on disk IO\n");
++#endif
++
+     optind = 1;
+     for(;;) {
+         if (optind >= argc)
+@@ -8784,6 +8784,7 @@
+ #ifdef TARGET_ARM
+             case QEMU_OPTION_old_param:
+                 old_param = 1;
++                break;
+ #endif
+             case QEMU_OPTION_clock:
+                 configure_alarms(optarg);
--- emulators/qemu/files/patch-block-raw.c
+++ /dev/null
@@ -1,51 +0,0 @@
-Index: qemu/block-raw.c
-@@ -51,7 +51,10 @@
- #include <linux/cdrom.h>
- #include <linux/fd.h>
- #endif
- #ifdef __FreeBSD__
-+#include <signal.h>
-+#endif
-+#if defined(__FreeBSD__) && __FreeBSD__ > 4
- #include <sys/disk.h>
- #endif
- 
-@@ -167,9 +167,20 @@
- static int aio_sig_num = SIGUSR2;
- static RawAIOCB *first_aio; /* AIO issued */
- static int aio_initialized = 0;
-+// FreeBSD 4.x doesn't have sigwait
-+#if defined(__FreeBSD__) && __FreeBSD__ <= 4
-+static int sigaio_dont = 0;
-+#endif
- 
- static void aio_signal_handler(int signum)
- {
-+// FreeBSD 4.x doesn't have sigwait
-+#if defined(__FreeBSD__) && __FreeBSD__ <= 4
-+    if (sigaio_dont) {
-+	--sigaio_dont;
-+	return;
-+    }
-+#endif
- #ifndef QEMU_TOOL
-     CPUState *env = cpu_single_env;
-     if (env) {
-@@ -284,9 +295,17 @@
-     if (qemu_bh_poll())
-         return;
- #endif
-+// FreeBSD 4.x doesn't have sigwait
-+#if defined(__FreeBSD__) && __FreeBSD__ <= 4
-+    ++sigaio_dont;
-+    do
-+	sigsuspend(&wait_oset);
-+    while (sigaio_dont);
-+#else
-     sigemptyset(&set);
-     sigaddset(&set, aio_sig_num);
-     sigwait(&set, &nb_sigs);
-+#endif
-     qemu_aio_poll();
- }
- 
Index: patch-vl.c-ppbus
===================================================================
RCS file: /home/cvs/mports/emulators/qemu/files/patch-vl.c-ppbus,v
retrieving revision 1.2
retrieving revision 1.3
diff -L emulators/qemu/files/patch-vl.c-ppbus -L emulators/qemu/files/patch-vl.c-ppbus -u -r1.2 -r1.3
--- emulators/qemu/files/patch-vl.c-ppbus
+++ emulators/qemu/files/patch-vl.c-ppbus
@@ -1,20 +1,21 @@
---- vl.c.orig	Mon Aug 21 23:06:11 2006
-+++ vl.c	Mon Aug 21 23:04:49 2006
-@@ -48,6 +48,8 @@
+Index: qemu/vl.c
+@@ -78,8 +78,10 @@
  #endif
  #ifdef __FreeBSD__
+ #include <sys/param.h>
  #include <sys/module.h>
+ #include <sys/linker.h>
 +#include <dev/ppbus/ppi.h>
 +#include <dev/ppbus/ppbconf.h>
  #endif
- #else
- #ifndef __sun__
+ 
+ #if defined(CONFIG_SLIRP)
 @@ -1728,7 +1730,64 @@
      chr->chr_ioctl = pp_ioctl;
      return chr;
  }
 -#endif /* defined(__linux__) */
-+#elif defined(__FreeBSD__)
++#if defined(__FreeBSD__)
 +static int pp_ioctl(CharDriverState *chr, int cmd, void *arg)
 +{
 +    int fd = (int)chr->opaque;
--- /dev/null
+++ emulators/qemu/files/patch-CVE-2008-0928
@@ -0,0 +1,242 @@
+Index: qemu/block-qcow.c
+===================================================================
+RCS file: /sources/qemu/qemu/block-qcow.c,v
+retrieving revision 1.15
+retrieving revision 1.16
+diff -u -p -u -p -r1.15 -r1.16
+--- block-qcow.c	11 Nov 2007 02:51:16 -0000	1.15
++++ block-qcow.c	11 Mar 2008 17:17:58 -0000	1.16
+@@ -95,7 +95,7 @@ static int qcow_open(BlockDriverState *b
+     int len, i, shift, ret;
+     QCowHeader header;
+ 
+-    ret = bdrv_file_open(&s->hd, filename, flags);
++    ret = bdrv_file_open(&s->hd, filename, flags | BDRV_O_AUTOGROW);
+     if (ret < 0)
+         return ret;
+     if (bdrv_pread(s->hd, 0, &header, sizeof(header)) != sizeof(header))
+Index: qemu/block-qcow2.c
+===================================================================
+RCS file: /sources/qemu/qemu/block-qcow2.c,v
+retrieving revision 1.10
+retrieving revision 1.11
+diff -u -p -u -p -r1.10 -r1.11
+--- block-qcow2.c	11 Nov 2007 02:51:16 -0000	1.10
++++ block-qcow2.c	11 Mar 2008 17:17:58 -0000	1.11
+@@ -191,7 +191,7 @@ static int qcow_open(BlockDriverState *b
+     int len, i, shift, ret;
+     QCowHeader header;
+ 
+-    ret = bdrv_file_open(&s->hd, filename, flags);
++    ret = bdrv_file_open(&s->hd, filename, flags | BDRV_O_AUTOGROW);
+     if (ret < 0)
+         return ret;
+     if (bdrv_pread(s->hd, 0, &header, sizeof(header)) != sizeof(header))
+Index: qemu/block-vmdk.c
+===================================================================
+RCS file: /sources/qemu/qemu/block-vmdk.c,v
+retrieving revision 1.19
+retrieving revision 1.20
+diff -u -p -u -p -r1.19 -r1.20
+--- block-vmdk.c	14 Jan 2008 03:48:37 -0000	1.19
++++ block-vmdk.c	11 Mar 2008 17:17:58 -0000	1.20
+@@ -378,7 +378,7 @@ static int vmdk_open(BlockDriverState *b
+         flags = BDRV_O_RDONLY;
+     fprintf(stderr, "(VMDK) image open: flags=0x%x filename=%s\n", flags, bs->filename);
+ 
+-    ret = bdrv_file_open(&s->hd, filename, flags);
++    ret = bdrv_file_open(&s->hd, filename, flags | BDRV_O_AUTOGROW);
+     if (ret < 0)
+         return ret;
+     if (bdrv_pread(s->hd, 0, &magic, sizeof(magic)) != sizeof(magic))
+Index: qemu/block.c
+===================================================================
+RCS file: /sources/qemu/qemu/block.c,v
+retrieving revision 1.54
+retrieving revision 1.55
+diff -u -p -u -p -r1.54 -r1.55
+--- block.c	10 Mar 2008 00:05:34 -0000	1.54
++++ block.c	11 Mar 2008 17:17:58 -0000	1.55
+@@ -123,6 +123,60 @@ void path_combine(char *dest, int dest_s
+     }
+ }
+ 
++static int bdrv_rd_badreq_sectors(BlockDriverState *bs,
++                                  int64_t sector_num, int nb_sectors)
++{
++    return
++        nb_sectors < 0 ||
++        sector_num < 0 ||
++        nb_sectors > bs->total_sectors ||
++        sector_num > bs->total_sectors - nb_sectors;
++}
++
++static int bdrv_rd_badreq_bytes(BlockDriverState *bs,
++                                int64_t offset, int count)
++{
++    int64_t size = bs->total_sectors << SECTOR_BITS;
++    return
++        count < 0 ||
++        size < 0 ||
++        count > size ||
++        offset > size - count;
++}
++
++static int bdrv_wr_badreq_sectors(BlockDriverState *bs,
++                                  int64_t sector_num, int nb_sectors)
++{
++    if (sector_num < 0 ||
++        nb_sectors < 0)
++        return 1;
++
++    if (sector_num > bs->total_sectors - nb_sectors) {
++        if (bs->autogrow)
++            bs->total_sectors = sector_num + nb_sectors;
++        else
++            return 1;
++    }
++    return 0;
++}
++
++static int bdrv_wr_badreq_bytes(BlockDriverState *bs,
++                                int64_t offset, int count)
++{
++    int64_t size = bs->total_sectors << SECTOR_BITS;
++    if (count < 0 ||
++        offset < 0)
++        return 1;
++
++    if (offset > size - count) {
++        if (bs->autogrow)
++            bs->total_sectors = (offset + count + SECTOR_SIZE - 1) >> SECTOR_BITS;
++        else
++            return 1;
++    }
++    return 0;
++}
++
+ 
+ static void bdrv_register(BlockDriver *bdrv)
+ {
+@@ -335,6 +389,10 @@ int bdrv_open2(BlockDriverState *bs, con
+     bs->read_only = 0;
+     bs->is_temporary = 0;
+     bs->encrypted = 0;
++    bs->autogrow = 0;
++
++    if (flags & BDRV_O_AUTOGROW)
++        bs->autogrow = 1;
+ 
+     if (flags & BDRV_O_SNAPSHOT) {
+         BlockDriverState *bs1;
+@@ -379,6 +437,7 @@ int bdrv_open2(BlockDriverState *bs, con
+     }
+     bs->drv = drv;
+     bs->opaque = qemu_mallocz(drv->instance_size);
++    bs->total_sectors = 0; /* driver will set if it does not do getlength */
+     if (bs->opaque == NULL && drv->instance_size > 0)
+         return -1;
+     /* Note: for compatibility, we open disk image files as RDWR, and
+@@ -444,6 +503,7 @@ void bdrv_close(BlockDriverState *bs)
+         bs->drv = NULL;
+ 
+         /* call the change callback */
++        bs->total_sectors = 0;
+         bs->media_changed = 1;
+         if (bs->change_cb)
+             bs->change_cb(bs->change_opaque);
+@@ -509,6 +569,8 @@ int bdrv_read(BlockDriverState *bs, int6
+     if (!drv)
+         return -ENOMEDIUM;
+ 
++    if (bdrv_rd_badreq_sectors(bs, sector_num, nb_sectors))
++        return -EDOM;
+     if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {
+             memcpy(buf, bs->boot_sector_data, 512);
+         sector_num++;
+@@ -549,6 +611,8 @@ int bdrv_write(BlockDriverState *bs, int
+         return -ENOMEDIUM;
+     if (bs->read_only)
+         return -EACCES;
++    if (bdrv_wr_badreq_sectors(bs, sector_num, nb_sectors))
++        return -EDOM;
+     if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {
+         memcpy(bs->boot_sector_data, buf, 512);
+     }
+@@ -674,6 +738,8 @@ int bdrv_pread(BlockDriverState *bs, int
+         return -ENOMEDIUM;
+     if (!drv->bdrv_pread)
+         return bdrv_pread_em(bs, offset, buf1, count1);
++    if (bdrv_rd_badreq_bytes(bs, offset, count1))
++        return -EDOM;
+     return drv->bdrv_pread(bs, offset, buf1, count1);
+ }
+ 
+@@ -689,6 +755,8 @@ int bdrv_pwrite(BlockDriverState *bs, in
+         return -ENOMEDIUM;
+     if (!drv->bdrv_pwrite)
+         return bdrv_pwrite_em(bs, offset, buf1, count1);
++    if (bdrv_wr_badreq_bytes(bs, offset, count1))
++        return -EDOM;
+     return drv->bdrv_pwrite(bs, offset, buf1, count1);
+ }
+ 
+@@ -955,6 +1023,8 @@ int bdrv_write_compressed(BlockDriverSta
+         return -ENOMEDIUM;
+     if (!drv->bdrv_write_compressed)
+         return -ENOTSUP;
++    if (bdrv_wr_badreq_sectors(bs, sector_num, nb_sectors))
++        return -EDOM;
+     return drv->bdrv_write_compressed(bs, sector_num, buf, nb_sectors);
+ }
+ 
+@@ -1101,6 +1171,8 @@ BlockDriverAIOCB *bdrv_aio_read(BlockDri
+ 
+     if (!drv)
+         return NULL;
++    if (bdrv_rd_badreq_sectors(bs, sector_num, nb_sectors))
++        return NULL;
+ 
+     /* XXX: we assume that nb_sectors == 0 is suppored by the async read */
+     if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {
+@@ -1132,6 +1204,8 @@ BlockDriverAIOCB *bdrv_aio_write(BlockDr
+         return NULL;
+     if (bs->read_only)
+         return NULL;
++    if (bdrv_wr_badreq_sectors(bs, sector_num, nb_sectors))
++        return NULL;
+     if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {
+         memcpy(bs->boot_sector_data, buf, 512);
+     }
+Index: qemu/block.h
+===================================================================
+RCS file: /sources/qemu/qemu/block.h,v
+retrieving revision 1.6
+retrieving revision 1.7
+diff -u -p -u -p -r1.6 -r1.7
+--- block.h	24 Dec 2007 16:10:43 -0000	1.6
++++ block.h	11 Mar 2008 17:17:59 -0000	1.7
+@@ -45,6 +45,7 @@ typedef struct QEMUSnapshotInfo {
+                                      it (default for
+                                      bdrv_file_open()) */
+ #define BDRV_O_DIRECT      0x0020
++#define BDRV_O_AUTOGROW    0x0040 /* Allow backing file to extend when writing past end of file */
+ 
+ #ifndef QEMU_IMG
+ void bdrv_info(void);
+Index: qemu/block_int.h
+===================================================================
+RCS file: /sources/qemu/qemu/block_int.h,v
+retrieving revision 1.16
+retrieving revision 1.17
+diff -u -p -u -p -r1.16 -r1.17
+--- block_int.h	24 Dec 2007 16:10:43 -0000	1.16
++++ block_int.h	11 Mar 2008 17:17:59 -0000	1.17
+@@ -97,6 +97,7 @@ struct BlockDriverState {
+     int locked;    /* if true, the media cannot temporarily be ejected */
+     int encrypted; /* if true, the media is encrypted */
+     int sg;        /* if true, the device is a /dev/sg* */
++    int autogrow;  /* if true, the backing store can auto-extend to allocate new extents */
+     /* event callback when inserting/removing */
+     void (*change_cb)(void *opaque);
+     void *change_opaque;
Index: patch-qemu-img.c
===================================================================
RCS file: /home/cvs/mports/emulators/qemu/files/patch-qemu-img.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -L emulators/qemu/files/patch-qemu-img.c -L emulators/qemu/files/patch-qemu-img.c -u -r1.1 -r1.2
--- emulators/qemu/files/patch-qemu-img.c
+++ emulators/qemu/files/patch-qemu-img.c
@@ -1,10 +1,10 @@
 Index: qemu/qemu-img.c
-@@ -134,7 +134,7 @@
+@@ -90,7 +90,7 @@
             "Command syntax:\n"
-            "  create [-e] [-b base_image] [-f fmt] filename [size]\n"
+            "  create [-e] [-6] [-b base_image] [-f fmt] filename [size]\n"
             "  commit [-f fmt] filename\n"
--           "  convert [-c] [-e] [-f fmt] filename [-O output_fmt] output_filename\n"
-+           "  convert [-c] [-e] [-f fmt] [-O output_fmt] filename output_filename\n"
+-           "  convert [-c] [-e] [-6] [-f fmt] filename [filename2 [...]] [-O output_fmt] output_filename\n"
++           "  convert [-c] [-e] [-6] [-f fmt] [-O output_fmt] filename [filename2 [...]] output_filename\n"
             "  info [-f fmt] filename\n"
             "\n"
             "Command parameters:\n"
Index: patch-ac
===================================================================
RCS file: /home/cvs/mports/emulators/qemu/files/patch-ac,v
retrieving revision 1.1
retrieving revision 1.2
diff -L emulators/qemu/files/patch-ac -L emulators/qemu/files/patch-ac -u -r1.1 -r1.2
--- emulators/qemu/files/patch-ac
+++ emulators/qemu/files/patch-ac
@@ -1,10 +1,10 @@
 Index: qemu/configure
-@@ -204,7 +204,7 @@
+@@ -540,7 +540,7 @@
+ sdl_too_old=no
  
  if test -z "$sdl" ; then
- 
--sdl_config="sdl-config"
-+sdl_config="${SDL_CONFIG}"
- sdl=no
- sdl_static=no
+-    sdl_config="sdl-config"
++    sdl_config="${SDL_CONFIG}"
+     sdl=no
+     sdl_static=no
  
Index: patch-be
===================================================================
RCS file: /home/cvs/mports/emulators/qemu/files/patch-be,v
retrieving revision 1.1
retrieving revision 1.2
diff -L emulators/qemu/files/patch-be -L emulators/qemu/files/patch-be -u -r1.1 -r1.2
--- emulators/qemu/files/patch-be
+++ emulators/qemu/files/patch-be
@@ -1,15 +1,3 @@
-Index: qemu/Makefile.target
-@@ -404,7 +404,9 @@
- ifndef CONFIG_DARWIN
- ifndef CONFIG_WIN32
- ifndef CONFIG_SOLARIS
--VL_LIBS=-lutil -lrt
-+#VL_LIBS=-lutil -lrt
-+# XXX this cant be just merged back...
-+VL_LIBS=-lutil
- endif
- endif
- endif
 Index: qemu/vl.c
 @@ -541,7 +541,7 @@
  static void init_get_clock(void)
--- emulators/qemu/files/patch-audio::ossaudio.c
+++ /dev/null
@@ -1,11 +0,0 @@
-Index: qemu/audio/ossaudio.c
-@@ -21,8 +21,8 @@
-  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-  * THE SOFTWARE.
-  */
--#include <sys/mman.h>
- #include <sys/types.h>
-+#include <sys/mman.h>
- #include <sys/ioctl.h>
- #include <sys/soundcard.h>
- #include <assert.h>
Index: patch-fbsd
===================================================================
RCS file: /home/cvs/mports/emulators/qemu/files/patch-fbsd,v
retrieving revision 1.1
retrieving revision 1.2
diff -L emulators/qemu/files/patch-fbsd -L emulators/qemu/files/patch-fbsd -u -r1.1 -r1.2
--- emulators/qemu/files/patch-fbsd
+++ emulators/qemu/files/patch-fbsd
@@ -20,17 +20,16 @@
  	rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS *.pod *~ */*~
  	$(MAKE) -C tests clean
 Index: qemu/Makefile.target
-@@ -391,8 +391,8 @@
- VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
+@@ -571,7 +571,7 @@
+ SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
  endif
  
--$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
--	$(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
-+$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a ../bsd/libmath.a
-+	$(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS) ../bsd/libmath.a
+-$(QEMU_SYSTEM): $(VL_OBJS) ../libqemu_common.a libqemu.a
+- 	$(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
++$(QEMU_SYSTEM): $(VL_OBJS) ../libqemu_common.a libqemu.a ../bsd/libmath.a
++	$(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS) ../bsd/libmath.a
  
- cocoa.o: cocoa.m
- 	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
+ depend: $(SRCS)
 Index: qemu/fpu/softfloat-native.c
 @@ -2,11 +2,16 @@
     context is supported */
Index: patch-qemu-img.texi
===================================================================
RCS file: /home/cvs/mports/emulators/qemu/files/patch-qemu-img.texi,v
retrieving revision 1.1
retrieving revision 1.2
diff -L emulators/qemu/files/patch-qemu-img.texi -L emulators/qemu/files/patch-qemu-img.texi -u -r1.1 -r1.2
--- emulators/qemu/files/patch-qemu-img.texi
+++ emulators/qemu/files/patch-qemu-img.texi
@@ -1,10 +1,10 @@
 Index: qemu/qemu-img.texi
 @@ -10,7 +10,7 @@
  @table @option
- @item create [-e] [-b @var{base_image}] [-f @var{fmt}] @var{filename} [@var{size}]
+ @item create [-e] [-6] [-b @var{base_image}] [-f @var{fmt}] @var{filename} [@var{size}]
  @item commit [-f @var{fmt}] @var{filename}
-- at item convert [-c] [-e] [-f @var{fmt}] @var{filename} [-O @var{output_fmt}] @var{output_filename}
-+ at item convert [-c] [-e] [-f @var{fmt}] [-O @var{output_fmt}] @var{filename} @var{output_filename}
+- at item convert [-c] [-e] [-6] [-f @var{fmt}] @var{filename} [-O @var{output_fmt}] @var{output_filename}
++ at item convert [-c] [-e] [-6] [-f @var{fmt}] [-O @var{output_fmt}] @var{filename} @var{output_filename}
  @item info [-f @var{fmt}] @var{filename}
  @end table
  
Index: patch-bk
===================================================================
RCS file: /home/cvs/mports/emulators/qemu/files/patch-bk,v
retrieving revision 1.1
retrieving revision 1.2
diff -L emulators/qemu/files/patch-bk -L emulators/qemu/files/patch-bk -u -r1.1 -r1.2
--- emulators/qemu/files/patch-bk
+++ emulators/qemu/files/patch-bk
@@ -97,7 +97,7 @@
 -    dprintf("bootp packet op=%d msgtype=%d\n", bp->bp_op, dhcp_msg_type);
 +    dhcp_decode(bp->bp_vend, DHCP_OPT_LEN, &dhcp_msg_type,&reqaddr);
 +    dprintf("bootp packet op=%d msgtype=%d reqaddr=%x\n", bp->bp_op, dhcp_msg_type,ntohl(reqaddr.sin_addr.s_addr));
-     
+  
      if (dhcp_msg_type == 0)
          dhcp_msg_type = DHCPREQUEST; /* Force reply for old BOOTP clients */
 @@ -152,21 +185,18 @@
@@ -122,14 +122,14 @@
 +    bc=NULL;
 +    daddr.sin_addr.s_addr=htonl(0L);
 +    if (dhcp_msg_type == DHCPREQUEST) {
-+ 	   if (reqaddr.sin_addr.s_addr != htonl(0L))
-+ 		   bc = find_reqaddr(&daddr.sin_addr, &reqaddr.sin_addr, bp->bp_hwaddr);
-+ 	   else 
-+ 		   bc = find_addr(&daddr.sin_addr, bp->bp_hwaddr);
++            if (reqaddr.sin_addr.s_addr != htonl(0L))
++                    bc = find_reqaddr(&daddr.sin_addr, &reqaddr.sin_addr, bp->bp_hwaddr);
++            else 
++                    bc = find_addr(&daddr.sin_addr, bp->bp_hwaddr);
 +    }
 +    else if (dhcp_msg_type == DHCPDISCOVER) {
-+ 	   bc = find_addr(&daddr.sin_addr, bp->bp_hwaddr);
-+ 	   if (!bc)
++            bc = find_addr(&daddr.sin_addr, bp->bp_hwaddr);
++            if (!bc)
 +	       bc = get_new_addr(&daddr.sin_addr);
      }
      dprintf("offered addr=%08x\n", ntohl(daddr.sin_addr.s_addr));
@@ -165,7 +165,7 @@
 -        *q++ = DHCPACK;
 -    }
 +    *q++ = replytype;
-         
+  
 -    if (dhcp_msg_type == DHCPDISCOVER ||
 -        dhcp_msg_type == DHCPREQUEST) {
 +    if ((dhcp_msg_type == DHCPDISCOVER ||


More information about the Midnightbsd-cvs mailing list