Page MenuHomeFreeBSD

amd64: Drop segment descriptor details from trap messsages
Needs ReviewPublic

Authored by jhb on Wed, May 13, 4:30 PM.
Tags
None
Referenced Files
F157073843: D56989.diff
Mon, May 18, 7:10 AM
Unknown Object (File)
Sat, May 16, 9:13 PM
Unknown Object (File)
Thu, May 14, 8:03 PM
Unknown Object (File)
Wed, May 13, 6:45 PM
Unknown Object (File)
Wed, May 13, 5:54 PM
Unknown Object (File)
Wed, May 13, 5:39 PM
Subscribers

Details

Reviewers
kib
Summary

Segment descriptor contents are fixed on amd64 and not very interesting
compared to the other values that are displayed.

While here, include the TID of the current thread along with the PID
and drop redundant output of the trap number.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 73190
Build 70073: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Wed, May 13, 4:30 PM

Sample output:

Fatal trap 12: page fault while in kernel mode
cpuid = 14; apic id = 0e
fault virtual address   = 0x10
fault code              = supervisor read data, page not present
instruction pointer     = 0xffffffff80c2d954
stack pointer           = 0xfffffe00d8341bb0
frame pointer           = 0xfffffe00d8341be0
processor eflags        = interrupt enabled, resume, IOPL = 0
current thread          = 1545/100296 (sysctl)
trap number             = 12
rdi: fffffe00d8341bc4 rsi: 00002c35e0209000 rdx: 0000000000000001
rcx: 0000000000000004  r8: 0000000000000001  r9: 0000000000000000
rax: 0000000000000010 rbx: 0000000000000000 rbp: fffffe00d8341be0
r10: 0000000000000000 r11: fffff800070cf550 r12: 0000000000000000
r13: 0000000000000000 r14: fffffe00d8341cc0 r15: ffffffff81adf7c0
panic: page fault
cpuid = 14
time = 1778689713
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00d83418e0
...

For me, the segment registers values from the trap frame appeared to be very useful and sometimes even instrumental, e.g. during the recent FRED work. If the kernel idea of the trap frame address is misaligned with the location where the hardware put it, segment values are canaries that allow to see that immediately. Also, bugs with segments handling in doreti or fred_gouser are relatively obvious then. I am asking to keep that in the frame dump.

In D56989#1305907, @kib wrote:

For me, the segment registers values from the trap frame appeared to be very useful and sometimes even instrumental, e.g. during the recent FRED work. If the kernel idea of the trap frame address is misaligned with the location where the hardware put it, segment values are canaries that allow to see that immediately. Also, bugs with segments handling in doreti or fred_gouser are relatively obvious then. I am asking to keep that in the frame dump.

Ok. Do you care about there code segment details from the GDT?

In D56989#1306035, @jhb wrote:
In D56989#1305907, @kib wrote:

For me, the segment registers values from the trap frame appeared to be very useful and sometimes even instrumental, e.g. during the recent FRED work. If the kernel idea of the trap frame address is misaligned with the location where the hardware put it, segment values are canaries that allow to see that immediately. Also, bugs with segments handling in doreti or fred_gouser are relatively obvious then. I am asking to keep that in the frame dump.

Ok. Do you care about there code segment details from the GDT?

I did not used the gdt dump info ever.

jhb retitled this revision from amd64: Drop segment details from trap messsages to amd64: Drop segment descriptor details from trap messsages.Mon, May 18, 2:50 PM
jhb edited the summary of this revision. (Show Details)
sys/amd64/amd64/trap.c
984

And why not print td_comm as well then?