From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Gleb Natapov <gleb@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
qemu-devel <qemu-devel@nongnu.org>, kvm <kvm@vger.kernel.org>
Subject: Re: [PATCH uq/master] kvmvapic: Prevent reading beyond the end of guest RAM
Date: Mon, 30 Sep 2013 13:51:36 +0300 [thread overview]
Message-ID: <20130930105136.GE20445@redhat.com> (raw)
In-Reply-To: <524953E1.6000105@siemens.com>
On Mon, Sep 30, 2013 at 12:35:13PM +0200, Jan Kiszka wrote:
> rom_state_paddr is guest provided (caller address of outw(VAPIC_PORT) +
> writen 16-bit value) and can be influenced to point beyond the end of
> the host memory backing the guest's RAM. Make sure we do not use this
> pointer to actually read beyond the limits.
>
> Reading arbitrary guest bytes is harmless, the guest kernel has to
> manage access to this I/O port anyway.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> hw/i386/kvmvapic.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c
> index 1c2dbf5..2d87600 100644
> --- a/hw/i386/kvmvapic.c
> +++ b/hw/i386/kvmvapic.c
> @@ -596,6 +596,9 @@ static int vapic_map_rom_writable(VAPICROMState *s)
> section = memory_region_find(as, 0, 1);
>
> /* read ROM size from RAM region */
> + if (rom_paddr + 2 >= memory_region_size(section.mr)) {
> + return -1;
> + }
> ram = memory_region_get_ram_ptr(section.mr);
> rom_size = ram[rom_paddr + 2] * ROM_BLOCK_SIZE;
> if (rom_size == 0) {
> --
> 1.8.1.1.298.ge7eed54
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
qemu-devel <qemu-devel@nongnu.org>,
Gleb Natapov <gleb@redhat.com>, kvm <kvm@vger.kernel.org>
Subject: Re: [Qemu-devel] [PATCH uq/master] kvmvapic: Prevent reading beyond the end of guest RAM
Date: Mon, 30 Sep 2013 13:51:36 +0300 [thread overview]
Message-ID: <20130930105136.GE20445@redhat.com> (raw)
In-Reply-To: <524953E1.6000105@siemens.com>
On Mon, Sep 30, 2013 at 12:35:13PM +0200, Jan Kiszka wrote:
> rom_state_paddr is guest provided (caller address of outw(VAPIC_PORT) +
> writen 16-bit value) and can be influenced to point beyond the end of
> the host memory backing the guest's RAM. Make sure we do not use this
> pointer to actually read beyond the limits.
>
> Reading arbitrary guest bytes is harmless, the guest kernel has to
> manage access to this I/O port anyway.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> hw/i386/kvmvapic.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c
> index 1c2dbf5..2d87600 100644
> --- a/hw/i386/kvmvapic.c
> +++ b/hw/i386/kvmvapic.c
> @@ -596,6 +596,9 @@ static int vapic_map_rom_writable(VAPICROMState *s)
> section = memory_region_find(as, 0, 1);
>
> /* read ROM size from RAM region */
> + if (rom_paddr + 2 >= memory_region_size(section.mr)) {
> + return -1;
> + }
> ram = memory_region_get_ram_ptr(section.mr);
> rom_size = ram[rom_paddr + 2] * ROM_BLOCK_SIZE;
> if (rom_size == 0) {
> --
> 1.8.1.1.298.ge7eed54
next prev parent reply other threads:[~2013-09-30 10:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-30 10:35 [PATCH uq/master] kvmvapic: Prevent reading beyond the end of guest RAM Jan Kiszka
2013-09-30 10:35 ` [Qemu-devel] " Jan Kiszka
2013-09-30 10:51 ` Michael S. Tsirkin [this message]
2013-09-30 10:51 ` Michael S. Tsirkin
2013-10-04 10:18 ` Gleb Natapov
2013-10-04 10:18 ` [Qemu-devel] " Gleb Natapov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130930105136.GE20445@redhat.com \
--to=mst@redhat.com \
--cc=gleb@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.