[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: [netbsd-5] src/sys/arch/amd64
Module Name: src
Committed By: riz
Date: Tue Jun 12 20:43:48 UTC 2012
src/sys/arch/amd64/amd64 [netbsd-5]: trap.c vector.S
src/sys/arch/amd64/include [netbsd-5]: frameasm.h
Pull up following revision(s) (requested by spz in ticket #1772):
sys/arch/amd64/amd64/trap.c: revision 1.71 via patch
sys/arch/amd64/amd64/vector.S: revision 1.41 via patch
Treat traps in kernel mode during the 'return to user' iret sequence
as user faults.
Based heavily in the i386 code with the correct opcode bytes inserted.
iret path tested, arranging for segment register errors is harder.
User %fs and %gs (32bit apps) are loaded much earlier and any errors
will generate kernel panics - there is probably code to try to stop
the invalid values being set.
If we get a fault setting the user %gs, or on a iret that is returning
to userspace, we must do a 'swapgs' to reload the kernel %gs_base.
Also save the %ds, %es, %fs, %gs selector values in the frame so
they can be restored if we finally return to user (probably after
an application SIGSEGV handler has fixed the error).
Without this any such fault leaves the kernel running with the wrong
%gs offset and it will most likely fault again early in trap().
Repeats until the stack tramples on something important.
iret change works, invalid %gs is a little harder to arrange.
To generate a diff of this commit:
cvs rdiff -u -r184.108.40.206 -r220.127.116.11 src/sys/arch/amd64/amd64/trap.c
cvs rdiff -u -r18.104.22.168 -r22.214.171.124 src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r1.12 -r126.96.36.199 src/sys/arch/amd64/include/frameasm.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Main Index |
Thread Index |