ANDROID: KVM: Fix func filter HVC for pKVM Ftrace

The function hyp_ftrace_sync() is meant to apply the filtering described
by the host provided func page to an array going from funcs to
funcs_end. The end parameter is optional and must defaults to the upper
boundary of the ELF section __hyp_patchable_function_entries. The start
however is required and a value (most likely the return value for
hyp_ftrace_find_host_func()) must be given. Therefore, do not override
the start parameter when the optional end one isn't given.

This fixes cases where some functions were not properly
enabled/disabled.

Bug: 411075717
Bug: 357781595
Fix: e630ddc2c3 ("ANDROID: KVM: arm64: HVCs to filter Ftrace for pKVM hyp")
Change-Id: Ic9094c9de0599c8249ad1d7961e390c726c1208a
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
This commit is contained in:
Vincent Donnefort
2025-05-15 11:01:27 +01:00
parent e7a034a56f
commit 034ca00e74

View File

@@ -394,10 +394,8 @@ void *hyp_ftrace_sync(unsigned long *funcs_pg, unsigned long *funcs,
.funcs_pg = funcs_pg,
};
if (!funcs || !funcs_end) {
funcs = __hyp_patchable_function_entries_start;
if (!funcs_end)
funcs_end = __hyp_patchable_function_entries_end;
}
hyp_ftrace_patch(funcs, funcs_end, 2 * AARCH64_INSN_SIZE,
__get_enable_disable_ins_from_funcs_pg, (void *)&args);