Fix CVE-2007-1320, CVE-2007-1321 , CVE-2007-1322, CVE-2007-1323 and CVE-2007-1366
PATCH 1/1 Fix CVE-2007-1320, CVE-2007-1321 , CVE-2007-1322, CVE-2007-1323 and CVE-2007-1366
Hi;
If anybody interested, attached patch (against 3.0.4) fixes CVE-2007-1320, CVE-2007-1321 , CVE-2007-1322, CVE-2007-1323 and CVE-2007-1366 which affects qemu and also seems valid for xen.
Cheers
Signature · 4 lines
S.Çağlar Onur <[email protected]> http://cekirdek.pardus.org.tr/~caglar/ Linux is like living in a teepee. No Windows, no Gates and an Apache in house!
tools/ioemu/block.c +7 -0
@@ -458,8 +458,15 @@ int bdrv_write(BlockDriverState *bs, intreturn -1 ;if (bs->read_only)return -1 ; +if (sector_num <0 ) +return -1 ;if (sector_num ==0 && bs->boot_sector_enabled && nb_sectors >0 ) {memcpy (bs->boot_sector_data, buf,512 ); + } + { +unsigned int ns = sector_num *512 ; +if (ns <0 ) +return -1 ; }return bs->drv->bdrv_write (bs, sector_num, buf, nb_sectors); }
tools/ioemu/hw/cirrus_vga.c +43 -13
117 lines not on this page · raw message
tools/ioemu/hw/cirrus_vga_rop.h +6 -0
@@ -31,6 +31,12 @@ glue(cirrus_bitblt_rop_fwd_, ROP_NAME)(Cint x,y; dstpitch -= bltwidth; srcpitch -= bltwidth; + +if (dstpitch <0 || srcpitch <0 ) { +/* is 0 valid? srcpitch == 0 could be useful */ +return ; + } +for (y =0 ; y < bltheight; y++) {for (x =0 ; x < bltwidth; x++) {ROP_OP (*dst, *src);
tools/ioemu/hw/dma.c +5 -3
@@ -340,9 +340,11 @@ static void channel_run (int ncont, int#endif r = dma_controllers[ncont].regs + ichan; - n = r->transfer_handler (r->opaque, ichan + (ncont <<2 ), - r->now[COUNT ], (r->base[COUNT ] +1 ) << ncont); - r->now[COUNT ] = n; +if (r->transfer_handler) { + n = r->transfer_handler (r->opaque, ichan + (ncont <<2 ), + r->now[COUNT ], (r->base[COUNT ] +1 ) << ncont); + r->now[COUNT ] = n; + }ldebug ("dma_pos %d size %d\n" , n, (r->base[COUNT ] +1 ) << ncont); }
tools/ioemu/hw/fdc.c +7 -2
@@ -1110,8 +1110,13 @@ static uint32_t fdctrl_read_data (fdctrl 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); +if (cur_drv->bs) { +bdrv_read (cur_drv->bs,fd_sector (cur_drv), + fdctrl->fifo, len); + }else { +FLOPPY_ERROR ("can't read data from drive\n" ); +return 0 ; + } } } retval = fdctrl->fifo[pos];
tools/ioemu/hw/i8259.c +4 -2
@@ -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 ;
tools/ioemu/hw/ne2000.c +6 -2
@@ -252,7 +252,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 };
@@ -327,7 +327,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;
tools/ioemu/hw/pc.c +4 -2
@@ -327,7 +327,8 @@ void bochs_bios_write(void *opaque, uintcase 0x400 :case 0x401 :fprintf (stderr,"BIOS panic at rombios.c, line %d\n" , val); -exit (1 ); +/* according to documentation, these can be safely ignored */ +break ;case 0x402 :case 0x403 :#ifdef DEBUG_BIOS
@@ -350,8 +351,9 @@ void bochs_bios_write(void *opaque, uint/* LGPL'ed VGA BIOS messages */ case 0x501 :case 0x502 : +/* according to documentation, these can be safely ignored */ fprintf (stderr,"VGA BIOS panic, line %d\n" , val); -exit (1 ); +break ;case 0x500 :case 0x503 :#ifdef DEBUG_BIOS
tools/ioemu/hw/sb16.c +4 -2
@@ -1235,8 +1235,10 @@ static int SB_read_DMA (void *opaque, in s->block_size);#endif -while (s->left_till_irq <=0 ) { - s->left_till_irq = s->block_size + s->left_till_irq; +if (s->block_size) { +while (s->left_till_irq <=0 ) { + s->left_till_irq = s->block_size + s->left_till_irq; + } }return dma_pos;
tools/ioemu/target-i386/translate.c +8 -1
@@ -5244,7 +5244,12 @@ static target_ulong disas_insn(DisasContif (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(DisasContgen_jmp_im (pc_start - s->cs_base);gen_op_into (s->pc - pc_start);break ; +#ifdef WANT_ICEBP case 0xf1 :/* icebp (undocumented, exits to external debugger) */ #if 1 gen_debug (s, pc_start - s->cs_base);
@@ -5301,6 +5307,7 @@ static target_ulong disas_insn(DisasContcpu_set_log (CPU_LOG_INT |CPU_LOG_TB_IN_ASM );#endif break ; +#endif /* icebp */ case 0xfa :/* cli */ if (!s->vm86) {if (s->cpl <= s->iopl) {
tools/ioemu/vl.c +13 -4
@@ -3239,8 +3239,8 @@ typedef struct NetSocketState {VLANClientState *vc;int fd;int state;/* 0 = getting length, 1 = getting data */ -int index; -int packet_len; +unsigned int index; +unsigned int packet_len;uint8_t buf[4096 ];struct sockaddr_in dgram_dst;/* contains inet host and port destination iff connectionless (SOCK_DGRAM) */ } NetSocketState;
@@ -3271,7 +3271,8 @@ static void net_socket_send(void *opaquestatic void net_socket_send (void *opaque) {NetSocketState *s = opaque; -int l, size, err; +int size, err; +unsigned l;uint8_t buf1[4096 ];const uint8_t *buf;
@@ -3310,7 +3311,15 @@ static void net_socket_send(void *opaque l = s->packet_len - s->index;if (l > size) l = size; -memcpy (s->buf + s->index, buf, l); +if (s->index + l <=sizeof (s->buf)) { +memcpy (s->buf + s->index, buf, l); + }else { +fprintf (stderr,"serious error: oversized packet received," +"connection terminated.\n" ); + s->state =0 ; + goto eoc; + } + s->index += l; buf += l; size -= l;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 3 lines · S.Çağlar Onur
If anybody interested, attached patch (against 3.0.4) fixes CVE-2007-1320, CVE-2007-1321 , CVE-2007-1322, CVE-2007-1323 and CVE-2007-1366 which affects qemu and also seems valid for xen.
Is the patch from upstream qemu? We have our own patches to fix these issues in 3.0.5-rc, but we'd consider an alternative that keeps us closer to upstream qemu (albeit a later qemu than we build against).
-- Keir
01 May 2007 Sal tarihinde, Keir Fraser şunları yazmıştı:
Quoted 8 lines · S.Çağlar Onur
Quoted 3 lines
If anybody interested, attached patch (against 3.0.4) fixes CVE-2007-1320, CVE-2007-1321 , CVE-2007-1322, CVE-2007-1323 and CVE-2007-1366 which affects qemu and also seems valid for xen.
Is the patch from upstream qemu? We have our own patches to fix these issues in 3.0.5-rc, but we'd consider an alternative that keeps us closer to upstream qemu (albeit a later qemu than we build against).
I'm not sure these go into upstream or not but our security team grabbed this from Debian [1].
P.S: while i get your attention :) is it possible to push both 3.0.4 and 3.0.5 CVEish patches into trees, we have 15 pending patch in our package which submitted to list and xen-bugzilla long before?
[1]
http://security.debian.org/pool/updates/main/q/qemu/qemu_0.8.2-4etch1.diff.gz
Signature · 4 lines
S.Çağlar Onur <[email protected]> http://cekirdek.pardus.org.tr/~caglar/ Linux is like living in a teepee. No Windows, no Gates and an Apache in house!
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 3 lines · S.Çağlar Onur
P.S: while i get your attention :) is it possible to push both 3.0.4 and 3.0.5 CVEish patches into trees, we have 15 pending patch in our package which submitted to list and xen-bugzilla long before?
I don't believe I have any outstanding patches for 3.0.5. Please send any that you think are critical. There's no plan to do a 3.0.4-2 in the immediate future.
-- Keir
01 May 2007 Sal tarihinde, Keir Fraser şunları yazmıştı:
Quoted 8 lines · S.Çağlar Onur
Quoted 3 lines
P.S: while i get your attention :) is it possible to push both 3.0.4 and 3.0.5 CVEish patches into trees, we have 15 pending patch in our package which submitted to list and xen-bugzilla long before?I don't believe I have any outstanding patches for 3.0.5. Please send any that you think are critical. There's no plan to do a 3.0.4-2 in the immediate future.
Hmm i think there are some :)
I have following patches on top of current 3.0.5-testing tree, this series contains all released CVE's from 2.6.18 to up until now (linus's current git), only CVE-2007-2242 ( IPV6: Disallow RH0 by default.) is missing...
[caglar@zangetsu][~/buildbox/xen/linux-2.6.18/patches]> quilt series linux-2.6-xen.patch <-- "make mkpatches" of current tree CVE-2005-4352.patch
CVE-2006-4814.patch
CVE-2006-5619.patch
CVE-2006-5749.patch
CVE-2006-5751.patch
CVE-2006-5753.patch
CVE-2006-5757-CVE-2006-6060.patch
CVE-2006-5823.patch
CVE-2006-6053.patch
CVE-2006-6054.patch
CVE-2006-6056.patch
CVE-2006-6106.patch
CVE-2006-6333.patch
CVE-2007-0005.patch
CVE-2007-0006.patch
CVE-2007-0772.patch
CVE-2007-0958.patch
CVE-2007-1000.patch
CVE-2007-1217.patch
CVE-2007-1388.patch
CVE-2007-1497.patch
CVE-2007-1592.patch
CVE-2007-1861.patch
CVE-2007-2172.patch
Instead of submitting all these patches to mailing list i just upload to [1]
[1] http://cekirdek.pardus.org.tr/~caglar/patches/
Cheers
Signature · 4 lines
S.Çağlar Onur <[email protected]> http://cekirdek.pardus.org.tr/~caglar/ Linux is like living in a teepee. No Windows, no Gates and an Apache in house!
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 5 lines · S.Çağlar Onur
Hmm i think there are some :)
I have following patches on top of current 3.0.5-testing tree, this series contains all released CVE's from 2.6.18 to up until now (linus's current git), only CVE-2007-2242 ( IPV6: Disallow RH0 by default.) is missing...
Presumably we'd get most of these by upgrading to linux-2.6.18.8?
-- Keir
01 May 2007 Sal tarihinde, Keir Fraser şunları yazmıştı:
Quoted 9 lines · S.Çağlar Onur
Quoted 6 lines
Hmm i think there are some :)
I have following patches on top of current 3.0.5-testing tree, this series contains all released CVE's from 2.6.18 to up until now (linus's current git), only CVE-2007-2242 ( IPV6: Disallow RH0 by default.) is missing...
Presumably we'd get most of these by upgrading to linux-2.6.18.8?
8 of them are in 2.6.18.8 others are backported/applied etc,
CVE-2005-4352.patch <- solved with 2.6.18.3 CVE-2006-4814.patch <- solved with 2.6.18.8 CVE-2006-5619.patch <- solved with 2.6.18.2 CVE-2006-5749.patch <- solved with 2.6.20-rc2 CVE-2006-5751.patch <- solved with 2.6.18.4 CVE-2006-5753.patch <- solved with 2.6.20-rc4 CVE-2006-5757-CVE-2006-6060.patch <- solved in 2.6.18.8 CVE-2006-5823.patch <- solved with 2.6.20-rc1 CVE-2006-6053.patch <- solved with 2.6.20-rc1 CVE-2006-6054.patch <- solved with 2.6.20-rc1 CVE-2006-6056.patch <- solved with 2.6.18.8 CVE-2006-6106.patch <- solved with 2.6.18.6 CVE-2006-6333.patch <- solved with 2.6.20 CVE-2007-0005.patch <- solved with 2.6.21-rc3 CVE-2007-0006.patch <- solved with 2.6.21 CVE-2007-0772.patch <- solved with 2.6.18.7 CVE-2007-0958.patch <- solved with 2.6.20-rc7 CVE-2007-1000.patch <- solved with 2.6.21 CVE-2007-1217.patch <- solved with 2.6.20.1 CVE-2007-1388.patch <- solved with 2.6.21 CVE-2007-1497.patch <- solved with 2.6.21 CVE-2007-1592.patch <- solved with 2.6.21 CVE-2007-1861.patch <- solved with 2.6.21.1 CVE-2007-2172.patch <- solved with 2.6.20.6
Cheers
Signature · 4 lines
S.Çağlar Onur <[email protected]> http://cekirdek.pardus.org.tr/~caglar/ Linux is like living in a teepee. No Windows, no Gates and an Apache in house!
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
01 May 2007 Sal tarihinde, S.Çağlar Onur şunları yazmıştı:
Quoted 3 lines
I have following patches on top of current 3.0.5-testing tree, this series contains all released CVE's from 2.6.18 to up until now (linus's current git), only CVE-2007-2242 ( IPV6: Disallow RH0 by default.) is missing...
Just added CVE-2007-2242.patch and also full-tarball [1] in case of anybody wants to review/use etc.
[1] http://cekirdek.pardus.org.tr/~caglar/patches/patches.tar.gz
Signature · 4 lines
S.Çağlar Onur <[email protected]> http://cekirdek.pardus.org.tr/~caglar/ Linux is like living in a teepee. No Windows, no Gates and an Apache in house!
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 5 lines · S.Çağlar Onur
Hi;
If anybody interested, attached patch (against 3.0.4) fixes CVE-2007-1320, CVE-2007-1321 , CVE-2007-1322, CVE-2007-1323 and CVE-2007-1366 which affects qemu and also seems valid for xen.
I've seen this patch before and I picked the most relevant fixes, cleaned them up and checked them in a while ago. I left out the ones which touch code we don't compile and the ones which touch code we don't enable by default. If somebody else cleans up those, it would be great to get them checked in.
We have the first check to bdrv_write in block.c and we have the same check in bdrv_read -- we don't have that unsigned int ns < 0 check.
We have a fix for the cirrus bitblit issue -- I think the fix in the patch you post actually doesn't cover all cases.
We have the hw/dma.c null pointer check.
We don't have the hw/fdc.c null pointer check. We should probably add that one.
We don't have the hw/i8259.c change since we don't use that file.
We don't have the hw/ne2000.c change since we use the rtl8139 driver by default -- could add that one.
We don't have the hw/pc.c change since exit'ing seems safer.
We don't have the hw/sb16.c change since we don't have sound by default -- we should probably add that one.
We don't have the target-i386/translate.c changes since we don't use that file.
We don't have the vl.c changes since we only use the network tap mode.
christian
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
01 May 2007 Sal tarihinde, Christian Limpach şunları yazmıştı:
Quoted 7 lines · S.Çağlar Onur
Quoted 5 lines
Hi;
If anybody interested, attached patch (against 3.0.4) fixes CVE-2007-1320, CVE-2007-1321 , CVE-2007-1322, CVE-2007-1323 and CVE-2007-1366 which affects qemu and also seems valid for xen.
Quoted 5 lines
I've seen this patch before and I picked the most relevant fixes, cleaned them up and checked them in a while ago. I left out the ones which touch code we don't compile and the ones which touch code we don't enable by default. If somebody else cleans up those, it would be great to get them checked in.
Great, is it possible to also inform the list for these kind of updates in future?
Cheers
Signature · 4 lines
S.Çağlar Onur <[email protected]> http://cekirdek.pardus.org.tr/~caglar/ Linux is like living in a teepee. No Windows, no Gates and an Apache in house!
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 31 lines · Christian Limpach
Quoted 5 lines · S.Çağlar Onur
Hi;
If anybody interested, attached patch (against 3.0.4) fixes CVE-2007-1320, CVE-2007-1321 , CVE-2007-1322, CVE-2007-1323 and CVE-2007-1366 which affects qemu and also seems valid for xen.
I've seen this patch before and I picked the most relevant fixes, cleaned them up and checked them in a while ago. I left out the ones which touch code we don't compile and the ones which touch code we don't enable by default. If somebody else cleans up those, it would be great to get them checked in.
We have the first check to
bdrv_writeinblock.cand we have the same check inbdrv_read-- we don't have that unsigned int ns < 0 check.We have a fix for the cirrus bitblit issue -- I think the fix in the patch you post actually doesn't cover all cases.
We have the
hw/dma.cnull pointer check.We don't have the
hw/fdc.cnull pointer check. We should probably add that one.We don't have the
hw/i8259.cchange since we don't use that file.We don't have the
hw/ne2000.cchange since we use the rtl8139 driver by default -- could add that one.We don't have the
hw/pc.cchange since exit'ing seems safer.
Quoted 8 lines
We don't have the
hw/sb16.cchange since we don't have sound by default -- we should probably add that one.We don't have the
target-i386/translate.cchanges since we don't use that file.We don't have the
vl.cchanges since we only use the network tap mode.
How much cleaning would the remaining fixes need? I've re-attached the patch proposed by S.Çağlar Onur, with those issues fixed in 3.1.0 removed and only including those you marked "should/could add".
Regards,
Robert
tools/ioemu/block.c +5 -0
@@ -465,6 +465,11 @@ int bdrv_write(BlockDriverState *bs, intif (sector_num ==0 && bs->boot_sector_enabled && nb_sectors >0 ) {memcpy (bs->boot_sector_data, buf,512 ); } + { +unsigned int ns = sector_num *512 ; +if (ns <0 ) +return -1 ; + }return bs->drv->bdrv_write (bs, sector_num, buf, nb_sectors); }
tools/ioemu/hw/fdc.c +7 -2
@@ -1110,8 +1110,13 @@ static uint32_t fdctrl_read_data (fdctrl 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); +if (cur_drv->bs) { +bdrv_read (cur_drv->bs,fd_sector (cur_drv), + fdctrl->fifo, len); + }else { +FLOPPY_ERROR ("can't read data from drive\n" ); +return 0 ; + } } } retval = fdctrl->fifo[pos];
tools/ioemu/hw/ne2000.c +6 -2
@@ -252,7 +252,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 };
@@ -327,7 +327,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;
tools/ioemu/hw/sb16.c +4 -2
@@ -1235,8 +1235,10 @@ static int SB_read_DMA (void *opaque, in s->block_size);#endif -while (s->left_till_irq <=0 ) { - s->left_till_irq = s->block_size + s->left_till_irq; +if (s->block_size) { +while (s->left_till_irq <=0 ) { + s->left_till_irq = s->block_size + s->left_till_irq; + } }return dma_pos;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel