Bug 94020

Summary: [tcp] tcp_timer_2msl_tw NULL pointer dereference panic
Product: Base System Reporter: Brad Harvell <brad>
Component: kernAssignee: Andre Oppermann <andre>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 6.0-STABLE   
Hardware: Any   
OS: Any   

Description Brad Harvell 2006-03-02 13:00:15 UTC
page fault panic in tcp_timer_2msl_tw(), tw->tw_inpcb is dereferenced to NULL.

Pawel Worach reported this problem to the freebsd-net list with
5.4-RELEASE/i386. he included a backtrace which matches up with mine:

http://docs.freebsd.org/cgi/mid.cgi?4330711A.4040808
http://docs.freebsd.org/cgi/mid.cgi?4331F3A3.1060707


Fatal trap 12: page fault while in kernel mode
cpuid = 0; apic id = 00
fault virtual address   = 0x120
fault code              = supervisor write, page not present
instruction pointer     = 0x8:0xffffffff803eb5c8
stack pointer           = 0x10:0xffffffffb3b64b00
frame pointer           = 0x10:0x4
code segment            = base rx0, limit 0xfffff, type 0x1b
                        = DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags        = interrupt enabled, resume, IOPL = 0
current process         = 109 (swi4: clock sio)
trap number             = 12
panic: page fault
cpuid = 0


(kgdb) bt
#0  doadump () at pcpu.h:172
#1  0x0000000000000004 in ?? ()
#2  0xffffffff80334087 in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:399
#3  0xffffffff80334721 in panic (fmt=0xffffff011f5ea260 "") at /usr/src/sys/kern/kern_shutdown.c:555
#4  0xffffffff804d8f4f in trap_fatal (frame=0xffffff011f5ea260, eva=18446742979019198464) at /usr/src/sys/amd64/amd64/trap.c:660
#5  0xffffffff804d926f in trap_pfault (frame=0xffffffffb3b64a50, usermode=0) at /usr/src/sys/amd64/amd64/trap.c:573
#6  0xffffffff804d9523 in trap (frame=
      {tf_rdi = 37, tf_rsi = -1094690364832, tf_rdx = 352, tf_rcx = 0, tf_r8 = -1094690364832, tf_r9 = -1097703752096, tf_rax = 4, tf_rbx = -1095116425984, tf_rbp = 4, tf_r10 = -1095116423576, tf_r11 = -1099251533776, tf_r12 = 0, tf_r13 = -2138799016, tf_r14 = -2138799008, tf_r15 = 1, tf_trapno = 12, tf_addr = 288, tf_flags = -2138799016, tf_err = 2, tf_rip = -2143373880, tf_cs = 8, tf_rflags = 66183, tf_rsp = -1279898864, tf_ss = 16}) at /usr/src/sys/amd64/amd64/trap.c:352
#7  0xffffffff804c665b in calltrap () at /usr/src/sys/amd64/amd64/exception.S:168
#8  0xffffffff803eb5c8 in tcp_timer_2msl_tw (reuse=0) at atomic.h:142
#9  0xffffffff803eb680 in tcp_slowtimo () at /usr/src/sys/netinet/tcp_timer.c:136
#10 0xffffffff80376517 in pfslowtimo (arg=0x25) at /usr/src/sys/kern/uipc_domain.c:475
#11 0xffffffff803433b5 in softclock (dummy=0x25) at /usr/src/sys/kern/kern_timeout.c:290
#12 0xffffffff8031b315 in ithread_loop (arg=0xffffff0000d06000) at /usr/src/sys/kern/kern_intr.c:547
#13 0xffffffff80319e57 in fork_exit (callout=0xffffffff8031b230 <ithread_loop>, arg=0xffffff0000d06000, frame=0xffffffffb3b64c50)
    at /usr/src/sys/kern/kern_fork.c:789
#14 0xffffffff804c69be in fork_trampoline () at /usr/src/sys/amd64/amd64/exception.S:394
#15 0x0000000000000000 in ?? ()


(kgdb) frame 8
#8  0xffffffff803eb5c8 in tcp_timer_2msl_tw (reuse=0) at atomic.h:142

(kgdb) info loc
tw = (struct tcptw *) 0xffffff0105f97500
tw_tail = (struct tcptw *) 0xffffffff80848460
twl = (struct twlist *) 0xffffffff80848458
i = 1

(kgdb) p *tw
$1 = {tw_inpcb = 0x0, snd_nxt = 2902930442, rcv_nxt = 766179888, iss = 2902880028, irs = 766179299, last_win = 65534,
  tw_so_options = 4, tw_cred = 0x0, t_recent = 0, t_starttime = 18446744073709518933, tw_time = 0, tw_2msl = {
    le_next = 0xffffff000c971c30, le_prev = 0xffffffff80848458}}

Fix: 

unknown
How-To-Repeat: unknown
Comment 1 Andre Oppermann freebsd_committer freebsd_triage 2006-03-03 21:51:39 UTC
Responsible Changed
From-To: freebsd-bugs->andre

Take over.
Comment 2 Bruce M Simpson 2006-09-25 20:04:33 UTC
Didn't this get fixed by mohans in tcp_timer.c rev 1.82 ?
Comment 3 Gleb Smirnoff freebsd_committer freebsd_triage 2006-10-14 12:39:50 UTC
State Changed
From-To: open->feedback

Is the problem reproducible on latest RELENG_6? There was 
some work done in this area.
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2007-06-12 08:29:52 UTC
State Changed
From-To: feedback->closed

Feedback timeout (> 6 months).