Hello,
Crash is currently not working when used to inspect the system on Debian 12. It returns
"crash: cannot set context for pid: 498070" and then crashes. I identified the following
commit solves the problem.
Fix failure of gathering task table on Linux 6.5-rc1 and later
https://github.com/crash-utility/crash/commit/88580068b7dd96bf679c82bdc05e146968ade10c
I built different versions of crash version 8 from source and with the commit above applied,
it works fine. Without it, the utility crashes and makes it non-functional.
Default crash installed from the package.
```
user@debian:~$ sudo crash ~/vmlinux-6.1.0-50-amd64
crash 8.0.2
... [snip GDB header] ...
For help, type "help".
Type "apropos word" to search for commands related to "word"...
crash: cannot set context for pid: 498070
Segmentation fault
user@debian:~$
```
Crash 8 version built from commit 88580068b7dd96bf679c82bdc05e146968ade10c.
```
user@debian:~/crash$ sudo ./crash ~/vmlinux-6.1.0-50-amd64
crash 8.0.3++
... [snip GDB header] ...
For help, type "help".
Type "apropos word" to search for commands related to "word"...
KERNEL: /home/user/vmlinux-6.1.0-50-amd64
DUMPFILE: /proc/kcore
CPUS: 4
DATE: Fri Jul 10 21:59:47 -03 2026
UPTIME: 01:22:49
LOAD AVERAGE: 3.22, 2.72, 2.32
TASKS: 215
NODENAME: debian
RELEASE: 6.1.0-50-amd64
VERSION: #1 SMP PREEMPT_DYNAMIC Debian 6.1.176-1 (2026-07-02)
MACHINE: x86_64 (2711 Mhz)
MEMORY: 2 GB
PID: 456429
COMMAND: "crash"
TASK: ffff8b58c5eb3380 [THREAD_INFO: ffff8b58c5eb3380]
CPU: 1
STATE: TASK_RUNNING (ACTIVE)
crash> quit
user@debian:~/crash$ git log
commit 88580068b7dd96bf679c82bdc05e146968ade10c (HEAD)
Author: Kazuhito Hagio <k-hagio-ab@nec.com>
Date: Fri Jun 23 16:34:35 2023 +0900
Fix failure of gathering task table on Linux 6.5-rc1 and later
Kernel commit b69f0aeb0689 ("pid: Replace struct pid 1-element array
with flex-array") changed pid.numbers[1] to pid.numbers[]. With this,
the size of struct pid does not contain the size of struct upid:
(gdb) ptype /o struct pid
/* offset | size */ type = struct pid {
/* 0 | 4 */ refcount_t count;
...
/* 96 | 0 */ struct upid numbers[];
^^^^ ^^^
/* total size (bytes): 96 */
} ^^^^
As a result, in refresh_xarray_task_table(), crash does not read the
data of pid.numbers[0].ns and cannot gather the task table correctly.
$ crash vmlinux vmcore
...
WARNING: active task ffff936992ad0000 on cpu 1 not found in PID hash
...
crash> ps -S
RU: 9
crash>
Increase the size of reading struct pid by SIZE(upid) in this case.
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
...
user@debian:~/crash$
```
Crash 8 version built from commit 7750e61fdb2a083f26156a5338aa2ebe26447f3f (parent of fix).
```
user@debian:~/crash$ sudo ./crash ~/vmlinux-6.1.0-50-amd64
crash 8.0.3++
... [snip GDB header] ...
For help, type "help".
Type "apropos word" to search for commands related to "word"...
crash: cannot set context for pid: 496536
Segmentation fault
user@debian:~/crash$ git log
commit 7750e61fdb2a083f26156a5338aa2ebe26447f3f (HEAD)
Author: Kazuhito Hagio <k-hagio-ab@nec.com>
Date: Thu Jun 22 16:09:07 2023 +0900
Support module memory layout change on Linux 6.4
Support module memory layout change on Linux 6.4 by kernel commit
ac3b43283923 ("module: replace module_layout with module_memory") [1].
Without the patch, crash cannot even start a session with an error
message like this:
crash: invalid structure member offset: module_core_size
FILE: kernel.c LINE: 3787 FUNCTION: module_init()
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ac3b43283923
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
...
user@debian:~/crash$
```
I recommend backporting commit 88580068b7dd96bf679c82bdc05e146968ade10c to make crash utility functional by default on Debian 12.