From: Bart Oldeman <bartoldeman@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: tglx@linutronix.de, mingo@elte.hu, stable@kernel.org
Date: Sat, 23 May 2009 18:45:16 -0400 [thread overview]
Message-ID: <E1M7zxs-0002tk-Ct@localhost.localdomain> (raw)
>From 090d8c2d634b456999e0928d4982ce9ea7afddf2 Mon Sep 17 00:00:00 2001
From: Bart Oldeman <bart@enm-bo-lt.localnet>
Date: Sat, 23 May 2009 18:16:28 -0400
Subject: [PATCH] x86, vm86: fix preemption bug for int3 breakpoint handlers.
Impact: fix kernel bug such as:
May 22 16:47:47 localhost kernel: note: dosemu.bin[5281] exited with preempt_count 1
Commit be716615fe596ee117292dc615e95f707fb67fd1 ("x86, vm86:
fix preemption bug") fixes the problem for debug exceptions but not
for breakpoints. This change also fixes breakpoints. As the offending
codepath is jumping directly back to entry.S, move the logic to
vm86_32.c, and re-enable preemption in vm86_handle_trap() before
calling return_to_32bit().
Cc: stable@kernel.org
Signed-off-by: Bart Oldeman <bartoldeman@users.sourceforge.net>
---
arch/x86/kernel/traps.c | 4 +---
arch/x86/kernel/vm86_32.c | 6 +++++-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index f07ada4..98ebe1c 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -590,10 +590,8 @@ clear_dr7:
#ifdef CONFIG_X86_32
debug_vm86:
- /* reenable preemption: handle_vm86_trap() might sleep */
- dec_preempt_count();
handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code, 1);
- conditional_cli(regs);
+ preempt_conditional_cli(regs);
return;
#endif
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
index b8035a0..17c7734 100644
--- a/arch/x86/kernel/vm86_32.c
+++ b/arch/x86/kernel/vm86_32.c
@@ -551,8 +551,12 @@ cannot_handle:
int handle_vm86_trap(struct kernel_vm86_regs *regs, long error_code, int trapno)
{
if (VMPI.is_vm86pus) {
- if ((trapno == 3) || (trapno == 1))
+ if ((trapno == 3) || (trapno == 1)) {
+ /* re-enable preemption: return_to_32bit()
+ jumps straight to entry_32.S */
+ dec_preempt_count();
return_to_32bit(regs, VM86_TRAP + (trapno << 8));
+ }
do_int(regs, trapno, (unsigned char __user *) (regs->pt.ss << 4), SP(regs));
return 0;
}
--
1.6.2.4
reply other threads:[~2009-05-23 22:45 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=E1M7zxs-0002tk-Ct@localhost.localdomain \
--to=bartoldeman@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=stable@kernel.org \
--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
all inboxes | Powered by JetHome®