Files
kernel_oneplus_sm8250/kernel
Peter Zijlstra d45c8bd5d5 perf: Fix sample vs do_exit()
[ Upstream commit 4f6fc782128355931527cefe3eb45338abd8ab39 ]

Baisheng Gao reported an ARM64 crash, which Mark decoded as being a
synchronous external abort -- most likely due to trying to access
MMIO in bad ways.

The crash further shows perf trying to do a user stack sample while in
exit_mmap()'s tlb_finish_mmu() -- i.e. while tearing down the address
space it is trying to access.

It turns out that we stop perf after we tear down the userspace mm; a
receipie for disaster, since perf likes to access userspace for
various reasons.

Flip this order by moving up where we stop perf in do_exit().

Additionally, harden PERF_SAMPLE_CALLCHAIN and PERF_SAMPLE_STACK_USER
to abort when the current task does not have an mm (exit_mm() makes
sure to set current->mm = NULL; before commencing with the actual
teardown). Such that CPU wide events don't trip on this same problem.

Fixes: c5ebcedb56 ("perf: Add ability to attach user stack dump to sample")
Reported-by: Baisheng Gao <baisheng.gao@unisoc.com>
Suggested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20250605110815.GQ39944@noisy.programming.kicks-ass.net
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Ulrich Hecht <uli@kernel.org>
2025-07-17 10:08:05 +02:00
..
2025-07-17 10:08:05 +02:00
2024-07-05 09:00:29 +02:00
2025-04-04 11:11:29 +02:00
2019-12-13 08:51:11 +01:00
2023-12-20 15:38:01 +01:00
2025-07-17 10:08:05 +02:00
2021-02-10 09:21:06 +01:00
2020-03-25 08:06:13 +01:00
2019-01-13 09:51:06 +01:00
2024-11-08 16:19:12 +01:00
2021-02-07 14:48:38 +01:00
2020-01-09 10:18:59 +01:00