Skip to content

Commit 33c222a

Browse files
pccwilldeacon
authored andcommitted
arm64: stacktrace: Relax frame record alignment requirement to 8 bytes
The AAPCS places no requirements on the alignment of the frame record. In theory it could be placed anywhere, although it seems sensible to require it to be aligned to 8 bytes. With an upcoming enhancement to tag-based KASAN Clang will begin creating frame records located at an address that is only aligned to 8 bytes. Accommodate such frame records in the stack unwinding code. As pointed out by Mark Rutland, the userspace stack unwinding code has the same problem, so fix it there as well. Signed-off-by: Peter Collingbourne <pcc@google.com> Link: https://linux-review.googlesource.com/id/Ia22c375230e67ca055e9e4bb639383567f7ad268 Acked-by: Andrey Konovalov <andreyknvl@gmail.com> Reviewed-by: Mark Rutland <mark.rutland@arm.com> Tested-by: Mark Rutland <mark.rutland@arm.com> Link: https://lore.kernel.org/r/20210526174927.2477847-2-pcc@google.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent 76734d2 commit 33c222a

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

arch/arm64/kernel/perf_callchain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void perf_callchain_user(struct perf_callchain_entry_ctx *entry,
116116
tail = (struct frame_tail __user *)regs->regs[29];
117117

118118
while (entry->nr < entry->max_stack &&
119-
tail && !((unsigned long)tail & 0xf))
119+
tail && !((unsigned long)tail & 0x7))
120120
tail = user_backtrace(tail, entry);
121121
} else {
122122
#ifdef CONFIG_COMPAT

arch/arm64/kernel/stacktrace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame)
7575
if (fp == (unsigned long)task_pt_regs(tsk)->stackframe)
7676
return -ENOENT;
7777

78-
if (fp & 0xf)
78+
if (fp & 0x7)
7979
return -EINVAL;
8080

8181
if (!on_accessible_stack(tsk, fp, 16, &info))

0 commit comments

Comments
 (0)