public inbox for kernel-testers@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
To: "Rafael J. Wysocki" <rjw-KKrjLPT3xs0@public.gmane.org>
Cc: Linux Kernel Mailing List
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Kernel Testers List
	<kernel-testers-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Michal Suchanek
	<hramrach-aRb0bU7PRFPrBKCeMvbIDA@public.gmane.org>,
	Alexander van Heukelum
	<heukelum-97jfqw80gc6171pxa8y+qA@public.gmane.org>,
	"H. Peter Anvin" <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>,
	Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org>
Subject: [PATCH] x86: vm86: fix preemption bug
Date: Tue, 13 Jan 2009 23:36:34 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.00.0901132117270.3549@localhost.localdomain> (raw)
In-Reply-To: <nHCfeC0YLrE.A.WKC.qafaJB@chimera>

Impact: fix scheduling while atomic bug

commit 3d2a71a596bd9c761c8487a2178e95f8a61da083 (x86, traps: converge
do_debug handlers) changed the preemption disable logic of do_debug()
so vm86_handle_trap() is called with preemption disabled resulting in:

BUG: sleeping function called from invalid context at include/linux/kernel.h:155
in_atomic(): 1, irqs_disabled(): 0, pid: 3005, name: dosemu.bin
Pid: 3005, comm: dosemu.bin Tainted: G        W  2.6.29-rc1 #51
Call Trace:
 [<c050d669>] copy_to_user+0x33/0x108
 [<c04181f4>] save_v86_state+0x65/0x149
 [<c0418531>] handle_vm86_trap+0x20/0x8f
 [<c064e345>] do_debug+0x15b/0x1a4
 [<c064df1f>] debug_stack_correct+0x27/0x2c
 [<c040365b>] sysenter_do_call+0x12/0x2f
BUG: scheduling while atomic: dosemu.bin/3005/0x10000001

Restore the original calling convention and reenable preemption before
calling handle_vm86_trap().

Reported-by: Michal Suchanek <hramrach-aRb0bU7PRFPrBKCeMvbIDA@public.gmane.org>
Cc: stable-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Signed-off-by: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
---
 arch/x86/kernel/traps.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Index: linux-2.6/arch/x86/kernel/traps.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/traps.c
+++ linux-2.6/arch/x86/kernel/traps.c
@@ -99,6 +99,12 @@ static inline void preempt_conditional_s
 		local_irq_enable();
 }
 
+static inline void conditional_cli(struct pt_regs *regs)
+{
+	if (regs->flags & X86_EFLAGS_IF)
+		local_irq_disable();
+}
+
 static inline void preempt_conditional_cli(struct pt_regs *regs)
 {
 	if (regs->flags & X86_EFLAGS_IF)
@@ -626,8 +632,10 @@ 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);
-	preempt_conditional_cli(regs);
+	conditional_cli(regs);
 	return;
 #endif
 

  reply	other threads:[~2009-01-13 22:36 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <nn3SOLVZ28H.A.bY.CafaJB@chimera>
2009-01-11 11:36 ` [Bug #11849] default IRQ affinity change in v2.6.27 (breaking several SMP PPC based systems) Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12159] 2.6.28-rc6-git1 -- No sound produced from Intel HDA ALSA driver Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12061] snd_hda_intel: power_save: sound cracks on powerdown Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12155] Regression in 2.6.28-rc and 2.6.27-stable - hibernate related Rafael J. Wysocki
2009-01-11 14:34   ` Fabio Comolli
     [not found]     ` <b637ec0b0901110634i7ea6fa7ao87ec22beb5a51c98-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-01-11 18:40       ` Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12160] networking oops after resume from s2ram (2.6.28-rc6) Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12209] oldish top core dumps (in its meminfo() function) Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12208] uml is very slow on 2.6.28 host Rafael J. Wysocki
2009-01-12 10:04   ` Miklos Szeredi
     [not found]     ` <E1LMJex-0001lB-SE-8f8m9JG5TPIdUIPVzhDTVZP2KDSNp7ea@public.gmane.org>
2009-01-12 12:28       ` Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12260] Regression due to commit 2b80848e3818fb1c (p54usb: support LM87 firmwares) Rafael J. Wysocki
2009-01-11 15:37   ` Larry Finger
     [not found]     ` <496A1246.6070007-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
2009-01-11 18:54       ` Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12224] journal activity on inactive partition causes inactive harddrive spinup Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12216] Error when drm is loaded Rafael J. Wysocki
2009-01-11 14:50   ` François Valenduc
     [not found]     ` <496A073D.4070804-bmtTS95sd5BUM80lpFwj4w@public.gmane.org>
2009-01-11 18:41       ` Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12279] 2.6.28 suspend regression - HP 2510p Rafael J. Wysocki
2009-01-11 16:03   ` Bartlomiej Zolnierkiewicz
     [not found]     ` <200901111703.24868.bzolnier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-01-11 18:42       ` Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12265] FPU emulation broken in 2.6.28-rc8 ? Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12263] Sata soft reset filling log Rafael J. Wysocki
2009-01-12 23:53   ` Justin Madru
     [not found]     ` <496BD7ED.1010909-u1xxEuL7cY4AvxtiuMwx3w@public.gmane.org>
2009-01-13  0:18       ` Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12264] i915: switching from kwin in opengl mode to a VT then back to x11, x11 freezes Rafael J. Wysocki
2009-01-12  0:42   ` Caleb Cushing
     [not found]     ` <81bfc67a0901111642i37f46edar8592899d7193b863-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-01-12  8:00       ` Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12337] ~100 extra wakeups reported by powertop Rafael J. Wysocki
2009-01-14  9:09   ` Alberto Gonzalez
2009-01-11 11:41 ` [Bug #12391] Processor does not go below C2 state until usb.autosuspend is enabled Rafael J. Wysocki
2009-01-18  8:24   ` Pavel Machek
2009-01-11 11:41 ` [Bug #12393] debugging in dosemu causes lots of 'scheduling while atomic' Rafael J. Wysocki
2009-01-13 22:36   ` Thomas Gleixner [this message]
     [not found]     ` <alpine.LFD.2.00.0901132117270.3549-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-01-19 14:55       ` [PATCH] x86: vm86: fix preemption bug Michal Suchanek
2009-01-11 11:41 ` [Bug #12401] 2.6.28 regression: xbacklight broken on ThinkPad X61s Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12396] hwinfo problem since 2.6.28 Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12395] 2.6.28-rc9: oprofile regression Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12403] TTY problem on linux-2.6.28-rc7 Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12404] Oops in 2.6.28-rc9 and -rc8 -- mtrr issues / e1000e Rafael J. Wysocki
2009-01-14 13:56   ` Thomas Gleixner
2009-01-11 11:41 ` [Bug #12405] oops in __bounce_end_io_read under kvm Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12406] 2.6.28 thinks that my PS/2 mouse is a touchpad Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12407] Kernel 2.6.28 regression: Hang after hibernate Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12410] resource map sanity check conflict: 0x7fffff00 0x800000ff 0x7ffff000 0x7fffffff ACPI Non-volatile Storage Rafael J. Wysocki
2009-01-12 11:31   ` Martin MOKREJŠ
     [not found]     ` <496B2A02.6030009-FKSC99mem8wheYDy1lqhK0JFmxxWawaa@public.gmane.org>
2009-01-12 12:47       ` Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12408] Funny problem with 2.6.28: Kernel stalls Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12409] NULL pointer dereference at get_stats() Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12411] 2.6.28: BUG in r8169 Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12412] Regression in v2.6.28 introduced by: 'USB: skip Set-Interface(0) if already in altsetting 0' Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12413] iwl3945 - Error for wireless request "Set Encode" (8B2A) Rafael J. Wysocki
2009-01-11 15:24   ` Paul Rolland
2009-01-11 18:04   ` Paul Rolland
     [not found]     ` <20090111190455.21b2f7f2-Hu5lHNoInTV+MQpiyFM1nV6hYfS7NtTn@public.gmane.org>
2009-01-11 18:51       ` Rafael J. Wysocki
2009-01-11 11:41 ` [Bug #12426] TMDC Joystick no longer works in kernel 2.6.28 Rafael J. Wysocki

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=alpine.LFD.2.00.0901132117270.3549@localhost.localdomain \
    --to=tglx-hfztesqfncyowbw4kg4ksq@public.gmane.org \
    --cc=heukelum-97jfqw80gc6171pxa8y+qA@public.gmane.org \
    --cc=hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org \
    --cc=hramrach-aRb0bU7PRFPrBKCeMvbIDA@public.gmane.org \
    --cc=kernel-testers-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mingo-X9Un+BFzKDI@public.gmane.org \
    --cc=rjw-KKrjLPT3xs0@public.gmane.org \
    /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