From: Mark Bundschuh <mkbund@amazon.com>
To: <stable@vger.kernel.org>
Cc: Fuad Tabba <fuad.tabba@linux.dev>,
Hiroyuki Katsura <hk590@cam.ac.uk>,
Vincent Donnefort <vdonnefort@google.com>,
Marc Zyngier <maz@kernel.org>, Oliver Upton <oupton@kernel.org>,
Mark Bundschuh <mkbund@amazon.com>
Subject: [PATCH v2 6.12.y] KVM: arm64: Transfer the hyp stack pages out of the host stage-2
Date: Thu, 29 Oct 2026 02:23:08 +0000 [thread overview]
Message-ID: <20261029022308.2620922-1-mkbund@amazon.com> (raw)
In-Reply-To: <20261029021918.2596937-1-mkbund@amazon.com>
From: Fuad Tabba <fuad.tabba@linux.dev>
[ Upstream commit 3a8c562892b96f35bba1e00d5e455a15963bbb92 ]
fix_host_ownership() walks only the linear-map alias of each memblock
region, and the per-CPU hyp stack, mapped in the private VA range for
its guard page, has none.
Walk each stack's VA range with the same walker.
Fixes: 1a919b17ef012 ("KVM: arm64: Add guard pages for pKVM (protected nVHE) hypervisor stack")
Reported-by: Hiroyuki Katsura <hk590@cam.ac.uk>
Cc: stable@vger.kernel.org
Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
Reviewed-by: Vincent Donnefort <vdonnefort@google.com>
Tested-by: Vincent Donnefort <vdonnefort@google.com>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Link: https://patch.msgid.link/20260908110713.1540304-2-fuad.tabba@linux.dev
Signed-off-by: Oliver Upton <oupton@kernel.org>
[ 38f9e4b905a0 ("arm64: kvm: Introduce nvhe stack size constants") is
not backported because it converts nvhe stack code in eight files to
NVHE_STACK_SIZE, and the hyp stack here is one page, so PAGE_SIZE
replaces it. ]
Assisted-by: LLM
Signed-off-by: Mark Bundschuh <mkbund@amazon.com>
---
v2: add my missing Signed-off-by
v1: https://lore.kernel.org/stable/20261029021918.2596937-1-mkbund@amazon.com/
arch/arm64/kvm/hyp/nvhe/setup.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm64/kvm/hyp/nvhe/setup.c b/arch/arm64/kvm/hyp/nvhe/setup.c
index 08770d7cba4b0..2763bf8dd105f 100644
--- a/arch/arm64/kvm/hyp/nvhe/setup.c
+++ b/arch/arm64/kvm/hyp/nvhe/setup.c
@@ -264,6 +264,16 @@ static int fix_host_ownership(void)
return ret;
}
+ /* The stacks sit in the private VA range, not the linear map. */
+ for (i = 0; i < hyp_nr_cpus; i++) {
+ struct kvm_nvhe_init_params *params = per_cpu_ptr(&kvm_init_params, i);
+ u64 start = params->stack_hyp_va - PAGE_SIZE;
+
+ ret = kvm_pgtable_walk(&pkvm_pgtable, start, PAGE_SIZE, &walker);
+ if (ret)
+ return ret;
+ }
+
return 0;
}
base-commit: 85d82e0d7c2dfd3e75d34f35b7ebbf41f45c9c4e
--
2.50.1
next prev parent reply other threads:[~2026-10-29 2:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 2:19 [PATCH 6.12.y] KVM: arm64: Transfer the hyp stack pages out of the host stage-2 Mark Bundschuh
2026-10-29 2:23 ` Mark Bundschuh [this message]
2026-10-29 18:43 ` [PATCH v2 " Sasha Levin
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=20261029022308.2620922-1-mkbund@amazon.com \
--to=mkbund@amazon.com \
--cc=fuad.tabba@linux.dev \
--cc=hk590@cam.ac.uk \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=stable@vger.kernel.org \
--cc=vdonnefort@google.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