diff options
author | Jann Horn <jannh@google.com> | 2025-03-25 05:01:23 +0300 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2025-03-25 10:30:43 +0300 |
commit | 2c118f50d7fd4d9aefc4533a26f83338b2906b7a (patch) | |
tree | 11f97fccb58fa46e97016584e878f2d341d1401a /tools/perf/scripts/python/sched-migration.py | |
parent | 57e2428f8df8263275344566e02c277648a4b7f1 (diff) | |
download | linux-2c118f50d7fd4d9aefc4533a26f83338b2906b7a.tar.xz |
x86/dumpstack: Fix inaccurate unwinding from exception stacks due to misplaced assignment
Commit:
2e4be0d011f2 ("x86/show_trace_log_lvl: Ensure stack pointer is aligned, again")
was intended to ensure alignment of the stack pointer; but it also moved
the initialization of the "stack" variable down into the loop header.
This was likely intended as a no-op cleanup, since the commit
message does not mention it; however, this caused a behavioral change
because the value of "regs" is different between the two places.
Originally, get_stack_pointer() used the regs provided by the caller; after
that commit, get_stack_pointer() instead uses the regs at the top of the
stack frame the unwinder is looking at. Often, there are no such regs at
all, and "regs" is NULL, causing get_stack_pointer() to fall back to the
task's current stack pointer, which is not what we want here, but probably
happens to mostly work. Other times, the original regs will point to
another regs frame - in that case, the linear guess unwind logic in
show_trace_log_lvl() will start unwinding too far up the stack, causing the
first frame found by the proper unwinder to never be visited, resulting in
a stack trace consisting purely of guess lines.
Fix it by moving the "stack = " assignment back where it belongs.
Fixes: 2e4be0d011f2 ("x86/show_trace_log_lvl: Ensure stack pointer is aligned, again")
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20250325-2025-03-unwind-fixes-v1-2-acd774364768@google.com
Diffstat (limited to 'tools/perf/scripts/python/sched-migration.py')
0 files changed, 0 insertions, 0 deletions