]> git.proxmox.com Git - mirror_qemu.git/commit
vga: check the validation of memory addr when draw text
authorlinzhecheng <linzhecheng@huawei.com>
Thu, 11 Jan 2018 13:27:24 +0000 (21:27 +0800)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 13 Feb 2018 01:19:25 +0000 (19:19 -0600)
commit63112b16a6abd31d40df2b9a1dd713b42eb59c6b
treea1483f4dffdaa58d3c9ff7070332b62dd5844718
parent30c3b4823c34a7410ec86c8e8b42db56b7b11117
vga: check the validation of memory addr when draw text

Start a vm with qemu-kvm -enable-kvm -vnc :66 -smp 1 -m 1024 -hda
redhat_5.11.qcow2  -device pcnet -vga cirrus,
then use VNC client to connect to VM, and excute the code below in guest
OS will lead to qemu crash:

int main()
 {
    iopl(3);
    srand(time(NULL));
    int a,b;
    while(1){
a = rand()%0x100;
b = 0x3c0 + (rand()%0x20);
        outb(a,b);
    }
    return 0;
}

The above code is writing the registers of VGA randomly.
We can write VGA CRT controller registers index 0x0C or 0x0D
(which is the start address register) to modify the
the display memory address of the upper left pixel
or character of the screen. The address may be out of the
range of vga ram. So we should check the validation of memory address
when reading or writing it to avoid segfault.

Signed-off-by: linzhecheng <linzhecheng@huawei.com>
Message-id: 20180111132724.13744-1-linzhecheng@huawei.com
Fixes: CVE-2018-5683
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 191f59dc17396bb5a8da50f8c59b6e0a430711a4)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/display/vga.c