Skip to contentSkip to conversation

What is i386 thread.trapno?

DISCUSSION Jeff Dike 3 participants 4 messages Jun 3, 2001

lore
Share & tools
lore

Jeff Dike

author
#0 lore raw

With a normal segfault, the handler gets a trapno == 14 in the sigcontext. With UML, I can make a process infinitely segfault with trapno == 1. The page being accessed is correctly mapped in according to /proc/<pid>/maps, so the odd trapno is the only clue that I can see that something is different.

The i386 page fault handler sets trap_no to 14, so the fault isn't coming from there, but I can't see where a SIGSEGV is being delivered to a process with thread.trap_no == 1.

So:
What do these trap numbers mean?
Where can I read about them?
and
Where's this segfault coming from?

Jeff

#1 lore raw
Quoted 7 lines · Jeff Dike

The i386 page fault handler sets trap_no to 14, so the fault isn't coming from there, but I can't see where a SIGSEGV is being delivered to a process with thread.trap_no == 1.

So:
What do these trap numbers mean?
Where can I read about them?

Intel Architecture Software Developer's Manual Volume 3: System Programming. Interrupt and Exception Handling, table 5.1 (postscript extract of that table has been copied in separate private mail). intel-ia32-arch-vol3-24319202.pdf.

Quoted 2 lines

and
Where's this segfault coming from?

Probably do_debug() which sets trapno = 1 and also uses handle_vm86_trap(,,1).

#2 lore raw
In reply to Jeff Dike
Quoted 3 lines

The i386 page fault handler sets trap_no to 14, so the fault isn't coming from there, but I can't see where a SIGSEGV is being delivered to a process with thread.trap_no == 1.

include/asm-i386/siginfo.h

author
#3 lore raw
Quoted 1 line · [email protected] said:

include/asm-i386/siginfo.h

Using SA_INFO would be nice, but it doesn't look like the siginfo will tell me whether the faulting operation is a read or write.

Jeff