]> bbs.cooldavid.org Git - net-next-2.6.git/commit
[PATCH] x86: make IOPL explicit
authorZachary Amsden <zach@vmware.com>
Sat, 3 Sep 2005 22:56:44 +0000 (15:56 -0700)
committerLinus Torvalds <torvalds@evo.osdl.org>
Mon, 5 Sep 2005 07:06:12 +0000 (00:06 -0700)
commita5201129307f414890f9a4410e38da205f5d7359
treead70c5f1d3b336ef5665a7fd5ad8707aaec23847
parent0998e4228aca046fbd747c3fed909791d52e88eb
[PATCH] x86: make IOPL explicit

The pushf/popf in switch_to are ONLY used to switch IOPL.  Making this
explicit in C code is more clear.  This pushf/popf pair was added as a
bugfix for leaking IOPL to unprivileged processes when using
sysenter/sysexit based system calls (sysexit does not restore flags).

When requesting an IOPL change in sys_iopl(), it is just as easy to change
the current flags and the flags in the stack image (in case an IRET is
required), but there is no reason to force an IRET if we came in from the
SYSENTER path.

This change is the minimal solution for supporting a paravirtualized Linux
kernel that allows user processes to run with I/O privilege.  Other
solutions require radical rewrites of part of the low level fault / system
call handling code, or do not fully support sysenter based system calls.

Unfortunately, this added one field to the thread_struct.  But as a bonus,
on P4, the fastest time measured for switch_to() went from 312 to 260
cycles, a win of about 17% in the fast case through this performance
critical path.

Signed-off-by: Zachary Amsden <zach@vmware.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/i386/kernel/ioport.c
arch/i386/kernel/process.c
include/asm-i386/processor.h
include/asm-i386/system.h