qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 5eb0b1: cadence_uart: bounds check write offs


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 5eb0b1: cadence_uart: bounds check write offset
Date: Tue, 19 Apr 2016 03:30:09 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 5eb0b194e9b01ba0f3613e6ddc2cb9f63ce96ae5
      
https://github.com/qemu/qemu/commit/5eb0b194e9b01ba0f3613e6ddc2cb9f63ce96ae5
  Author: Michael S. Tsirkin <address@hidden>
  Date:   2016-04-19 (Tue, 19 Apr 2016)

  Changed paths:
    M hw/char/cadence_uart.c

  Log Message:
  -----------
  cadence_uart: bounds check write offset

cadence_uart_init() initializes an I/O memory region of size 0x1000
bytes.  However in uart_write(), the 'offset' parameter (offset within
region) is divided by 4 and then used to index the array 'r' of size
CADENCE_UART_R_MAX which is much smaller: (0x48/4).  If 'offset>>=2'
exceeds CADENCE_UART_R_MAX, this will cause an out-of-bounds memory
write where the offset and the value are controlled by guest.

This will corrupt QEMU memory, in most situations this causes the vm to
crash.

Fix by checking the offset against the array size.

Cc: address@hidden
Reported-by: 李强 <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Alistair Francis <address@hidden>
Message-id: address@hidden
Signed-off-by: Peter Maydell <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]