All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Upton <oliver.upton@linux.dev>
To: kvmarm@lists.linux.dev
Cc: Marc Zyngier <maz@kernel.org>, James Morse <james.morse@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>,
	David Matlack <dmatlack@google.com>,
	Reiji Watanabe <reijiw@google.com>,
	Oliver Upton <oliver.upton@linux.dev>
Subject: [PATCH 0/2] KVM: arm64: Fix for mapping incorrect PA at stage-2
Date: Fri, 21 Apr 2023 07:16:04 +0000	[thread overview]
Message-ID: <20230421071606.1603916-1-oliver.upton@linux.dev> (raw)

Ugh.

So it appears that there is a race between two parallel stage-2 map
walkers that could lead to mapping the incorrect PA for a given IPA, as
the IPA -> PA relationship picks up an unintended offset. This series
eliminates the problem by using the current IPA of the walk as the
source-of-truth regarding where we are in a map operation. If you're
curious about the race, it is spelled out in the first patch.

While there is no such race to update hyp's stage-1, the second patch
applies the same rationale to hyp stage-1 walks for the sake of
consistency.

Applies to 6.3-rc3, and merges w/o conflict into kvmarm/next. Took this
for a ride with selftests, kvm-unit-tests, QEMU, and our internal VMM
(affectionately referred to as Vanadium on the list from time to time).
I also ran through the gamut of nVHE, VHE, and pKVM given the effects on
hyp stage-1.

Marc, the bug can have some rather ugly (albeit rare) consequences, so
I'd like to get this in ASAP. The door is shut on 6.3, but it'd be nice
to squeeze in the 6.4 pull request if possible.

Oliver Upton (2):
  KVM: arm64: Infer the PA offset from IPA in stage-2 map walker
  KVM: arm64: Infer PA offset from VA in hyp map walker

 arch/arm64/include/asm/kvm_pgtable.h |  1 +
 arch/arm64/kvm/hyp/pgtable.c         | 35 +++++++++++++++++++++++-----
 2 files changed, 30 insertions(+), 6 deletions(-)


base-commit: e8d018dd0257f744ca50a729e3d042cf2ec9da65
-- 
2.40.0.634.g4ca3ef3211-goog


             reply	other threads:[~2023-04-21  7:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-21  7:16 Oliver Upton [this message]
2023-04-21  7:16 ` [PATCH 1/2] KVM: arm64: Infer the PA offset from IPA in stage-2 map walker Oliver Upton
2023-04-21  9:28   ` Marc Zyngier
2023-04-21  9:35     ` Oliver Upton
2023-04-21  7:16 ` [PATCH 2/2] KVM: arm64: Infer PA offset from VA in hyp " Oliver Upton
2023-04-21  9:12 ` [PATCH 0/2] KVM: arm64: Fix for mapping incorrect PA at stage-2 Marc Zyngier
2023-04-21  9:29   ` Oliver Upton
2023-04-21 12:53 ` 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=20230421071606.1603916-1-oliver.upton@linux.dev \
    --to=oliver.upton@linux.dev \
    --cc=dmatlack@google.com \
    --cc=james.morse@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=maz@kernel.org \
    --cc=reijiw@google.com \
    --cc=suzuki.poulose@arm.com \
    --cc=yuzenghui@huawei.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.