[Bug 268400] Page fault kernel panic with KTLS enabled

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 15 Dec 2022 22:30:38 UTC

            Bug ID: 268400
           Summary: Page fault kernel panic with KTLS enabled
           Product: Base System
           Version: 13.1-STABLE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: amigan@gmail.com

I enabled KTLS in nginx today on this machine, which is a reverse proxy and pf
firewall. I am using base openssl.

FreeBSD 13.1-STABLE #14 stable/13-n253193-e84ae60fc510: Wed Nov 30 11:00:39 EST
2022     root@argon.h.c907:/usr/obj/usr/src/amd64.amd64/sys/FARWARL amd64

A few hours later it panicked:
Fatal trap 12: page fault while in kernel mode
cpuid = 1; apic id = 02
fault virtual address   = 0x0
fault code              = supervisor read data, page not present
instruction pointer     = 0x20:0xffffffff80b81ea0
stack pointer           = 0x28:0xfffffe0083ed7440
frame pointer           = 0x28:0xfffffe0083ed7470
code segment            = base 0x0, limit 0xfffff, type 0x1b
                        = DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags        = interrupt enabled, resume, IOPL = 0
current process         = 2 (thr_2)
trap number             = 12
panic: page fault
cpuid = 1
time = 1671140551
KDB: stack backtrace:
#0 0xffffffff8094b025 at kdb_backtrace+0x65
#1 0xffffffff808fdf01 at vpanic+0x151
#2 0xffffffff808fdda3 at panic+0x43
#3 0xffffffff80dc4d87 at trap_fatal+0x387
#4 0xffffffff80dc4ddf at trap_pfault+0x4f
#5 0xffffffff80d9c648 at calltrap+0x8
#6 0xffffffff80b78c2c at icmp6_reflect+0x2ac
#7 0xffffffff80b7875c at icmp6_error+0x37c
#8 0xffffffff80be4d61 at pf_route6+0x651
#9 0xffffffff80be4086 at pf_test6+0xa36
#10 0xffffffff80bf7ab0 at pf_check6_out+0x40
#11 0xffffffff80a4f527 at pfil_run_hooks+0x97
#12 0xffffffff80b947f9 at ip6_output+0x1149
#13 0xffffffff80b5b930 at tcp_output+0x1ea0
#14 0xffffffff80b6ddfb at tcp_usr_ready+0x15b
#15 0xffffffff8098f6a7 at ktls_encrypt+0x2a7
#16 0xffffffff8098e8e8 at ktls_work_thread+0x188
#17 0xffffffff808badae at fork_exit+0x7e
Timeout initializing vt_vga
Uptime: 13d6h0m24s
Dumping 1240 out of 8062 MB: (CTRL-C to abort)

(kgdb) bt
#0  __curthread () at /usr/src/sys/amd64/include/pcpu_aux.h:55
#1  dump_savectx () at /usr/src/sys/kern/kern_shutdown.c:394
#2  0xffffffff808fdaf8 in dumpsys (di=0x0) at
#3  doadump (textdump=<optimized out>) at /usr/src/sys/kern/kern_shutdown.c:423
#4  kern_reboot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:497
#5  0xffffffff808fdf6e in vpanic (fmt=<optimized out>,
ap=ap@entry=0xfffffe0083ed7290) at /usr/src/sys/kern/kern_shutdown.c:930
#6  0xffffffff808fdda3 in panic (fmt=<unavailable>) at
#7  0xffffffff80dc4d87 in trap_fatal (frame=0xfffffe0083ed7380, eva=0) at
#8  0xffffffff80dc4ddf in trap_pfault (frame=0xfffffe0083ed7380,
usermode=false, signo=<optimized out>, ucode=<optimized out>) at
#9  <signal handler called>
#10 in6_cksum_partial (m=<optimized out>, m@entry=0xfffff8003985f900,
nxt=nxt@entry=58 ':', off=<optimized out>, off@entry=40, len=len@entry=1240,
cov=<optimized out>, cov@entry=1240)
    at /usr/src/sys/netinet6/in6_cksum.c:319
#11 0xffffffff80b820cd in in6_cksum (m=0x488, m@entry=0xfffff8003985f900, nxt=0
'\000', nxt@entry=58 ':', off=8, off@entry=40, len=893953, len@entry=1240)
    at /usr/src/sys/netinet6/in6_cksum.c:366
#12 0xffffffff80b78c2c in icmp6_reflect (m=m@entry=0xfffff8003985f900,
off=off@entry=40) at /usr/src/sys/netinet6/icmp6.c:2159
#13 0xffffffff80b7875c in icmp6_error (m=0xfffff8003985f900, type=type@entry=2,
code=code@entry=0, param=1280) at /usr/src/sys/netinet6/icmp6.c:384
#14 0xffffffff80be4d61 in pf_route6 (m=m@entry=0xfffffe0083ed7a20,
r=0xfffff8005814a800, dir=dir@entry=2, oifp=<optimized out>,
s=0xfffff800a3bfb000, pd=pd@entry=0xfffffe0083ed7698,
    inp=0xfffff801b47313e0) at /usr/src/sys/netpfil/pf/pf.c:6188
#15 0xffffffff80be4086 in pf_test6 (dir=dir@entry=2, pflags=131072,
ifp=0xfffff80003bb0800, m0=m0@entry=0xfffffe0083ed7a20, inp=0xfffff801b47313e0)
at /usr/src/sys/netpfil/pf/pf.c:7181
#16 0xffffffff80bf7ab0 in pf_check6_out (m=0xfffffe0083ed7a20, ifp=0x488,
flags=0, ruleset=<optimized out>, inp=0x200) at
#17 0xffffffff80a4f527 in pfil_run_hooks (head=<optimized out>, p=...,
ifp=0xfffff80003bb0800, flags=flags@entry=131072, inp=0xfffff801b47313e0) at
#18 0xffffffff80b947f9 in ip6_output (m0=m0@entry=0xfffff80034029600, opt=0x0,
ro=0xfffff801b4731570, flags=0, im6o=im6o@entry=0x0, ifpp=ifpp@entry=0x0,
    at /usr/src/sys/netinet6/ip6_output.c:1014
#19 0xffffffff80b5b930 in tcp_output (tp=0xfffffe00c82f90e0) at
#20 0xffffffff80b6ddfb in tcp_usr_ready (so=<optimized out>,
m=0xfffff800186c5d00, count=<optimized out>) at
#21 0xffffffff8098f6a7 in ktls_encrypt (top=0x0, top@entry=0xfffff800186c5d00)
at /usr/src/sys/kern/uipc_ktls.c:2332
#22 0xffffffff8098e8e8 in ktls_work_thread (ctx=ctx@entry=0xfffff800031ab700)
at /usr/src/sys/kern/uipc_ktls.c:2380
#23 0xffffffff808badae in fork_exit (callout=0xffffffff8098e760
<ktls_work_thread>, arg=0xfffff800031ab700, frame=0xfffffe0083ed7f40) at
#24 <signal handler called>
#25 mi_startup () at /usr/src/sys/kern/init_main.c:322
#26 0xffffffff80d14399 in swapper () at /usr/src/sys/vm/vm_swapout.c:755
#27 0xffffffff80340022 in btext () at /usr/src/sys/amd64/amd64/locore.S:80

I will keep the core around for a bit; please feel free to let me know of
anymore information required.

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