summaryrefslogtreecommitdiff
path: root/arch/arm64/kvm/stacktrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm64/kvm/stacktrace.c')
-rw-r--r--arch/arm64/kvm/stacktrace.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/arch/arm64/kvm/stacktrace.c b/arch/arm64/kvm/stacktrace.c
index b69c18a26567..26927344a263 100644
--- a/arch/arm64/kvm/stacktrace.c
+++ b/arch/arm64/kvm/stacktrace.c
@@ -62,37 +62,54 @@ static bool kvm_nvhe_stack_kern_va(unsigned long *addr,
return true;
}
-static bool on_overflow_stack(unsigned long sp, unsigned long size,
- struct stack_info *info)
+static struct stack_info stackinfo_get_overflow(void)
{
struct kvm_nvhe_stacktrace_info *stacktrace_info
= this_cpu_ptr_nvhe_sym(kvm_stacktrace_info);
unsigned long low = (unsigned long)stacktrace_info->overflow_stack_base;
unsigned long high = low + OVERFLOW_STACK_SIZE;
- return on_stack(sp, size, low, high, STACK_TYPE_OVERFLOW, info);
+ return (struct stack_info) {
+ .low = low,
+ .high = high,
+ .type = STACK_TYPE_OVERFLOW,
+ };
}
-static bool on_hyp_stack(unsigned long sp, unsigned long size,
- struct stack_info *info)
+static struct stack_info stackinfo_get_hyp(void)
{
struct kvm_nvhe_stacktrace_info *stacktrace_info
= this_cpu_ptr_nvhe_sym(kvm_stacktrace_info);
unsigned long low = (unsigned long)stacktrace_info->stack_base;
unsigned long high = low + PAGE_SIZE;
- return on_stack(sp, size, low, high, STACK_TYPE_HYP, info);
+ return (struct stack_info) {
+ .low = low,
+ .high = high,
+ .type = STACK_TYPE_HYP,
+ };
}
static bool on_accessible_stack(const struct task_struct *tsk,
unsigned long sp, unsigned long size,
struct stack_info *info)
{
- if (info)
- info->type = STACK_TYPE_UNKNOWN;
+ struct stack_info tmp;
- return (on_overflow_stack(sp, size, info) ||
- on_hyp_stack(sp, size, info));
+ tmp = stackinfo_get_overflow();
+ if (stackinfo_on_stack(&tmp, sp, size))
+ goto found;
+
+ tmp = stackinfo_get_hyp();
+ if (stackinfo_on_stack(&tmp, sp, size))
+ goto found;
+
+ *info = stackinfo_get_unknown();
+ return false;
+
+found:
+ *info = tmp;
+ return true;
}
static int unwind_next(struct unwind_state *state)