[PATCH v8 6/6] KVM: arm64: Zero out the stack initialized data in the FFA handler

From: Sebastian Ene

Date: Tue Jun 30 2026 - 06:22:43 EST


Don't leak hypervisor stack data when using the FFA_VERSION call.
When the compiler doesn't support -ftrivial-auto-var-init=zero option
we need to zero out the stack initialized variable before returning data
to the host caller.

Closes:
https://lore.kernel.org/all/20260616160016.C62C81F000E9@xxxxxxxxxxxxxxx/

Reported-by: Sashiko AI <sashiko-bot@xxxxxxxxxx>
Fixes: c9c012625e12 ("KVM: arm64: Trap FFA_VERSION host call in pKVM")
Reviewed-by: Vincent Donnefort <vdonnefort@xxxxxxxxxx>
Link: https://lore.kernel.org/all/20260616160016.C62C81F000E9@xxxxxxxxxxxxxxx/
Signed-off-by: Sebastian Ene <sebastianene@xxxxxxxxxx>
---
arch/arm64/kvm/hyp/nvhe/ffa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c
index bb01d8f83056..7407bc4b547a 100644
--- a/arch/arm64/kvm/hyp/nvhe/ffa.c
+++ b/arch/arm64/kvm/hyp/nvhe/ffa.c
@@ -881,7 +881,7 @@ static void do_ffa_part_get(struct arm_smccc_1_2_regs *res,

bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt, u32 func_id)
{
- struct arm_smccc_1_2_regs res;
+ struct arm_smccc_1_2_regs res = {0};

/*
* There's no way we can tell what a non-standard SMC call might
--
2.55.0.rc0.799.gd6f94ed593-goog