Skip to content

Commit 75e9459

Browse files
Kalesh SinghMarc Zyngier
authored andcommitted
KVM: arm64: Implement protected nVHE hyp stack unwinder
Implements the common framework necessary for unwind() to work in the protected nVHE context: - on_accessible_stack() - on_overflow_stack() - unwind_next() Protected nVHE unwind() is used to unwind and save the hyp stack addresses to the shared stacktrace buffer. The host reads the entries in this buffer, symbolizes and dumps the stacktrace (later patch in the series). Signed-off-by: Kalesh Singh <[email protected]> Reviewed-by: Fuad Tabba <[email protected]> Tested-by: Fuad Tabba <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 871c5d9 commit 75e9459

File tree

1 file changed

+12
-3
lines changed
  • arch/arm64/include/asm/stacktrace

1 file changed

+12
-3
lines changed

arch/arm64/include/asm/stacktrace/nvhe.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,27 @@ static inline bool on_accessible_stack(const struct task_struct *tsk,
6464
static inline bool on_overflow_stack(unsigned long sp, unsigned long size,
6565
struct stack_info *info)
6666
{
67-
return false;
67+
unsigned long low = (unsigned long)this_cpu_ptr(overflow_stack);
68+
unsigned long high = low + OVERFLOW_STACK_SIZE;
69+
70+
return on_stack(sp, size, low, high, STACK_TYPE_OVERFLOW, info);
6871
}
6972

7073
static inline bool on_hyp_stack(unsigned long sp, unsigned long size,
7174
struct stack_info *info)
7275
{
73-
return false;
76+
struct kvm_nvhe_init_params *params = this_cpu_ptr(&kvm_init_params);
77+
unsigned long high = params->stack_hyp_va;
78+
unsigned long low = high - PAGE_SIZE;
79+
80+
return on_stack(sp, size, low, high, STACK_TYPE_HYP, info);
7481
}
7582

7683
static inline int notrace unwind_next(struct unwind_state *state)
7784
{
78-
return 0;
85+
struct stack_info info;
86+
87+
return unwind_next_common(state, &info, NULL);
7988
}
8089
NOKPROBE_SYMBOL(unwind_next);
8190
#endif /* CONFIG_PROTECTED_NVHE_STACKTRACE */

0 commit comments

Comments
 (0)