qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL] migration: fix for CVE-2014-7840
@ 2014-11-18 11:29 Amit Shah
  2014-11-18 11:29 ` [Qemu-devel] [PATCH 1/1] migration: fix parameter validation on ram load Amit Shah
  2014-11-18 13:43 ` [Qemu-devel] [PULL] migration: fix for CVE-2014-7840 Peter Maydell
  0 siblings, 2 replies; 3+ messages in thread
From: Amit Shah @ 2014-11-18 11:29 UTC (permalink / raw)
  To: qemu list
  Cc: Amit Shah, Peter Maydell, Juan Quintela, Dr. David Alan Gilbert,
	Michael S. Tsirkin

The following changes since commit d6be29e3fb5659102ac0e48e295d177cb67e32c5:

  target-arm: handle address translations that start at level 3 (2014-11-17 19:30:28 +0000)

are available in the git repository at:

  git://git.kernel.org/pub/scm/virt/qemu/amit/migration.git tags/for-2.2

for you to fetch changes up to 0be839a2701369f669532ea5884c15bead1c6e08:

  migration: fix parameter validation on ram load (2014-11-18 16:49:44 +0530)

----------------------------------------------------------------
Fix for CVE-2014-7840, avoiding arbitrary qemu memory overwrite for
migration by Michael S. Tsirkin.

----------------------------------------------------------------
Michael S. Tsirkin (1):
      migration: fix parameter validation on ram load

 arch_init.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

-- 
2.1.0

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

* [Qemu-devel] [PATCH 1/1] migration: fix parameter validation on ram load
  2014-11-18 11:29 [Qemu-devel] [PULL] migration: fix for CVE-2014-7840 Amit Shah
@ 2014-11-18 11:29 ` Amit Shah
  2014-11-18 13:43 ` [Qemu-devel] [PULL] migration: fix for CVE-2014-7840 Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Amit Shah @ 2014-11-18 11:29 UTC (permalink / raw)
  To: qemu list
  Cc: Amit Shah, Peter Maydell, Juan Quintela, Dr. David Alan Gilbert,
	Michael S. Tsirkin

From: "Michael S. Tsirkin" <mst@redhat.com>

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>
---
 arch_init.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch_init.c b/arch_init.c
index 88a5ba0..593a990 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -1006,7 +1006,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) {
             error_report("Ack, bad migration stream!");
             return NULL;
         }
@@ -1019,8 +1019,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;
+        }
     }
 
     error_report("Can't find block %s!", id);
-- 
2.1.0

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

* Re: [Qemu-devel] [PULL] migration: fix for CVE-2014-7840
  2014-11-18 11:29 [Qemu-devel] [PULL] migration: fix for CVE-2014-7840 Amit Shah
  2014-11-18 11:29 ` [Qemu-devel] [PATCH 1/1] migration: fix parameter validation on ram load Amit Shah
@ 2014-11-18 13:43 ` Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2014-11-18 13:43 UTC (permalink / raw)
  To: Amit Shah
  Cc: Juan Quintela, qemu list, Dr. David Alan Gilbert,
	Michael S. Tsirkin

On 18 November 2014 11:29, Amit Shah <amit.shah@redhat.com> wrote:
> The following changes since commit d6be29e3fb5659102ac0e48e295d177cb67e32c5:
>
>   target-arm: handle address translations that start at level 3 (2014-11-17 19:30:28 +0000)
>
> are available in the git repository at:
>
>   git://git.kernel.org/pub/scm/virt/qemu/amit/migration.git tags/for-2.2
>
> for you to fetch changes up to 0be839a2701369f669532ea5884c15bead1c6e08:
>
>   migration: fix parameter validation on ram load (2014-11-18 16:49:44 +0530)
>
> ----------------------------------------------------------------
> Fix for CVE-2014-7840, avoiding arbitrary qemu memory overwrite for
> migration by Michael S. Tsirkin.
>
> ----------------------------------------------------------------

Applied, thanks.

-- PMM

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

end of thread, other threads:[~2014-11-18 13:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-18 11:29 [Qemu-devel] [PULL] migration: fix for CVE-2014-7840 Amit Shah
2014-11-18 11:29 ` [Qemu-devel] [PATCH 1/1] migration: fix parameter validation on ram load Amit Shah
2014-11-18 13:43 ` [Qemu-devel] [PULL] migration: fix for CVE-2014-7840 Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).