public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Alexander van Heukelum" <heukelum@fastmail.fm>
To: "H. Peter Anvin" <hpa@zytor.com>,
	mingo@redhat.com, "Alexander van Heukelum" <heukelum@fastmail.fm>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	rjw@sisk.pl, hramrach@centrum.cz, linux-kernel@vger.kernel.org,
	linux-tip-commits@vger.kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	mingo@redhat.com, "Thomas Gleixner" <tglx@linutronix.de>,
	rjw@sisk.pl, hramrach@centrum.cz
Subject: Re: [tip:x86/urgent] x86: vm86: fix preemption bug
Date: Sun, 15 Feb 2009 12:39:55 +0100	[thread overview]
Message-ID: <1234697995.25435.1300454125@webmail.messagingengine.com> (raw)
In-Reply-To: <tip-589de987dd2997eab59cbbccc1c9fc46c90ae5e8@kernel.org>

On Sun, 15 Feb 2009 09:36:26 GMT, "Thomas Gleixner" <tglx@linutronix.de>
said:
> Author:     Thomas Gleixner <tglx@linutronix.de>
> AuthorDate: Tue, 13 Jan 2009 23:36:34 +0100
> Commit:     Thomas Gleixner <tglx@linutronix.de>
> CommitDate: Sun, 15 Feb 2009 10:34:17 +0100
> 
> x86: vm86: fix preemption 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@centrum.cz>
> Cc: stable@kernel.org
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Alexander van Heukelum <heukelum@fastmail.fm>

I have no objections.

Acked-by: Alexander van Heukelum <heukelum@fastmail.fm>

Greetings,
    Alexander
 
> Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> 
> ---
>  arch/x86/kernel/traps.c |   10 +++++++++-
>  1 files changed, 9 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
> index 7932338..a9e7548 100644
> --- a/arch/x86/kernel/traps.c
> +++ b/arch/x86/kernel/traps.c
> @@ -99,6 +99,12 @@ static inline void preempt_conditional_sti(struct
> pt_regs *regs)
>  		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
>  
-- 
  Alexander van Heukelum
  heukelum@fastmail.fm

-- 
http://www.fastmail.fm - One of many happy users:
  http://www.fastmail.fm/docs/quotes.html


           reply	other threads:[~2009-02-15 11:40 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <tip-589de987dd2997eab59cbbccc1c9fc46c90ae5e8@kernel.org>]

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=1234697995.25435.1300454125@webmail.messagingengine.com \
    --to=heukelum@fastmail.fm \
    --cc=hpa@zytor.com \
    --cc=hramrach@centrum.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rjw@sisk.pl \
    --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