]> git.ipfire.org Git - thirdparty/linux.git/commit
KVM: arm64: Return early from trace helpers when KVM isn't available
authorYingchao Deng <yingchao.deng@oss.qualcomm.com>
Tue, 2 Sep 2025 03:48:25 +0000 (11:48 +0800)
committerMarc Zyngier <maz@kernel.org>
Mon, 15 Sep 2025 10:38:07 +0000 (11:38 +0100)
commit27d2b47eef033f1fc6c0452dc1017e43dad5fe14
treeece8b9027daee43b758412236f31418ffd314d4d
parent2ba972bf71cb71d2127ec6c3db1ceb6dd0c73173
KVM: arm64: Return early from trace helpers when KVM isn't available

When Linux is booted at EL1, host_data_ptr() resolves to the nVHE
hypervisor's copy of host data. When hyp mode isn't available for
KVM the nVHE percpu bases remain uninitialized. Consequently, any usage
of host_data_ptr() will result in a NULL dereference which has been
observed in KVM's trace filtering helpers.

Add an early return to the trace filtering helpers if KVM isn't
initialized, avoiding the NULL dereference. Take this opportunity
to move the TRBE-skipping checks to a common helper.

Fixes: 054b88391bbe2 ("KVM: arm64: Support trace filtering for guests")
Signed-off-by: Yingchao Deng <yingchao.deng@oss.qualcomm.com>
Reviewed-by: James Clark <james.clark@linaro.org>
[maz: repainted the helpers to be readable, and the commit message
 with Oliver's suggestion]
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/debug.c