lkml.org 
[lkml]   [2003]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] Fix sysenter iopl
This patch fixes the handling of IOPL in 2.5.54 when sysenter is used.

Currently when entering kernel mode, IOPL is not changed and it is not
presserved across context switches: thus, in the kernel, the IOPL
value is random.

This is not a problem when using iret, because it restores eflags, but
the sysexit code currently doesn't, which means that that IOPL becomes
random in user mode too which is of course not good.

This patch fixes the problem by saving eflags across context switches
(it could also be fixed by adding a popfl at the end of the sysenter
code).


diff --exclude-from=/home/ldb/src/exclude -urNdp --exclude='speedtouch.*' --exclude='atmsar.*' linux-2.5.54/include/asm-i386/system.h linux-2.5.54-ldb/include/asm-i386/system.h
--- linux-2.5.54/include/asm-i386/system.h 2003-01-02 04:20:51.000000000 +0100
+++ linux-2.5.54-ldb/include/asm-i386/system.h 2003-01-04 19:06:07.000000000 +0100
@@ -12,7 +12,8 @@ struct task_struct; /* one of the strang
extern void FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next));

#define switch_to(prev,next,last) do { \
- asm volatile("pushl %%esi\n\t" \
+ asm volatile("pushfl\n\t" \
+ "pushl %%esi\n\t" \
"pushl %%edi\n\t" \
"pushl %%ebp\n\t" \
"movl %%esp,%0\n\t" /* save ESP */ \
@@ -24,6 +25,7 @@ extern void FASTCALL(__switch_to(struct
"popl %%ebp\n\t" \
"popl %%edi\n\t" \
"popl %%esi\n\t" \
+ "popfl\n\t" \
:"=m" (prev->thread.esp),"=m" (prev->thread.eip) \
:"m" (next->thread.esp),"m" (next->thread.eip), \
"a" (prev), "d" (next)); \[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 13:32    [W:0.040 / U:5.972 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site