Commit 4f6fc78
Peter Zijlstra
perf: Fix sample vs do_exit()
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: c5ebced ("perf: Add ability to attach user stack dump to sample")
Reported-by: Baisheng Gao <[email protected]>
Suggested-by: Mark Rutland <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]1 parent 86aa94c commit 4f6fc78
2 files changed
+16
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7439 | 7439 | | |
7440 | 7440 | | |
7441 | 7441 | | |
| 7442 | + | |
| 7443 | + | |
| 7444 | + | |
| 7445 | + | |
7442 | 7446 | | |
7443 | 7447 | | |
7444 | 7448 | | |
| |||
8150 | 8154 | | |
8151 | 8155 | | |
8152 | 8156 | | |
| 8157 | + | |
| 8158 | + | |
| 8159 | + | |
8153 | 8160 | | |
8154 | 8161 | | |
8155 | 8162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
944 | 944 | | |
945 | 945 | | |
946 | 946 | | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
947 | 956 | | |
948 | 957 | | |
949 | 958 | | |
| |||
959 | 968 | | |
960 | 969 | | |
961 | 970 | | |
962 | | - | |
963 | | - | |
964 | | - | |
965 | | - | |
966 | | - | |
967 | | - | |
968 | | - | |
969 | | - | |
970 | 971 | | |
971 | 972 | | |
972 | 973 | | |
| |||
0 commit comments