# Trying to figure out a kernel crash



## Avernar (Dec 27, 2017)

Can anyone tell why it crashed here:


```
Fatal trap 9: general protection fault while in kernel mode
cpuid = 2; apic id = 04
instruction pointer   = 0x20:0xffffffff80b1a443
stack pointer           = 0x28:0xfffffe03de99b7a0
frame pointer           = 0x28:0xffffffffffffffff
code segment       = base 0x0, limit 0xfffff, type 0x1b
           = DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags   = resume, IOPL = 0
current process       = 11 (idle: cpu3)
trap number       = 9
panic: general protection fault
cpuid = 2
KDB: stack backtrace:
#0 0xffffffff80b31f57 at kdb_backtrace+0x67
#1 0xffffffff80ae6e02 at vpanic+0x182
#2 0xffffffff80ae6c73 at panic+0x43
#3 0xffffffff80ff1d31 at trap_fatal+0x351
#4 0xffffffff80ff19c8 at trap+0x768
#5 0xffffffff80fd46d1 at calltrap+0x8
Uptime: 8d3h6m58s

Loaded symbols for /boot/kernel/autofs.ko
#0  doadump (textdump=<value optimized out>) at pcpu.h:221
221       __asm("movq %%gs:%1,%0" : "=r" (td)
(kgdb) list *0xffffffff80b1a443
0xffffffff80b1a443 is in sched_switch (/usr/src/sys/kern/sched_ule.c:1993).
1988        * Assert that all went well and return.
1989        */
1990       TDQ_LOCK_ASSERT(tdq, MA_OWNED|MA_NOTRECURSED);
1991       MPASS(td->td_lock == TDQ_LOCKPTR(tdq));
1992       td->td_oncpu = cpuid;
1993   }
1994   
1995   /*
1996    * Adjust thread priorities as a result of a nice request.
1997    */
Current language:  auto; currently minimal
```

From what I can tell it GPFed trying to access the thread data pointed to by td.  But td is used at the start of that function.  Unless something went wrong during cpu_switch(...).


----------

