All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio-blk: refuse SG_IO requests with scsi=off
@ 2011-12-23 14:39 Paolo Bonzini
  2011-12-30 11:45 ` Stefan Hajnoczi
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Paolo Bonzini @ 2011-12-23 14:39 UTC (permalink / raw)
  To: qemu-devel

QEMU does have a "scsi" option (to be used like -device
virtio-blk-pci,drive=foo,scsi=off).  However, it only
masks the feature bit, and does not reject the command
if a malicious guest disregards the feature bits and
issues a request.

Without this patch, using scsi=off does not protect you
from CVE-2011-4127.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/virtio-blk.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index b70d116..6cd3164 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -153,6 +153,12 @@ static void virtio_blk_handle_scsi(VirtIOBlockReq *req)
     int status;
     int i;
 
+    if ((req->dev->vdev.guest_features & (1 << VIRTIO_BLK_F_SCSI)) == 0) {
+        virtio_blk_req_complete(req, VIRTIO_BLK_S_UNSUPP);
+        g_free(req);
+        return;
+    }
+
     /*
      * We require at least one output segment each for the virtio_blk_outhdr
      * and the SCSI command block.
-- 
1.7.7.1

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

* Re: [Qemu-devel] [PATCH] virtio-blk: refuse SG_IO requests with scsi=off
  2011-12-23 14:39 [Qemu-devel] [PATCH] virtio-blk: refuse SG_IO requests with scsi=off Paolo Bonzini
@ 2011-12-30 11:45 ` Stefan Hajnoczi
  2012-01-05 10:05 ` Paolo Bonzini
  2012-01-13 16:54 ` Anthony Liguori
  2 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2011-12-30 11:45 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

On Fri, Dec 23, 2011 at 03:39:03PM +0100, Paolo Bonzini wrote:
> QEMU does have a "scsi" option (to be used like -device
> virtio-blk-pci,drive=foo,scsi=off).  However, it only
> masks the feature bit, and does not reject the command
> if a malicious guest disregards the feature bits and
> issues a request.
> 
> Without this patch, using scsi=off does not protect you
> from CVE-2011-4127.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/virtio-blk.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)

I checked that guest_features cannot have SCSI enabled when the host
wishes to prohibit SCSI.

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

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

* Re: [Qemu-devel] [PATCH] virtio-blk: refuse SG_IO requests with scsi=off
  2011-12-23 14:39 [Qemu-devel] [PATCH] virtio-blk: refuse SG_IO requests with scsi=off Paolo Bonzini
  2011-12-30 11:45 ` Stefan Hajnoczi
@ 2012-01-05 10:05 ` Paolo Bonzini
  2012-01-13 15:56   ` Paolo Bonzini
  2012-01-13 16:54 ` Anthony Liguori
  2 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2012-01-05 10:05 UTC (permalink / raw)
  To: qemu-devel

On 12/23/2011 03:39 PM, Paolo Bonzini wrote:
> QEMU does have a "scsi" option (to be used like -device
> virtio-blk-pci,drive=foo,scsi=off).  However, it only
> masks the feature bit, and does not reject the command
> if a malicious guest disregards the feature bits and
> issues a request.
>
> Without this patch, using scsi=off does not protect you
> from CVE-2011-4127.
>
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   hw/virtio-blk.c |    6 ++++++
>   1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
> index b70d116..6cd3164 100644
> --- a/hw/virtio-blk.c
> +++ b/hw/virtio-blk.c
> @@ -153,6 +153,12 @@ static void virtio_blk_handle_scsi(VirtIOBlockReq *req)
>       int status;
>       int i;
>
> +    if ((req->dev->vdev.guest_features&  (1<<  VIRTIO_BLK_F_SCSI)) == 0) {
> +        virtio_blk_req_complete(req, VIRTIO_BLK_S_UNSUPP);
> +        g_free(req);
> +        return;
> +    }
> +
>       /*
>        * We require at least one output segment each for the virtio_blk_outhdr
>        * and the SCSI command block.

Ping.

Paolo

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

* Re: [Qemu-devel] [PATCH] virtio-blk: refuse SG_IO requests with scsi=off
  2012-01-05 10:05 ` Paolo Bonzini
@ 2012-01-13 15:56   ` Paolo Bonzini
  0 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2012-01-13 15:56 UTC (permalink / raw)
  To: qemu-devel

On 01/05/2012 11:05 AM, Paolo Bonzini wrote:
> On 12/23/2011 03:39 PM, Paolo Bonzini wrote:
>> QEMU does have a "scsi" option (to be used like -device
>> virtio-blk-pci,drive=foo,scsi=off). However, it only
>> masks the feature bit, and does not reject the command
>> if a malicious guest disregards the feature bits and
>> issues a request.
>>
>> Without this patch, using scsi=off does not protect you
>> from CVE-2011-4127.
>>
>> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
>> ---
>> hw/virtio-blk.c | 6 ++++++
>> 1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
>> index b70d116..6cd3164 100644
>> --- a/hw/virtio-blk.c
>> +++ b/hw/virtio-blk.c
>> @@ -153,6 +153,12 @@ static void virtio_blk_handle_scsi(VirtIOBlockReq
>> *req)
>> int status;
>> int i;
>>
>> + if ((req->dev->vdev.guest_features& (1<< VIRTIO_BLK_F_SCSI)) == 0) {
>> + virtio_blk_req_complete(req, VIRTIO_BLK_S_UNSUPP);
>> + g_free(req);
>> + return;
>> + }
>> +
>> /*
>> * We require at least one output segment each for the virtio_blk_outhdr
>> * and the SCSI command block.
>
> Ping.

Ping^2

Paolo

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

* Re: [Qemu-devel] [PATCH] virtio-blk: refuse SG_IO requests with scsi=off
  2011-12-23 14:39 [Qemu-devel] [PATCH] virtio-blk: refuse SG_IO requests with scsi=off Paolo Bonzini
  2011-12-30 11:45 ` Stefan Hajnoczi
  2012-01-05 10:05 ` Paolo Bonzini
@ 2012-01-13 16:54 ` Anthony Liguori
  2 siblings, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2012-01-13 16:54 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

On 12/23/2011 08:39 AM, Paolo Bonzini wrote:
> QEMU does have a "scsi" option (to be used like -device
> virtio-blk-pci,drive=foo,scsi=off).  However, it only
> masks the feature bit, and does not reject the command
> if a malicious guest disregards the feature bits and
> issues a request.
>
> Without this patch, using scsi=off does not protect you
> from CVE-2011-4127.
>
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>   hw/virtio-blk.c |    6 ++++++
>   1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
> index b70d116..6cd3164 100644
> --- a/hw/virtio-blk.c
> +++ b/hw/virtio-blk.c
> @@ -153,6 +153,12 @@ static void virtio_blk_handle_scsi(VirtIOBlockReq *req)
>       int status;
>       int i;
>
> +    if ((req->dev->vdev.guest_features&  (1<<  VIRTIO_BLK_F_SCSI)) == 0) {
> +        virtio_blk_req_complete(req, VIRTIO_BLK_S_UNSUPP);
> +        g_free(req);
> +        return;
> +    }
> +
>       /*
>        * We require at least one output segment each for the virtio_blk_outhdr
>        * and the SCSI command block.

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

end of thread, other threads:[~2012-01-13 16:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-23 14:39 [Qemu-devel] [PATCH] virtio-blk: refuse SG_IO requests with scsi=off Paolo Bonzini
2011-12-30 11:45 ` Stefan Hajnoczi
2012-01-05 10:05 ` Paolo Bonzini
2012-01-13 15:56   ` Paolo Bonzini
2012-01-13 16:54 ` Anthony Liguori

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.