#1141862 Crash segfaults after showing "cannot set context for pid" when using vmlinux

Package:
crash
Source:
crash
Description:
kernel debugging utility, allowing gdb like syntax
Submitter:
Anderson Nascimento
Date:
2026-08-21 08:43:02 UTC
Severity:
normal
Tags:
#1141862#5
Date:
2026-07-11 17:13:56 UTC
From:
To:
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.

#1141862#10
Date:
2026-08-07 10:32:05 UTC
From:
To:
Confirmed. Thanks for the report.

I wonder though why this bug report triggers an auto-removal of crash
9.0.2+~16.3-1 from testing??

Hopefully this update defers that...

...Juerg

#1141862#17
Date:
2026-08-20 18:16:12 UTC
From:
To:
On Fri, 07 Aug 2026 10:32:05 +0000 Juerg Haefliger <juergh@proton.me> wrote:
 > Confirmed. Thanks for the report.
 >
 > I wonder though why this bug report triggers an auto-removal of crash
 > 9.0.2+~16.3-1 from testing??
 >
 > Hopefully this update defers that...
 >
 > ...Juerg
 >
 >

 >

Hello Juerg,

That was the first time I had reported a bug to Debian, and I don't know
why I didn't receive your message. Sorry for the delay. Where do I see
the auto-removal? Was it something that I did when I reported the bug?
Thanks for fixing the bug, I'll test it as soon as possible.

#1141862#28
Date:
2026-08-21 08:40:25 UTC
From:
To:
figure out BTS :-) I fiddled with it and the autoremoval is gone now.

FTR, it showed up here (in the action needed list):
https://tracker.debian.org/pkg/crash

FYI, I've uploaded a candidate to [1] and [2]. Can you grab the binary deb
from [2] and give it a whirl?

Thanks
...Juerg

[1] https://mentors.debian.net/
[2] https://people.canonical.com/~juergh/bug1141862/