#1152188 procps: w -t -p == SIGSEV

Package:
procps
Source:
procps
Description:
/proc file system utilities
Submitter:
Tj
Date:
2026-10-27 09:55:02 UTC
Severity:
normal
Tags:
#1152188#5
Date:
2026-10-26 16:39:08 UTC
From:
To:
There is an upstream fix in commit 7425a392 "w: Do not crash with -pt":

https://gitlab.com/procps-ng/procps/-/commit/7425a3929cc80885dba77237a17fe472eed4b88a

$ gdb --args w -t -p
...
 16:15:01 up 26 days,  6:59,  1 user,  load average: 0.63, 0.85, 1.01
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU  WHAT

Program received signal SIGSEGV, Segmentation fault.
0x00005555555585b5 in print_terminal_user (longform=longform@entry=1, maxcmd=maxcmd@entry=119, from=from@entry=1, userlen=userlen@entry=8, fromlen=fromlen@entry=16,
    ip_addresses=ip_addresses@entry=0, show_pids=1, first_start=6707, first_pid=3798, last_pid=3798, ttyname=0x7fffffffd3b0 "tty2", jcpu=2075586, pcpu=2075586,
    cmdline=0x7fffffffd3e0 "/usr/lib/xorg/Xorg -nolisten tcp -background none -seat seat0 vt2 -auth /run/sddm/xauth_NLFZIf -noreset -displayfd 16") at src/w.c:870
870     #else
(gdb) bt full
#0  0x00005555555585b5 in print_terminal_user (longform=longform@entry=1, maxcmd=maxcmd@entry=119, from=from@entry=1, userlen=userlen@entry=8, fromlen=fromlen@entry=16,
    ip_addresses=ip_addresses@entry=0, show_pids=1, first_start=6707, first_pid=3798, last_pid=3798, ttyname=0x7fffffffd3b0 "tty2", jcpu=2075586, pcpu=2075586,
    cmdline=0x7fffffffd3e0 "/usr/lib/xorg/Xorg -nolisten tcp -background none -seat seat0 vt2 -auth /run/sddm/xauth_NLFZIf -noreset -displayfd 16") at src/w.c:870
        ut_pid = -1
        hertz = 100
        session = 0x0
        username = 0x0
        ttypath = "/dev/tty2", '\000' <repeats 28 times>
        uname = "root", '\000' <repeats 28 times>
        pids_length = 0
        u = 0x0
#1  0x000055555555894e in print_user_terminals (longform=longform@entry=1, maxcmd=maxcmd@entry=119, from=from@entry=1, userlen=userlen@entry=8, fromlen=fromlen@entry=16,
    ip_addresses=ip_addresses@entry=0, show_pids=1, pids_info=0x555555561970, reap=0x5555555619a8) at src/w.c:939
        i = 817
        total_procs = <optimized out>
        current_tty = <optimized out>
        first_pid = 3798
        last_start = <optimized out>
        first_start = 6707
        last_pid = 3798
        cmdline = "/usr/lib/xorg/Xorg -nolisten tcp -background none -seat seat0 vt2 -auth /run/sddm/xauth_NLFZIf -noreset -displayfd 16", '\000' <repeats 395 times>
        ttyname = "tty2", '\000' <repeats 28 times>, "#"
        jcpu = 2075586
        pcpu = <optimized out>
#2  0x00005555555567a1 in main (argc=<optimized out>, argv=<optimized out>) at src/w.c:1117

#1152188#10
Date:
2026-10-26 17:05:36 UTC
From:
To:
With slight modification I imported commit 7425a392 on 4.0.4-9 for
Trixie - confirmed it works as expected.

I've created a debdiff and attaching it here.

#1152188#15
Date:
2026-10-26 18:06:15 UTC
From:
To:
Looking at the use of the variable 'u' and the posssibilty that it is
not initialised for the calls into print_from() it might be worth also
cherry-picking commit 072af2e41aa230df4db17b since this bug is relying
on 'u'.