[Bug 279875] sockstat: segmentation fault

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 18 Jul 2024 10:40:00 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279875

John Marshall <john@jmarshall.id.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |john@jmarshall.id.au

--- Comment #1 from John Marshall <john@jmarshall.id.au> ---
'Me too'

Recent 14-STABLE amd64

 FreeBSD 14.1-STABLE #0 stable/14-n268159-60f78f8ed14d: Tue Jul 16 19:25:41
AEST 2024    
john@rwsrv08.gfn.riverwillow.net.au:/build/obj/john/kits/src/amd64.amd64/sys/RWSRV08

No segfault if I specify -j to restrict dispaly to one of the jails, only if I
specify -j0 or omit -j. This is my third build of 14-STABLE (beginning early
May) and all of them have done the same. Same vintage 14-STABLE on i386 is
fine. I only have the two systems running FreeBSD.

rwsrv08# lldb -X sockstat
(lldb) target create "sockstat"
Current executable set to '/usr/bin/sockstat' (x86_64).
(lldb) run
Process 87548 launched: '/usr/bin/sockstat' (x86_64)
USER     COMMAND    PID   FD  PROTO  LOCAL ADDRESS         FOREIGN ADDRESS      
root     sockstat   87554 6   stream -> [87548 8]
root     sockstat   87553 6   stream -> [87548 7]
...
root     syslogd     2948 9   dgram  /var/run/logpriv
root     gssd        2810 3   stream /var/run/gssd.sock
Process 87548 stopped
* thread #1, name = 'sockstat', stop reason = signal SIGSEGV: address not
mapped to object (fault address: 0x18)
    frame #0: 0x000002c892dde507 sockstat`displaysock [inlined]
file_compare(a=<unavailable>, b=0x0000000000000000) at sockstat.c:179:38
   176  static int64_t
   177  file_compare(const struct file *a, const struct file *b)
   178  {
-> 179          return ((int64_t)(a->xf_data/2 - b->xf_data/2));
                                                    ^
   180  }
   181  RB_GENERATE_STATIC(files_t, file, file_tree, file_compare);
   182  
(lldb) bt
* thread #1, name = 'sockstat', stop reason = signal SIGSEGV: address not
mapped to object (fault address: 0x18)
  * frame #0: 0x000002c892dde507 sockstat`displaysock [inlined]
file_compare(a=<unavailable>, b=0x0000000000000000) at sockstat.c:179:38
    frame #1: 0x000002c892dde507 sockstat`displaysock [inlined]
files_t_RB_FIND(head=<unavailable>, elm=<unavailable>) at sockstat.c:181:1
    frame #2: 0x000002c892dde4fe sockstat`displaysock(s=0x00001790ce24be00,
pos=<unavailable>) at sockstat.c:1165:10
    frame #3: 0x000002c892ddd71f sockstat`display at sockstat.c:1345:4
    frame #4: 0x000002c892ddcc07 sockstat`main(argc=<unavailable>,
argv=<unavailable>) at sockstat.c:1577:2
    frame #5: 0x000002d0b7f008da libc.so.7`__libc_start1(argc=1,
argv=0x000002d0b2e0ed10, env=0x000002d0b2e0ed20, cleanup=<unavailable>,
mainX=(sockstat`main at sockstat.c:1434)) at libc_start1.c:157:7
    frame #6: 0x000002c892ddb18d sockstat`_start at crt1_s.S:83
(lldb) q

-- 
You are receiving this mail because:
You are the assignee for the bug.