linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: cdall@kernel.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PULL 09/19] arm: KVM: Fix VTTBR_BADDR_MASK BUG_ON off-by-one
Date: Mon,  4 Dec 2017 15:03:38 +0100	[thread overview]
Message-ID: <20171204140348.21965-7-cdall@kernel.org> (raw)
In-Reply-To: <20171204135637.21620-1-cdall@kernel.org>

From: Marc Zyngier <marc.zyngier@arm.com>

VTTBR_BADDR_MASK is used to sanity check the size and alignment of the
VTTBR address. It seems to currently be off by one, thereby only
allowing up to 39-bit addresses (instead of 40-bit) and also
insufficiently checking the alignment. This patch fixes it.

This patch is the 32bit pendent of Kristina's arm64 fix, and
she deserves the actual kudos for pinpointing that one.

Fixes: f7ed45be3ba52 ("KVM: ARM: World-switch implementation")
Cc: <stable@vger.kernel.org> # 3.9
Reported-by: Kristina Martsenko <kristina.martsenko@arm.com>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
---
 arch/arm/include/asm/kvm_arm.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/kvm_arm.h b/arch/arm/include/asm/kvm_arm.h
index c8781450905b..3ab8b3781bfe 100644
--- a/arch/arm/include/asm/kvm_arm.h
+++ b/arch/arm/include/asm/kvm_arm.h
@@ -161,8 +161,7 @@
 #else
 #define VTTBR_X		(5 - KVM_T0SZ)
 #endif
-#define VTTBR_BADDR_SHIFT (VTTBR_X - 1)
-#define VTTBR_BADDR_MASK  (((_AC(1, ULL) << (40 - VTTBR_X)) - 1) << VTTBR_BADDR_SHIFT)
+#define VTTBR_BADDR_MASK  (((_AC(1, ULL) << (40 - VTTBR_X)) - 1) << VTTBR_X)
 #define VTTBR_VMID_SHIFT  _AC(48, ULL)
 #define VTTBR_VMID_MASK(size)	(_AT(u64, (1 << size) - 1) << VTTBR_VMID_SHIFT)
 
-- 
2.14.2

  parent reply	other threads:[~2017-12-04 14:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-04 13:56 [PULL 00/19] KVM/ARM Fixes for v4.15 Christoffer Dall
2017-12-04 13:56 ` [PULL 01/19] KVM: arm/arm64: Don't enable/disable physical timer access on VHE Christoffer Dall
2017-12-04 13:56 ` [PULL 02/19] KVM: arm/arm64: VGIC: extend !vgic_is_initialized guard Christoffer Dall
2017-12-04 14:03 ` [PULL 03/19] KVM: arm/arm64: vgic-irqfd: Fix MSI entry allocation Christoffer Dall
2017-12-04 14:03 ` [PULL 04/19] KVM: arm/arm64: vgic: Preserve the revious read from the pending table Christoffer Dall
2017-12-04 14:03 ` [PULL 05/19] KVM: arm/arm64: vgic-its: " Christoffer Dall
2017-12-04 14:03 ` [PULL 06/19] KVM: arm/arm64: vgic-its: Check result of allocation before use Christoffer Dall
2017-12-04 14:03 ` [PULL 07/19] KVM: arm/arm64: vgic-v4: Only perform an unmap for valid vLPIs Christoffer Dall
2017-12-04 14:03 ` [PULL 08/19] arm64: KVM: fix VTTBR_BADDR_MASK BUG_ON off-by-one Christoffer Dall
2017-12-04 14:03 ` Christoffer Dall [this message]
2017-12-04 14:03 ` [PULL 10/19] KVM: arm/arm64: debug: Introduce helper for single-step Christoffer Dall
2017-12-04 14:03 ` [PULL 11/19] kvm: arm64: handle single-stepping trapped instructions Christoffer Dall
2017-12-04 14:03 ` [PULL 12/19] kvm: arm64: handle single-step of userspace mmio instructions Christoffer Dall
2017-12-04 14:03 ` [PULL 13/19] kvm: arm64: handle single-step during SError exceptions Christoffer Dall
2017-12-04 14:03 ` [PULL 14/19] kvm: arm64: handle single-step of hyp emulated mmio instructions Christoffer Dall
2017-12-04 14:03 ` [PULL 15/19] KVM: arm/arm64: Avoid attempting to load timer vgic state without a vgic Christoffer Dall
2017-12-04 14:03 ` [PULL 16/19] kvm: arm: don't treat unavailable HYP mode as an error Christoffer Dall
2017-12-04 14:03 ` [PULL 17/19] KVM: arm/arm64: Fix spinlock acquisition in vgic_set_owner Christoffer Dall
2017-12-04 14:03 ` [PULL 18/19] KVM: arm/arm64: kvm_arch_destroy_vm cleanups Christoffer Dall
2017-12-04 14:03 ` [PULL 19/19] KVM: arm/arm64: Fix broken GICH_ELRSR big endian conversion Christoffer Dall
2017-12-05 17:59 ` [PULL 00/19] KVM/ARM Fixes for v4.15 Radim Krčmář

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=20171204140348.21965-7-cdall@kernel.org \
    --to=cdall@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.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 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).