Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15
qemu-linux-user.15022
0156-iscsi-Cap-block-count-from-GET-LBA-.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0156-iscsi-Cap-block-count-from-GET-LBA-.patch of Package qemu-linux-user.15022
From 99715560be37ed85b020b0f95e2bdecfcb977d19 Mon Sep 17 00:00:00 2001 From: Felipe Franciosi <felipe@nutanix.com> Date: Thu, 23 Jan 2020 12:44:59 +0000 Subject: [PATCH] iscsi: Cap block count from GET LBA STATUS (CVE-2020-1711) Git-commit: 693fd2acdf14dd86c0bf852610f1c2cca80a74dc References: bsc#1166240 When querying an iSCSI server for the provisioning status of blocks (via GET LBA STATUS), Qemu only validates that the response descriptor zero's LBA matches the one requested. Given the SCSI spec allows servers to respond with the status of blocks beyond the end of the LUN, Qemu may have its heap corrupted by clearing/setting too many bits at the end of its allocmap for the LUN. A malicious guest in control of the iSCSI server could carefully program Qemu's heap (by selectively setting the bitmap) and then smash it. This limits the number of bits that iscsi_co_block_status() will try to update in the allocmap so it can't overflow the bitmap. Fixes: CVE-2020-1711 Cc: qemu-stable@nongnu.org Signed-off-by: Felipe Franciosi <felipe@nutanix.com> Signed-off-by: Peter Turschmid <peter.turschm@nutanix.com> Signed-off-by: Raphael Norwitz <raphael.norwitz@nutanix.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> [BR: Converted patch from byte based to sector based] Signed-off-by: Bruce Rogers <brogers@suse.com> --- block/iscsi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index c532ec79d1..398b80fc9f 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -651,7 +651,7 @@ static int64_t coroutine_fn iscsi_co_get_block_status(BlockDriverState *bs, struct scsi_get_lba_status *lbas = NULL; struct scsi_lba_status_descriptor *lbasd = NULL; struct IscsiTask iTask; - int64_t ret; + int64_t ret, max_sector; iscsi_co_init_iscsitask(iscsilun, &iTask); @@ -670,6 +670,7 @@ static int64_t coroutine_fn iscsi_co_get_block_status(BlockDriverState *bs, goto out; } + max_sector = iscsilun->num_blocks - sector_num; qemu_mutex_lock(&iscsilun->mutex); retry: if (iscsi_get_lba_status_task(iscsilun->iscsi, iscsilun->lun, @@ -717,7 +718,7 @@ retry: goto out_unlock; } - *pnum = sector_lun2qemu(lbasd->num_blocks, iscsilun); + *pnum = MIN(sector_lun2qemu(lbasd->num_blocks, iscsilun), max_sector); if (lbasd->provisioning == SCSI_PROVISIONING_TYPE_DEALLOCATED || lbasd->provisioning == SCSI_PROVISIONING_TYPE_ANCHORED) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor