From: tip-bot for Lubomir Rintel <lkundrak@v3.sk>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
tglx@linutronix.de, mingo@elte.hu, lkundrak@v3.sk
Subject: [tip:x86/urgent] x86: Fix non-lazy GS handling in sys_vm86()
Date: Sun, 7 Jun 2009 14:42:33 GMT [thread overview]
Message-ID: <tip-3aa6b186f86c5d06d6d92d14311ffed51f091f40@git.kernel.org> (raw)
In-Reply-To: <1244384628.2323.4.camel@bimbo>
Commit-ID: 3aa6b186f86c5d06d6d92d14311ffed51f091f40
Gitweb: http://git.kernel.org/tip/3aa6b186f86c5d06d6d92d14311ffed51f091f40
Author: Lubomir Rintel <lkundrak@v3.sk>
AuthorDate: Sun, 7 Jun 2009 16:23:48 +0200
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 7 Jun 2009 16:31:23 +0200
x86: Fix non-lazy GS handling in sys_vm86()
This fixes a stack corruption panic or null dereference oops
due to a bad GS in resume_userspace() when returning from
sys_vm86() and calling lockdep_sys_exit().
Only a problem when CONFIG_LOCKDEP and CONFIG_CC_STACKPROTECTOR
enabled.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Cc: H. Peter Anvin <hpa@zytor.com>
LKML-Reference: <1244384628.2323.4.camel@bimbo>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/kernel/vm86_32.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
index d7ac84e..6a17769 100644
--- a/arch/x86/kernel/vm86_32.c
+++ b/arch/x86/kernel/vm86_32.c
@@ -287,10 +287,9 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk
info->regs.pt.ds = 0;
info->regs.pt.es = 0;
info->regs.pt.fs = 0;
-
-/* we are clearing gs later just before "jmp resume_userspace",
- * because it is not saved/restored.
- */
+#ifndef CONFIG_X86_32_LAZY_GS
+ info->regs.pt.gs = 0;
+#endif
/*
* The flags register is also special: we cannot trust that the user
@@ -343,7 +342,9 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk
__asm__ __volatile__(
"movl %0,%%esp\n\t"
"movl %1,%%ebp\n\t"
+#ifdef CONFIG_X86_32_LAZY_GS
"mov %2, %%gs\n\t"
+#endif
"jmp resume_userspace"
: /* no outputs */
:"r" (&info->regs), "r" (task_thread_info(tsk)), "r" (0));
prev parent reply other threads:[~2009-06-07 14:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-06 18:23 [PATCH] Fix non-lazy GS handling in sys_vm86() Lubomir Rintel
2009-06-07 7:56 ` Ingo Molnar
2009-06-07 14:23 ` Lubomir Rintel
2009-06-07 14:42 ` tip-bot for Lubomir Rintel [this message]
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=tip-3aa6b186f86c5d06d6d92d14311ffed51f091f40@git.kernel.org \
--to=lkundrak@v3.sk \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/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