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>
This commit is contained in:
parent
4a4aca641b
commit
3aa6b186f8
1 changed files with 5 additions and 4 deletions
|
@ -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.ds = 0;
|
||||||
info->regs.pt.es = 0;
|
info->regs.pt.es = 0;
|
||||||
info->regs.pt.fs = 0;
|
info->regs.pt.fs = 0;
|
||||||
|
#ifndef CONFIG_X86_32_LAZY_GS
|
||||||
/* we are clearing gs later just before "jmp resume_userspace",
|
info->regs.pt.gs = 0;
|
||||||
* because it is not saved/restored.
|
#endif
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The flags register is also special: we cannot trust that the user
|
* 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__(
|
__asm__ __volatile__(
|
||||||
"movl %0,%%esp\n\t"
|
"movl %0,%%esp\n\t"
|
||||||
"movl %1,%%ebp\n\t"
|
"movl %1,%%ebp\n\t"
|
||||||
|
#ifdef CONFIG_X86_32_LAZY_GS
|
||||||
"mov %2, %%gs\n\t"
|
"mov %2, %%gs\n\t"
|
||||||
|
#endif
|
||||||
"jmp resume_userspace"
|
"jmp resume_userspace"
|
||||||
: /* no outputs */
|
: /* no outputs */
|
||||||
:"r" (&info->regs), "r" (task_thread_info(tsk)), "r" (0));
|
:"r" (&info->regs), "r" (task_thread_info(tsk)), "r" (0));
|
||||||
|
|
Loading…
Reference in a new issue