From: Krish Sadhukhan <krish.sadhukhan@oracle.com>
To: Jim Mattson <jmattson@google.com>, kvm@vger.kernel.org
Cc: syzbot <syzkaller@googlegroups.com>
Subject: Re: [PATCH] kvm: LAPIC: Restore guard to prevent illegal APIC register access
Date: Wed, 9 Jun 2021 17:44:56 -0700 [thread overview]
Message-ID: <8b4bbc8e-ee42-4577-39b1-44fb615c080a@oracle.com> (raw)
In-Reply-To: <20210609215111.4142972-1-jmattson@google.com>
On 6/9/21 2:51 PM, Jim Mattson wrote:
> Per the SDM, "any access that touches bytes 4 through 15 of an APIC
> register may cause undefined behavior and must not be executed."
> Worse, such an access in kvm_lapic_reg_read can result in a leak of
> kernel stack contents. Prior to commit 01402cf81051 ("kvm: LAPIC:
> write down valid APIC registers"), such an access was explicitly
> disallowed. Restore the guard that was removed in that commit.
>
> Fixes: 01402cf81051 ("kvm: LAPIC: write down valid APIC registers")
> Signed-off-by: Jim Mattson <jmattson@google.com>
> Reported-by: syzbot <syzkaller@googlegroups.com>
> ---
> arch/x86/kvm/lapic.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index c0ebef560bd1..32fb82bbd63f 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -1410,6 +1410,9 @@ int kvm_lapic_reg_read(struct kvm_lapic *apic, u32 offset, int len,
> if (!apic_x2apic_mode(apic))
> valid_reg_mask |= APIC_REG_MASK(APIC_ARBPRI);
>
> + if (alignment + len > 4)
It will be useful for debugging if the apic_debug() call is added back in.
> + return 1;
> +
> if (offset > 0x3f0 || !(valid_reg_mask & APIC_REG_MASK(offset)))
> return 1;
>
Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
next prev parent reply other threads:[~2021-06-10 0:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-09 21:51 [PATCH] kvm: LAPIC: Restore guard to prevent illegal APIC register access Jim Mattson
2021-06-10 0:44 ` Krish Sadhukhan [this message]
2021-06-10 1:48 ` Jim Mattson
2021-06-10 2:45 ` Krish Sadhukhan
2021-06-10 19:00 ` Jim Mattson
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=8b4bbc8e-ee42-4577-39b1-44fb615c080a@oracle.com \
--to=krish.sadhukhan@oracle.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=syzkaller@googlegroups.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox