Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: [netbsd-5-1] src/sys/arch/amd64

Module Name:    src
Committed By:   riz
Date:           Tue Jun 12 20:44:07 UTC 2012

Modified Files:
        src/sys/arch/amd64/amd64 [netbsd-5-1]: trap.c vector.S
        src/sys/arch/amd64/include [netbsd-5-1]: frameasm.h

Log Message:
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
        sys/arch/amd64/include/frameasm.h: 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 -r1.52.4.2 -r1. src/sys/arch/amd64/amd64/trap.c
cvs rdiff -u -r1.28.6.1 -r1. src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r1.12 -r1.12.18.1 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.

Home | Main Index | Thread Index | Old Index