[PATCH 0/2] scsi-disk: fix race between WRITE SAME and MODE SELECT

Paolo Bonzini posted 2 patches 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260826181725.849718-1-pbonzini@redhat.com
Maintainers: Laurent Vivier <laurent@vivier.eu>, Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <fam@euphon.net>
include/hw/scsi/scsi.h |  1 +
hw/m68k/q800.c         |  2 ++
hw/scsi/scsi-disk.c    | 17 +++++++++++++----
3 files changed, 16 insertions(+), 4 deletions(-)
[PATCH 0/2] scsi-disk: fix race between WRITE SAME and MODE SELECT
Posted by Paolo Bonzini 1 month ago
A guest with an attached scsi-hd can force QEMU's SCSI disk emulation
to read roughly 60 KiB past the end of a heap buffer, copying that out
of bounds host memory into the guest's own disk image.

This is due to a race between WRITE SAME and an obscure MODE SELECT
feature which can be restricted to the Q800 machine.

Paolo

Paolo Bonzini (2):
  scsi-disk: fix out-of-bound read in WRITE SAME
  scsi: hide MODE SELECT block size change behind a quirk

 include/hw/scsi/scsi.h |  1 +
 hw/m68k/q800.c         |  2 ++
 hw/scsi/scsi-disk.c    | 17 +++++++++++++----
 3 files changed, 16 insertions(+), 4 deletions(-)

-- 
2.55.0
Re: [PATCH 0/2] scsi-disk: fix race between WRITE SAME and MODE SELECT
Posted by Stefan Hajnoczi 1 month ago
On Wed, Aug 26, 2026 at 08:17:23PM +0200, Paolo Bonzini wrote:
> A guest with an attached scsi-hd can force QEMU's SCSI disk emulation
> to read roughly 60 KiB past the end of a heap buffer, copying that out
> of bounds host memory into the guest's own disk image.
> 
> This is due to a race between WRITE SAME and an obscure MODE SELECT
> feature which can be restricted to the Q800 machine.
> 
> Paolo
> 
> Paolo Bonzini (2):
>   scsi-disk: fix out-of-bound read in WRITE SAME
>   scsi: hide MODE SELECT block size change behind a quirk
> 
>  include/hw/scsi/scsi.h |  1 +
>  hw/m68k/q800.c         |  2 ++
>  hw/scsi/scsi-disk.c    | 17 +++++++++++++----
>  3 files changed, 16 insertions(+), 4 deletions(-)
> 
> -- 
> 2.55.0
> 
> 

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>