linux-stable/arch
Chen Huang eac2f3059e
riscv: stacktrace: fix the riscv stacktrace when CONFIG_FRAME_POINTER enabled
As [1] and [2] said, the arch_stack_walk should not to trace itself, or it will
leave the trace unexpectedly when called. The example is when we do "cat
/sys/kernel/debug/page_owner", all pages' stack is the same.

arch_stack_walk+0x18/0x20
stack_trace_save+0x40/0x60
register_dummy_stack+0x24/0x5e
init_page_owner+0x2e

So we use __builtin_frame_address(1) as the first frame to be walked. And mark
the arch_stack_walk() noinline.

We found that pr_cont will affact pages' stack whose task state is RUNNING when
testing "echo t > /proc/sysrq-trigger". So move the place of pr_cont and mark
the function dump_backtrace() noinline.

Also we move the case when task == NULL into else branch, and test for it in
"echo c > /proc/sysrq-trigger".

[1] https://lore.kernel.org/lkml/20210319184106.5688-1-mark.rutland@arm.com/
[2] https://lore.kernel.org/lkml/20210317142050.57712-1-chenjun102@huawei.com/

Signed-off-by: Chen Huang <chenhuang5@huawei.com>
Fixes: 5d8544e2d0 ("RISC-V: Generic library routines and assembly")
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
2021-05-22 18:59:20 -07:00
..
alpha Merge branch 'akpm' (patches from Andrew) 2021-05-07 00:34:51 -07:00
arc mm: drop redundant HAVE_ARCH_TRANSPARENT_HUGEPAGE 2021-05-05 11:27:25 -07:00
arm Kbuild updates for v5.13 (2nd) 2021-05-08 10:00:11 -07:00
arm64 Assorted arm64 fixes and clean-ups, the most important: 2021-05-07 12:11:05 -07:00
csky arch/csky patches for 5.13-rc1 2021-05-03 12:58:31 -07:00
h8300 arch: rearrange headers inclusion order in asm/bitops for m68k, sh and h8300 2021-05-06 19:24:11 -07:00
hexagon Merge branch 'akpm' (patches from Andrew) 2021-05-07 00:34:51 -07:00
ia64 Merge branch 'akpm' (patches from Andrew) 2021-05-07 00:34:51 -07:00
m68k Kbuild updates for v5.13 (2nd) 2021-05-08 10:00:11 -07:00
microblaze tracing updates for 5.13 2021-05-03 11:19:54 -07:00
mips Kbuild updates for v5.13 (2nd) 2021-05-08 10:00:11 -07:00
nds32 tracing updates for 5.13 2021-05-03 11:19:54 -07:00
nios2 Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2021-05-02 09:14:01 -07:00
openrisc drivers/char: remove /dev/kmem for good 2021-05-07 00:26:34 -07:00
parisc Kbuild updates for v5.13 (2nd) 2021-05-08 10:00:11 -07:00
powerpc Kbuild updates for v5.13 (2nd) 2021-05-08 10:00:11 -07:00
riscv riscv: stacktrace: fix the riscv stacktrace when CONFIG_FRAME_POINTER enabled 2021-05-22 18:59:20 -07:00
s390 Merge branch 'akpm' (patches from Andrew) 2021-05-07 00:34:51 -07:00
sh Kbuild updates for v5.13 (2nd) 2021-05-08 10:00:11 -07:00
sparc Kbuild updates for v5.13 (2nd) 2021-05-08 10:00:11 -07:00
um Merge branch 'akpm' (patches from Andrew) 2021-05-07 00:34:51 -07:00
x86 Handle power-gating of AMD IOMMU perf counters properly when they are used. 2021-05-09 13:00:26 -07:00
xtensa Kbuild updates for v5.13 (2nd) 2021-05-08 10:00:11 -07:00
.gitignore .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
Kconfig Add Landlock, a new LSM from Mickaël Salaün <mic@linux.microsoft.com> 2021-05-01 18:50:44 -07:00