qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1.1] vga: Initialise VRAM with 0
@ 2012-05-23 20:54 Stefan Weil
  2012-05-24 11:18 ` Stefano Stabellini
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Weil @ 2012-05-23 20:54 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Stefan Weil, qemu-devel

The VNC code reads this memory before it is written by BIOS or
other code. Avoid random values by setting the VRAM to 0.

This bug was reported by Valgrind.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 hw/vga.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/vga.c b/hw/vga.c
index 1469680..80b8ec3 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -2283,6 +2283,7 @@ void vga_common_init(VGACommonState *s, int vga_ram_size)
         s->update_retrace_info = vga_precise_update_retrace_info;
         break;
     }
+    memset(s->vram_ptr, 0, s->vram_size);
     vga_dirty_log_start(s);
 }
 
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH 1.1] vga: Initialise VRAM with 0
  2012-05-23 20:54 [Qemu-devel] [PATCH 1.1] vga: Initialise VRAM with 0 Stefan Weil
@ 2012-05-24 11:18 ` Stefano Stabellini
  0 siblings, 0 replies; 2+ messages in thread
From: Stefano Stabellini @ 2012-05-24 11:18 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Anthony Liguori, qemu-devel@nongnu.org

On Wed, 23 May 2012, Stefan Weil wrote:
> The VNC code reads this memory before it is written by BIOS or
> other code. Avoid random values by setting the VRAM to 0.
> 
> This bug was reported by Valgrind.

Please do not apply this patch: it breaks VGA restore on Xen: the
videoram is saved and restored by the hypervisor as part of the main
memory of the VM, so at this point at restore time we would be resetting
useful data (the current state of the videoram).

Can we ignore the Valgrind warning? Or can we add:

if (not_migrate)
    memset

instead? Or if worst comes to worst:

if (not_xen)
    memset



> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>  hw/vga.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/vga.c b/hw/vga.c
> index 1469680..80b8ec3 100644
> --- a/hw/vga.c
> +++ b/hw/vga.c
> @@ -2283,6 +2283,7 @@ void vga_common_init(VGACommonState *s, int vga_ram_size)
>          s->update_retrace_info = vga_precise_update_retrace_info;
>          break;
>      }
> +    memset(s->vram_ptr, 0, s->vram_size);
>      vga_dirty_log_start(s);
>  }
>  
> -- 
> 1.7.10
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-05-24 11:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-23 20:54 [Qemu-devel] [PATCH 1.1] vga: Initialise VRAM with 0 Stefan Weil
2012-05-24 11:18 ` Stefano Stabellini

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).