[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID:
<SEZPR04MB631983048A8586896CEFE8829E9D2@SEZPR04MB6319.apcprd04.prod.outlook.com>
Date: Thu, 5 Sep 2024 14:30:26 +0800
From: qixiang.xu@...look.com
To: maz@...nel.org,
oliver.upton@...ux.dev,
will@...nel.org
Cc: linux-arm-kernel@...ts.infradead.org,
kvmarm@...ts.linux.dev,
linux-kernel@...r.kernel.org,
Qxiang Xu <qixiang.xu@...look.com>
Subject: [PATCH 1/1] KVM: arm64: Make nVHE ASLR conditional on nokaslr
From: Qxiang Xu <qixiang.xu@...look.com>
The random tag of hyp VA is determined by the `CONFIG_RANDOMIZE_BASE`
option, so even if `nokaslr` is set in the cmdline, KASLR cannot be
disabled for hyp VA. To align with kernel behavior, disable KASLR if
the kernel cmdline includes `nokaslr`.
Link: https://lore.kernel.org/r/20240905061659.3410362-1-qixiang.xu@outlook.com
Signed-off-by: Qxiang Xu <qixiang.xu@...look.com>
---
arch/arm64/kvm/va_layout.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/kvm/va_layout.c b/arch/arm64/kvm/va_layout.c
index 91b22a014610..bebb4b1ddc82 100644
--- a/arch/arm64/kvm/va_layout.c
+++ b/arch/arm64/kvm/va_layout.c
@@ -72,7 +72,7 @@ __init void kvm_compute_layout(void)
va_mask = GENMASK_ULL(tag_lsb - 1, 0);
tag_val = hyp_va_msb;
- if (IS_ENABLED(CONFIG_RANDOMIZE_BASE) && tag_lsb != (vabits_actual - 1)) {
+ if (kaslr_enabled() && tag_lsb != (vabits_actual - 1)) {
/* We have some free bits to insert a random tag. */
tag_val |= get_random_long() & GENMASK_ULL(vabits_actual - 2, tag_lsb);
}
--
2.25.1
Powered by blists - more mailing lists