Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
qemu.611
0147-migration-fix-parameter-validation-.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0147-migration-fix-parameter-validation-.patch of Package qemu.611
From b61c87f813ce768b7a39b3cbb73f60cb243e2877 Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" <mst@redhat.com> Date: Wed, 12 Nov 2014 11:44:39 +0200 Subject: [PATCH] migration: fix parameter validation on ram load During migration, the values read from migration stream during ram load are not validated. Especially offset in host_from_stream_offset() and also the length of the writes in the callers of said function. To fix this, we need to make sure that the [offset, offset + length] range fits into one of the allocated memory regions. Validating addr < len should be sufficient since data seems to always be managed in TARGET_PAGE_SIZE chunks. Fixes: CVE-2014-7840 Note: follow-up patches add extra checks on each block->host access. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> (cherry picked from commit 0be839a2701369f669532ea5884c15bead1c6e08) Signed-off-by: Alexander Graf <agraf@suse.de> --- arch_init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch_init.c b/arch_init.c index 3ec70de..a972fb3 100644 --- a/arch_init.c +++ b/arch_init.c @@ -956,7 +956,7 @@ static inline void *host_from_stream_offset(QEMUFile *f, uint8_t len; if (flags & RAM_SAVE_FLAG_CONTINUE) { - if (!block) { + if (!block || block->length <= offset) { fprintf(stderr, "Ack, bad migration stream!\n"); return NULL; } @@ -969,8 +969,9 @@ static inline void *host_from_stream_offset(QEMUFile *f, id[len] = 0; QTAILQ_FOREACH(block, &ram_list.blocks, next) { - if (!strncmp(id, block->idstr, sizeof(id))) + if (!strncmp(id, block->idstr, sizeof(id)) && block->length > offset) { return memory_region_get_ram_ptr(block->mr) + offset; + } } fprintf(stderr, "Can't find block %s!\n", id);
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