Package: procps
Version: 2:4.0.4-4
Severity: normal

I noticed that w is segfaulting sometimes. Backtracing it showed the
issue. Running `w -hs` crashes. The main function passes NULL utmp entry
together with the systemd session, while later print_from expects to be
able to access the utmp data.

(gdb) r
Starting program: /tmp/procps-4.0.4/src/.libs/w -hs
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
print_host (host=host@entry=0x4c <error: Cannot access memory at address 0x4c>, 
len=16, len@entry=256, fromlen=fromlen@entry=16) at src/w.c:112
112                     if (*host == '\0') break;
(gdb) bt
#0  print_host (host=host@entry=0x4c <error: Cannot access memory at address 
0x4c>, len=16, len@entry=256, fromlen=fromlen@entry=16) at src/w.c:112
#1  0x0000555555557371 in print_from (session=session@entry=0x0, u=u@entry=0x0, 
ip_addresses=ip_addresses@entry=0, fromlen=fromlen@entry=16) at src/w.c:264
#2  0x0000555555557e6e in showinfo (session=0x5555555654d0 "1794", 
name=name@entry=0x55555555d800 "lumag", u=u@entry=0x0, 
formtype=formtype@entry=0, maxcmd=maxcmd@entry=156, from=from@entry=1,
    userlen=8, fromlen=16, ip_addresses=0, pids=0) at src/w.c:622
#3  0x000055555555671f in main (argc=<optimized out>, argv=<optimized out>) at 
src/w.c:831
(gdb) list src/w.c:831
826                                             if (!strcmp(name, user))
827                                                     
showinfo(sessions_list[i], name, NULL, longform,
828                                                              maxcmd, from, 
userlen, fromlen,
829                                                              ip_addresses, 
pids);
830                                     } else {
831                                             showinfo(sessions_list[i], 
name, NULL, longform, maxcmd,
832                                                      from, userlen, 
fromlen, ip_addresses, pids);
833                                     }
834                                     free(name);
835                                     free(sessions_list[i]);
(gdb) l src/w.c:264
259                     if (len) { /* IP address is non-empty, print it (and 
concatenate with display, if present) */
260                             fputs(buf, stdout);
261                             /* show the display part of the host or IPv6 
link addr. interface, if present */
262                             print_display_or_interface(u->ut_host, 
UT_HOSTSIZE, fromlen - len);
263                     } else { /* IP address is empty, print the host instead 
*/
264                             print_host(u->ut_host, UT_HOSTSIZE, fromlen);
265                     }
266             } else {  /* -i switch NOT used */
267                     print_host(u->ut_host, UT_HOSTSIZE, fromlen);
268             }



-- System Information:
Debian Release: trixie/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.6.15-amd64 (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/bash
Init: systemd (via /run/systemd/system)

Versions of packages procps depends on:
ii  init-system-helpers  1.66
ii  libc6                2.37-15
ii  libncursesw6         6.4+20240113-1
ii  libproc2-0           2:4.0.4-4
ii  libsystemd0          255.4-1
ii  libtinfo6            6.4+20240113-1

Versions of packages procps recommends:
ii  psmisc  23.7-1

procps suggests no packages.

-- no debconf information

Reply via email to