Files
linux/arch/arm64/include/asm
Kristina Martsenko 63fba9ff76 arm64: KVM: fix VTTBR_BADDR_MASK BUG_ON off-by-one
commit 26aa7b3b1c upstream.

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 47-bit addresses (instead of 48-bit) and also
insufficiently checking the alignment. This patch fixes it.

As an example, with 4k pages, before this patch we have:

  PHYS_MASK_SHIFT = 48
  VTTBR_X = 37 - 24 = 13
  VTTBR_BADDR_SHIFT = 13 - 1 = 12
  VTTBR_BADDR_MASK = ((1 << 35) - 1) << 12 = 0x00007ffffffff000

Which is wrong, because the mask doesn't allow bit 47 of the VTTBR
address to be set, and only requires the address to be 12-bit (4k)
aligned, while it actually needs to be 13-bit (8k) aligned because we
concatenate two 4k tables.

With this patch, the mask becomes 0x0000ffffffffe000, which is what we
want.

Fixes: 0369f6a34b ("arm64: KVM: EL2 register definitions")
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Kristina Martsenko <kristina.martsenko@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-14 09:28:14 +01:00
..
2014-04-18 11:40:33 +02:00
2015-10-28 19:09:17 +00:00
2012-09-17 13:42:21 +01:00
2016-09-09 11:41:13 +01:00
2014-11-05 09:03:25 +01:00
2012-09-17 13:42:04 +01:00
2016-03-04 18:19:17 +00:00
2016-09-08 11:04:13 +01:00
2016-06-27 16:31:25 +01:00
2012-09-17 13:41:56 +01:00
2015-05-19 15:27:42 +01:00
2014-11-28 10:24:59 +00:00
2015-10-12 17:46:36 +01:00
2014-07-10 11:06:00 +01:00
2016-08-25 18:00:29 +01:00
2012-09-17 13:42:09 +01:00
2016-09-09 11:42:27 +01:00