diff options
| author | Nam Cao <namcao@linutronix.de> | 2025-01-02 09:22:57 +0100 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2025-01-04 10:12:18 +0100 |
| commit | 15858da53542360931a457f32bcdc4287d13731f (patch) | |
| tree | 196d5c2737f9b6d011e278d8c7562298ca244b52 /tools/testing/selftests/coredump/stackdump | |
| parent | fs/proc: do_task_stat: Fix ESP not readable during coredump (diff) | |
| download | linux-15858da53542360931a457f32bcdc4287d13731f.tar.gz linux-15858da53542360931a457f32bcdc4287d13731f.zip | |
selftests: coredump: Add stackdump test
Add a test which checks that the kstkesp field in /proc/pid/stat can be
read for all threads of a coredumping process.
For full details including the motivation for this test and how it works,
see the README file added by this commit.
Reviewed-by: John Ogness <john.ogness@linutronix.de>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Link: https://lore.kernel.org/r/50e737b6576208566d14efcf1934fe840de6b1f4.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 |
