[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 5/5] megasas: LSI Megaraid SAS emulation
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 5/5] megasas: LSI Megaraid SAS emulation |
Date: |
Tue, 5 Jul 2011 16:21:41 +0100 |
On Tue, Jul 5, 2011 at 12:03 PM, Hannes Reinecke <address@hidden> wrote:
> +static void megasas_unmap_sgl(struct megasas_cmd_t *cmd)
> +{
> + uint16_t flags = le16_to_cpu(cmd->frame->header.flags);
> + int i, is_write = (flags & MFI_FRAME_DIR_WRITE) ? 1 : 0;
> +
> + for (i = 0; i < cmd->frame->header.sge_count; i++) {
> + cpu_physical_memory_unmap(cmd->iov[i].iov_base, cmd->iov[i].iov_len,
> + is_write, cmd->iov[i].iov_len);
> + }
We cannot map control structures from guest memory and treating them
as valid request state later on.
A malicious guest can issue the request, then change the fields the
control structure while QEMU is processing the I/O, and then this
function will execute with is_write/sge_count no longer the same as
when the request started.
Good practice would be to copy in any request state needed instead of
reaching into guest memory at later points of the request lifecycle.
This way a malicious guest can never cause QEMU to crash or do
something due to inconsistent state.
The particular problem I see here is starting the request with
sge_count=1 and then setting it to sge_count=255. We will perform
invalid iov[] accesses.
Stefan
- [Qemu-devel] [PATCH 0/5][v6] Megasas HBA emulation, Hannes Reinecke, 2011/07/05
- [Qemu-devel] [PATCH 1/5] iov: Update parameter usage in iov_(to|from)_buf(), Hannes Reinecke, 2011/07/05
- [Qemu-devel] [PATCH 2/5] scsi: Add 'hba_private' to SCSIRequest, Hannes Reinecke, 2011/07/05
- [Qemu-devel] [PATCH 3/5] scsi-disk: Fixup debugging statement, Hannes Reinecke, 2011/07/05
- [Qemu-devel] [PATCH 4/5] scsi-disk: Mask out serial number EVPD, Hannes Reinecke, 2011/07/05
- [Qemu-devel] [PATCH 5/5] megasas: LSI Megaraid SAS emulation, Hannes Reinecke, 2011/07/05
- Re: [Qemu-devel] [PATCH 5/5] megasas: LSI Megaraid SAS emulation, Alexander Graf, 2011/07/05
- Re: [Qemu-devel] [PATCH 5/5] megasas: LSI Megaraid SAS emulation, Alexander Graf, 2011/07/05
- Re: [Qemu-devel] [PATCH 5/5] megasas: LSI Megaraid SAS emulation, Paolo Bonzini, 2011/07/05
- Re: [Qemu-devel] [PATCH 5/5] megasas: LSI Megaraid SAS emulation, Alexander Graf, 2011/07/05
- Re: [Qemu-devel] [PATCH 5/5] megasas: LSI Megaraid SAS emulation,
Stefan Hajnoczi <=
- Re: [Qemu-devel] [PATCH 5/5] megasas: LSI Megaraid SAS emulation, Hannes Reinecke, 2011/07/06
- Re: [Qemu-devel] [PATCH 5/5] megasas: LSI Megaraid SAS emulation, Paolo Bonzini, 2011/07/06
- Re: [Qemu-devel] [PATCH 4/5] scsi-disk: Mask out serial number EVPD, Paolo Bonzini, 2011/07/05
- Re: [Qemu-devel] [PATCH 3/5] scsi-disk: Fixup debugging statement, Paolo Bonzini, 2011/07/05
Re: [Qemu-devel] [PATCH 0/5][v6] Megasas HBA emulation, Alexander Graf, 2011/07/05