qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio-gpu: fix information leak in capset get dispatch
@ 2016-11-01 12:37 Li Qiang
  2016-11-01 12:51 ` Marc-André Lureau
  2016-12-13 10:32 ` Li Qiang
  0 siblings, 2 replies; 3+ messages in thread
From: Li Qiang @ 2016-11-01 12:37 UTC (permalink / raw)
  To: kraxel, qemu-devel; +Cc: Li Qiang

From: Li Qiang <liqiang6-s@360.cn>

In virgl_cmd_get_capset function, it uses g_malloc to allocate
a response struct to the guest. As the 'resp'struct hasn't been full
initialized it will lead the 'resp->padding' field to the guest.
Use g_malloc0 to avoid this.

Signed-off-by: Li Qiang <liqiang6-s@360.cn>
---
 hw/display/virtio-gpu-3d.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
index 23f39de..d98b140 100644
--- a/hw/display/virtio-gpu-3d.c
+++ b/hw/display/virtio-gpu-3d.c
@@ -371,7 +371,7 @@ static void virgl_cmd_get_capset(VirtIOGPU *g,
 
     virgl_renderer_get_cap_set(gc.capset_id, &max_ver,
                                &max_size);
-    resp = g_malloc(sizeof(*resp) + max_size);
+    resp = g_malloc0(sizeof(*resp) + max_size);
 
     resp->hdr.type = VIRTIO_GPU_RESP_OK_CAPSET;
     virgl_renderer_fill_caps(gc.capset_id,
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PATCH] virtio-gpu: fix information leak in capset get dispatch
  2016-11-01 12:37 [Qemu-devel] [PATCH] virtio-gpu: fix information leak in capset get dispatch Li Qiang
@ 2016-11-01 12:51 ` Marc-André Lureau
  2016-12-13 10:32 ` Li Qiang
  1 sibling, 0 replies; 3+ messages in thread
From: Marc-André Lureau @ 2016-11-01 12:51 UTC (permalink / raw)
  To: Li Qiang, kraxel, qemu-devel; +Cc: Li Qiang

Hi

On Tue, Nov 1, 2016 at 3:38 PM Li Qiang <liq3ea@gmail.com> wrote:

> From: Li Qiang <liqiang6-s@360.cn>
>
> In virgl_cmd_get_capset function, it uses g_malloc to allocate
> a response struct to the guest. As the 'resp'struct hasn't been full
> initialized it will lead the 'resp->padding' field to the guest.
> Use g_malloc0 to avoid this.
>
> Signed-off-by: Li Qiang <liqiang6-s@360.cn>
>

I was about to point out this in the previous memset patch

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


---
>  hw/display/virtio-gpu-3d.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
> index 23f39de..d98b140 100644
> --- a/hw/display/virtio-gpu-3d.c
> +++ b/hw/display/virtio-gpu-3d.c
> @@ -371,7 +371,7 @@ static void virgl_cmd_get_capset(VirtIOGPU *g,
>
>      virgl_renderer_get_cap_set(gc.capset_id, &max_ver,
>                                 &max_size);
> -    resp = g_malloc(sizeof(*resp) + max_size);
> +    resp = g_malloc0(sizeof(*resp) + max_size);
>
>      resp->hdr.type = VIRTIO_GPU_RESP_OK_CAPSET;
>      virgl_renderer_fill_caps(gc.capset_id,
> --
> 1.8.3.1
>
>
> --
Marc-André Lureau

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

* Re: [Qemu-devel] [PATCH] virtio-gpu: fix information leak in capset get dispatch
  2016-11-01 12:37 [Qemu-devel] [PATCH] virtio-gpu: fix information leak in capset get dispatch Li Qiang
  2016-11-01 12:51 ` Marc-André Lureau
@ 2016-12-13 10:32 ` Li Qiang
  1 sibling, 0 replies; 3+ messages in thread
From: Li Qiang @ 2016-12-13 10:32 UTC (permalink / raw)
  To: kraxel, qemu-devel; +Cc: Li Qiang

Ping!

2016-11-01 20:37 GMT+08:00 Li Qiang <liq3ea@gmail.com>:

> From: Li Qiang <liqiang6-s@360.cn>
>
> In virgl_cmd_get_capset function, it uses g_malloc to allocate
> a response struct to the guest. As the 'resp'struct hasn't been full
> initialized it will lead the 'resp->padding' field to the guest.
> Use g_malloc0 to avoid this.
>
> Signed-off-by: Li Qiang <liqiang6-s@360.cn>
> ---
>  hw/display/virtio-gpu-3d.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
> index 23f39de..d98b140 100644
> --- a/hw/display/virtio-gpu-3d.c
> +++ b/hw/display/virtio-gpu-3d.c
> @@ -371,7 +371,7 @@ static void virgl_cmd_get_capset(VirtIOGPU *g,
>
>      virgl_renderer_get_cap_set(gc.capset_id, &max_ver,
>                                 &max_size);
> -    resp = g_malloc(sizeof(*resp) + max_size);
> +    resp = g_malloc0(sizeof(*resp) + max_size);
>
>      resp->hdr.type = VIRTIO_GPU_RESP_OK_CAPSET;
>      virgl_renderer_fill_caps(gc.capset_id,
> --
> 1.8.3.1
>
>

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

end of thread, other threads:[~2016-12-13 10:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-01 12:37 [Qemu-devel] [PATCH] virtio-gpu: fix information leak in capset get dispatch Li Qiang
2016-11-01 12:51 ` Marc-André Lureau
2016-12-13 10:32 ` Li Qiang

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