diff options
| author | Christian Brauner <brauner@kernel.org> | 2025-01-04 09:56:42 +0100 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2025-01-04 10:12:19 +0100 |
| commit | 6a4ef7a2ff4dfdb7b345b13bd74fc68fe351bb45 (patch) | |
| tree | 785e008a7ebbfceed344f84b34bfdef5d0810d96 /tools/testing/selftests/coredump/stackdump | |
| parent | pipe_read: don't wake up the writer if the pipe is still full (diff) | |
| parent | selftests: coredump: Add stackdump test (diff) | |
| download | linux-6a4ef7a2ff4dfdb7b345b13bd74fc68fe351bb45.tar.gz linux-6a4ef7a2ff4dfdb7b345b13bd74fc68fe351bb45.zip | |
Merge patch series "fix reading ESP during coredump"
Nam Cao <namcao@linutronix.de> says:
In /proc/PID/stat, there is the kstkesp field which is the stack pointer of
a thread. While the thread is active, this field reads zero. But during a
coredump, it should have a valid value.
However, at the moment, kstkesp is zero even during coredump.
The first commit fixes this problem, and the second commit adds a selftest
to detect if this problem appears again in the future.
* patches from https://lore.kernel.org/r/cover.1735805772.git.namcao@linutronix.de:
selftests: coredump: Add stackdump test
fs/proc: do_task_stat: Fix ESP not readable during coredump
Link: https://lore.kernel.org/r/cover.1735805772.git.namcao@linutronix.de
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'tools/testing/selftests/coredump/stackdump')
| -rwxr-xr-x | tools/testing/selftests/coredump/stackdump | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/testing/selftests/coredump/stackdump b/tools/testing/selftests/coredump/stackdump new file mode 100755 index 000000000000..96714ce42d12 --- /dev/null +++ b/tools/testing/selftests/coredump/stackdump @@ -0,0 +1,14 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 + +CRASH_PROGRAM_ID=$1 +STACKDUMP_FILE=$2 + +TMP=$(mktemp) + +for t in /proc/$CRASH_PROGRAM_ID/task/*; do + tid=$(basename $t) + cat /proc/$tid/stat | awk '{print $29}' >> $TMP +done + +mv $TMP $STACKDUMP_FILE |
