/* * hyp_prepare_backtrace - Prepare non-protected nVHE backtrace. * * @fp : frame pointer at which to start the unwinding. * @pc : program counter at which to start the unwinding. * * Save the information needed by the host to unwind the non-protected * nVHE hypervisor stack in EL1.
*/ staticvoid hyp_prepare_backtrace(unsignedlong fp, unsignedlong pc)
{ struct kvm_nvhe_stacktrace_info *stacktrace_info = this_cpu_ptr(&kvm_stacktrace_info); struct kvm_nvhe_init_params *params = this_cpu_ptr(&kvm_init_params);
staticvoid notrace unwind(struct unwind_state *state,
stack_trace_consume_fn consume_entry, void *cookie)
{ while (1) { int ret;
if (!consume_entry(cookie, state->pc)) break;
ret = unwind_next(state); if (ret < 0) break;
}
}
/* * pkvm_save_backtrace_entry - Saves a protected nVHE HYP stacktrace entry * * @arg : index of the entry in the stacktrace buffer * @where : the program counter corresponding to the stack frame * * Save the return address of a stack frame to the shared stacktrace buffer. * The host can access this shared buffer from EL1 to dump the backtrace.
*/ staticbool pkvm_save_backtrace_entry(void *arg, unsignedlong where)
{ unsignedlong *stacktrace = this_cpu_ptr(pkvm_stacktrace); int *idx = (int *)arg;
/* * Need 2 free slots: 1 for current entry and 1 for the * delimiter.
*/ if (*idx > ARRAY_SIZE(pkvm_stacktrace) - 2) returnfalse;
/* * pkvm_save_backtrace - Saves the protected nVHE HYP stacktrace * * @fp : frame pointer at which to start the unwinding. * @pc : program counter at which to start the unwinding. * * Save the unwinded stack addresses to the shared stacktrace buffer. * The host can access this shared buffer from EL1 to dump the backtrace.
*/ staticvoid pkvm_save_backtrace(unsignedlong fp, unsignedlong pc)
{ struct stack_info stacks[] = {
stackinfo_get_overflow(),
stackinfo_get_hyp(),
}; struct unwind_state state = {
.stacks = stacks,
.nr_stacks = ARRAY_SIZE(stacks),
}; int idx = 0;
/* * kvm_nvhe_prepare_backtrace - prepare to dump the nVHE backtrace * * @fp : frame pointer at which to start the unwinding. * @pc : program counter at which to start the unwinding. * * Saves the information needed by the host to dump the nVHE hypervisor * backtrace.
*/ void kvm_nvhe_prepare_backtrace(unsignedlong fp, unsignedlong pc)
{ if (is_protected_kvm_enabled())
pkvm_save_backtrace(fp, pc); else
hyp_prepare_backtrace(fp, pc);
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.23 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.