Solved buildkernel: Fatal trap 9: general protection fault while in kernel mode

rigoletto@

Developer
Hello,

I am building kernel GENERIC without anything on src.conf or make.conf, and I am experiencing a kernel panic. The installed one is also without any modifications.

Code:
Fatal trap 9: general protection fault while in kernel mode
cpuid = 0; apic id = 00
instruction pointer = 0x20:0xffffffff80bec589
stack pointer         = 0x28:0xfffffe0122e13630
frame pointer         = 0x28:0xfffffe0122e13660
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  = 68017 (cc)
trap number  = 9
panic: general protection fault
cpuid = 0
KDB: stack backtrace:
#0 0xffffffff8098e390 at kdb_backtrace+0x60
#1 0xffffffff80951066 at vpanic+0x126
#2 0xffffffff80950f33 at panic+0x43
#3 0xffffffff80d55f7b at trap_fatal+0x36b
#4 0xffffffff80d55bfd at trap+0x77d
#5 0xffffffff80d3b8d2 at calltrap+0x8
#6 0xffffffff80be3306 at vm_page_alloc+0x1b6
#7 0xffffffff80bce336 at vm_fault_hold+0x416
#8 0xffffffff80bcded7 at vm_fault+0x77
#9 0xffffffff80d561a1 at trap_pfault+0x211
#10 0xffffffff80d559a7 at trap+0x527
#11 0xffffffff80d3b8d2 at calltrap+0x8
Uptime: 3h24m46s
Dumping 486 out of 4070 MB:..4%..14%..24%..33%..43%..53%..63%..73%..83%..93%

Code:
FreeBSD server 10.3-RELEASE FreeBSD 10.3-RELEASE #0 r297264: Fri Mar 25 02:10:02 UTC 2016

Thanks!
 
I tried again, three times, and the kernel build, but I still do not know what was causing this kernel panic.
 
Probably not relevant, but ... the only time I experienced the same thing, I had bad RAM.
The system appeared to run fine otherwise, but panic'd only when trying to build the kernel. I remember I ran MemTest for 24 hours without it finding a problem either, so in desperation I removed all RAM, except one and my build suddenly worked panic free.
 
The panics appear to be virtual memory related, so besides the checking the RAM I'd also check the disk for bad sectors (there's a high likelihood there's a bad sector right on the swap partition).
 
I did not had time to hook a monitor there so I add:

Code:
fsck_y_enable="YES"
background_fsck="NO"

on rc.conf and reboot. Now the issue seems to be resolved, but I will take a proper look later.
 
Note that this does a filesystem check, it does not scan for (or fix) bad sectors. It simply checks if the filesystem structure is still good. Besides that, the swap partition doesn't have a filesystem.
 
A crude test would be to run

dd if=/dev/your-device-here of=/dev/null bs=1m

and monitor the output of dmesg//var/log/messages for entries similar to:

Code:
(ada5:ata5:0:0:0): READ_DMA48. ACB: 25 00 60 6d 76 40 42 00 00 00 08 00
(ada5:ata5:0:0:0): CAM status: ATA Status Error
(ada5:ata5:0:0:0): ATA status: 51 (DRDY SERV ERR), error: 40 (UNC )
(ada5:ata5:0:0:0): RES: 51 40 67 6d 76 42 42 00 00 00 00
 
Last edited by a moderator:
I find a way to hook a monitor. Booted as single-user and run fsck -y:

Code:
FREE BLK COUNT(S) WRONG IN SUPERBLK
SUMMARY INFORMATION BAD
BLK(S) MISSING IN BIT MAPS

Apparently fixed.
 
Back
Top