From: Eric Auger <eauger@redhat.com>
To: Marc Zyngier <maz@kernel.org>,
kvmarm@lists.cs.columbia.edu,
linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org
Cc: Ricardo Koller <ricarkol@google.com>,
James Morse <james.morse@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Alexandru Elisei <alexandru.elisei@arm.com>,
Oliver Upton <oupton@google.com>,
kernel-team@android.com
Subject: Re: [PATCH 3/3] KVM: arm64: Warn if accessing timer pending state outside of vcpu context
Date: Thu, 2 Jun 2022 21:39:26 +0200 [thread overview]
Message-ID: <b0c08d90-1bf0-6996-379e-61f0d5724fc0@redhat.com> (raw)
In-Reply-To: <20220602083025.1110433-4-maz@kernel.org>
Hi Marc,
On 6/2/22 10:30, Marc Zyngier wrote:
> A recurrent bug in the KVM/arm64 code base consists in trying to
> access the timer pending state outside of the vcpu context, which
> makes zero sense (the pending state only exists when the vcpu
> is loaded).
>
> In order to avoid more embarassing crashes and catch the offenders
> red-handed, add a warning to kvm_arch_timer_get_input_level() and
> return the state as non-pending. This avoids taking the system down,
> and still helps tracking down silly bugs.
>
> Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Eric
> ---
> arch/arm64/kvm/arch_timer.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/arm64/kvm/arch_timer.c b/arch/arm64/kvm/arch_timer.c
> index 5290ca5db663..bb24a76b4224 100644
> --- a/arch/arm64/kvm/arch_timer.c
> +++ b/arch/arm64/kvm/arch_timer.c
> @@ -1230,6 +1230,9 @@ bool kvm_arch_timer_get_input_level(int vintid)
> struct kvm_vcpu *vcpu = kvm_get_running_vcpu();
> struct arch_timer_context *timer;
>
> + if (WARN(!vcpu, "No vcpu context!\n"))
> + return false;
> +
> if (vintid == vcpu_vtimer(vcpu)->irq.irq)
> timer = vcpu_vtimer(vcpu);
> else if (vintid == vcpu_ptimer(vcpu)->irq.irq)
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2022-06-02 19:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-02 8:30 [PATCH 0/3] KVM: arm64: Fix userspace access to HW pending state Marc Zyngier
2022-06-02 8:30 ` [PATCH 1/3] KVM: arm64: Don't read a HW interrupt pending state in user context Marc Zyngier
2022-06-02 19:40 ` Eric Auger
2022-06-02 20:08 ` Eric Auger
2022-06-02 8:30 ` [PATCH 2/3] KVM: arm64: Replace vgic_v3_uaccess_read_pending with vgic_uaccess_read_pending Marc Zyngier
2022-06-02 20:06 ` Eric Auger
2022-06-07 11:10 ` Marc Zyngier
2022-06-02 8:30 ` [PATCH 3/3] KVM: arm64: Warn if accessing timer pending state outside of vcpu context Marc Zyngier
2022-06-02 19:39 ` Eric Auger [this message]
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=b0c08d90-1bf0-6996-379e-61f0d5724fc0@redhat.com \
--to=eauger@redhat.com \
--cc=alexandru.elisei@arm.com \
--cc=james.morse@arm.com \
--cc=kernel-team@android.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maz@kernel.org \
--cc=oupton@google.com \
--cc=ricarkol@google.com \
--cc=suzuki.poulose@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).