From: Ingo Molnar <mingo@elte.hu>
To: Lubomir Rintel <lkundrak@v3.sk>
Cc: Tejun Heo <tj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
x86@kernel.org
Subject: Re: [PATCH] Fix non-lazy GS handling in sys_vm86()
Date: Sun, 7 Jun 2009 09:56:13 +0200 [thread overview]
Message-ID: <20090607075613.GA3962@elte.hu> (raw)
In-Reply-To: <1244312605.28613.4.camel@bimbo>
* Lubomir Rintel <lkundrak@v3.sk> wrote:
> 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>
> ---
> arch/x86/kernel/vm86_32.c | 13 +++++++------
> 1 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
> index d7ac84e..177d976 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,10 +342,12 @@ 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"
> - "mov %2, %%gs\n\t"
> +#ifdef CONFIG_X86_32_LAZY_GS
> + "mov $0, %%gs\n\t"
> +#endif
That bit looks rather untested - i dont think there's an immediate
constant instruction variant for segment register moves ...
Ingo
next prev parent reply other threads:[~2009-06-07 7:57 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 [this message]
2009-06-07 14:23 ` Lubomir Rintel
2009-06-07 14:42 ` [tip:x86/urgent] x86: " tip-bot for Lubomir Rintel
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=20090607075613.GA3962@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkundrak@v3.sk \
--cc=tj@kernel.org \
--cc=x86@kernel.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