]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: arm64: Zero out the stack initialized data in the FFA handler
authorSebastian Ene <sebastianene@google.com>
Thu, 2 Jul 2026 10:38:43 +0000 (10:38 +0000)
committerMarc Zyngier <maz@kernel.org>
Tue, 7 Jul 2026 10:25:50 +0000 (11:25 +0100)
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@smtp.kernel.org/

Reported-by: Sashiko AI <sashiko-bot@kernel.org>
Fixes: c9c012625e12 ("KVM: arm64: Trap FFA_VERSION host call in pKVM")
Reviewed-by: Vincent Donnefort <vdonnefort@google.com>
Link: https://lore.kernel.org/all/20260616160016.C62C81F000E9@smtp.kernel.org/
Signed-off-by: Sebastian Ene <sebastianene@google.com>
Link: https://patch.msgid.link/20260702103848.1647249-7-sebastianene@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/hyp/nvhe/ffa.c

index 9c96e72e522e54325371bdfde297a9554b249330..a327c2bbb6b64d529ea9afa05ddf9d299a183f94 100644 (file)
@@ -880,7 +880,7 @@ out_unlock:
 
 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