Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Nov 2023 15:38:29 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 275106] [regression] ng_ksocket(4) produces kernel panic
Message-ID:  <bug-275106-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D275106

            Bug ID: 275106
           Summary: [regression] ng_ksocket(4) produces kernel panic
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Keywords: crash, regression
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: eugen@freebsd.org
                CC: afedorov@FreeBSD.org, glebius@FreeBSD.org

Let's start ngctl without arguments (interactive mode) and run the following
commands to create ng_ksocket(4) instance listening tcp/9 port and connecte=
d to
ng_hole(4) to implement TCP "discard" service for demonstration:

mkpeer hole dummy dummy
name .:dummy hole
mkpeer hole: ksocket hohook inet/stream/tcp
name hole:hohook kso
# setsockopt(SOL_SOCKET, SO_REUSEPORT, 1)
msg kso: setopt { level=3D0xffff name=3D0x0200 value =3D [1] }
msg kso: bind inet/0.0.0.0:9
msg kso: listen 1
msg kso: accept

For FreeBSD releases before 12.0, it works: one can do "telnet localhost 9"=
 to
make connection to the port. Also ngctl command "shutdown kso:" works just =
fine
thereafter.

For FreeBSD versions after 12.0-RELEASE, "shutdown kso:" works if we run it
before "msg kso: listen 1". After that stage, "shutdown kso:" produces inst=
ant
panic:

Fatal trap 12: page fault while in kernel mode
cpuid =3D 0; apic id =3D 00
fault virtual address   =3D 0x18
fault code              =3D supervisor read data, page not present
instruction pointer     =3D 0x20:0xffffffff80b26298
stack pointer           =3D 0x28:0xfffffe00085ff9c0
frame pointer           =3D 0x28:0xfffffe00085ffa00
code segment            =3D base 0x0, limit 0xfffff, type 0x1b
                        =3D DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags        =3D interrupt enabled, resume, IOPL =3D 0
current process         =3D 730 (ngctl)
rdi: 0000000000000000 rsi: fffffe00099651e0 rdx: 0000000000000000
rcx: 00000000000003aa  r8: 0000000000000001  r9: 0000000000010000
rax: fffff80004064b40 rbx: 0000000000000018 rbp: fffffe00085ffa00
r10: 0000000000000001 r11: 0000000000010000 r12: 00000000000003aa
r13: 0000000000000000 r14: fffff8000352c400 r15: ffffffff823256a5
trap number             =3D 12
panic: page fault
cpuid =3D 0
time =3D 1700061288
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00085ff=
780
vpanic() at vpanic+0x150/frame 0xfffffe00085ff7d0
panic() at panic+0x43/frame 0xfffffe00085ff830
trap_fatal() at trap_fatal+0x40a/frame 0xfffffe00085ff890
trap_pfault() at trap_pfault+0xae/frame 0xfffffe00085ff8f0
calltrap() at calltrap+0x8/frame 0xfffffe00085ff8f0
--- trap 0xc, rip =3D 0xffffffff80b26298, rsp =3D 0xfffffe00085ff9c0, rbp =
=3D
0xfffffe00085ffa00 ---
__mtx_lock_flags() at __mtx_lock_flags+0x48/frame 0xfffffe00085ffa00
ng_ksocket_shutdown() at ng_ksocket_shutdown+0x39/frame 0xfffffe00085ffa20
ng_rmnode() at ng_rmnode+0x188/frame 0xfffffe00085ffa50
ng_apply_item() at ng_apply_item+0x4fb/frame 0xfffffe00085ffae0
ng_snd_item() at ng_snd_item+0x2cc/frame 0xfffffe00085ffb20
ngc_send() at ngc_send+0x1b3/frame 0xfffffe00085ffbc0
sosend_generic() at sosend_generic+0x5fe/frame 0xfffffe00085ffc70
sousrsend() at sousrsend+0x79/frame 0xfffffe00085ffcd0
kern_sendit() at kern_sendit+0x1c0/frame 0xfffffe00085ffd60
sendit() at sendit+0xb7/frame 0xfffffe00085ffdb0
sys_sendto() at sys_sendto+0x4d/frame 0xfffffe00085ffe00
amd64_syscall() at amd64_syscall+0x139/frame 0xfffffe00085fff30
fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe00085fff30
--- syscall (133, FreeBSD ELF64, sendto), rip =3D 0x556e6b62ffa, rsp =3D
0x556e4385f98, rbp =3D 0x556e4385fe0 ---
KDB: enter: panic
[ thread pid 730 tid 100070 ]
Stopped at      kdb_enter+0x32: movq    $0,0xde93a3(%rip)
db>

I got this panic using somewhat old 14.0-CURRENT system running in my bhyve.

This bug makes it impossible running net/mpd5 as PPP over TCP server as mpd5
uses ng_ksocket.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-275106-227>