From: Luca Barbieri <ldb@ldb.ods.org>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Linux-Kernel ML <linux-kernel@vger.kernel.org>
Subject: [PATCH] Fix sysenter iopl
Date: Sun, 5 Jan 2003 02:18:44 +0100 [thread overview]
Message-ID: <20030105011844.GA4948@ldb> (raw)
[-- Attachment #1: Type: text/plain, Size: 1692 bytes --]
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)); \
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
reply other threads:[~2003-01-05 1:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030105011844.GA4948@ldb \
--to=ldb@ldb.ods.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox