From: Christoffer Dall <christoffer.dall@linaro.org>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] arm/arm64: KVM: Feed initialized memory to MMIO accesses
Date: Wed, 24 Feb 2016 12:40:44 +0100 [thread overview]
Message-ID: <20160224114044.GA18451@cbox> (raw)
In-Reply-To: <1455723260-23793-1-git-send-email-marc.zyngier@arm.com>
On Wed, Feb 17, 2016 at 03:34:20PM +0000, Marc Zyngier wrote:
> On an MMIO access, we always copy the on-stack buffer info
> the shared "run" structure, even if this is a read access.
> This ends up leaking up to 8 bytes of uninitialized memory
> into userspace.
I think it only leaks 'len' bytes to userspace ;)
>
> An obvious fix for this one is to only perform the copy if
> this is an actual write.
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
> arch/arm/kvm/mmio.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/kvm/mmio.c b/arch/arm/kvm/mmio.c
> index 7f33b20..0f6600f 100644
> --- a/arch/arm/kvm/mmio.c
> +++ b/arch/arm/kvm/mmio.c
> @@ -206,7 +206,8 @@ int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run,
> run->mmio.is_write = is_write;
> run->mmio.phys_addr = fault_ipa;
> run->mmio.len = len;
> - memcpy(run->mmio.data, data_buf, len);
> + if (is_write)
> + memcpy(run->mmio.data, data_buf, len);
>
> if (!ret) {
> /* We handled the access successfully in the kernel. */
> --
> 2.1.4
>
WARNING: multiple messages have this Message-ID (diff)
From: christoffer.dall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm/arm64: KVM: Feed initialized memory to MMIO accesses
Date: Wed, 24 Feb 2016 12:40:44 +0100 [thread overview]
Message-ID: <20160224114044.GA18451@cbox> (raw)
In-Reply-To: <1455723260-23793-1-git-send-email-marc.zyngier@arm.com>
On Wed, Feb 17, 2016 at 03:34:20PM +0000, Marc Zyngier wrote:
> On an MMIO access, we always copy the on-stack buffer info
> the shared "run" structure, even if this is a read access.
> This ends up leaking up to 8 bytes of uninitialized memory
> into userspace.
I think it only leaks 'len' bytes to userspace ;)
>
> An obvious fix for this one is to only perform the copy if
> this is an actual write.
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
> arch/arm/kvm/mmio.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/kvm/mmio.c b/arch/arm/kvm/mmio.c
> index 7f33b20..0f6600f 100644
> --- a/arch/arm/kvm/mmio.c
> +++ b/arch/arm/kvm/mmio.c
> @@ -206,7 +206,8 @@ int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run,
> run->mmio.is_write = is_write;
> run->mmio.phys_addr = fault_ipa;
> run->mmio.len = len;
> - memcpy(run->mmio.data, data_buf, len);
> + if (is_write)
> + memcpy(run->mmio.data, data_buf, len);
>
> if (!ret) {
> /* We handled the access successfully in the kernel. */
> --
> 2.1.4
>
next prev parent reply other threads:[~2016-02-24 11:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-17 15:34 [PATCH] arm/arm64: KVM: Feed initialized memory to MMIO accesses Marc Zyngier
2016-02-17 15:34 ` Marc Zyngier
2016-02-24 11:40 ` Christoffer Dall [this message]
2016-02-24 11:40 ` Christoffer Dall
2016-02-24 12:06 ` Marc Zyngier
2016-02-24 12:06 ` Marc Zyngier
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=20160224114044.GA18451@cbox \
--to=christoffer.dall@linaro.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=marc.zyngier@arm.com \
/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.