Commit 56eb992e authored by Ingo Molnar's avatar Ingo Molnar

[PATCH] Save fs/gs over vm86 mode switch

In vm86 mode we did not save/restore %gs [and %fs] properly, which
breaks new-style threading.
parent a85071ff
...@@ -116,6 +116,8 @@ struct pt_regs * save_v86_state(struct kernel_vm86_regs * regs) ...@@ -116,6 +116,8 @@ struct pt_regs * save_v86_state(struct kernel_vm86_regs * regs)
current->thread.esp0 = current->thread.saved_esp0; current->thread.esp0 = current->thread.saved_esp0;
load_esp0(tss, current->thread.esp0); load_esp0(tss, current->thread.esp0);
current->thread.saved_esp0 = 0; current->thread.saved_esp0 = 0;
loadsegment(fs, current->thread.saved_fs);
loadsegment(gs, current->thread.saved_gs);
ret = KVM86->regs32; ret = KVM86->regs32;
return ret; return ret;
} }
...@@ -283,6 +285,9 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk ...@@ -283,6 +285,9 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk
*/ */
info->regs32->eax = 0; info->regs32->eax = 0;
tsk->thread.saved_esp0 = tsk->thread.esp0; tsk->thread.saved_esp0 = tsk->thread.esp0;
asm volatile("movl %%fs,%0":"=m" (tsk->thread.saved_fs));
asm volatile("movl %%gs,%0":"=m" (tsk->thread.saved_gs));
tss = init_tss + smp_processor_id(); tss = init_tss + smp_processor_id();
tss->esp0 = tsk->thread.esp0 = (unsigned long) &info->VM86_TSS_ESP0; tss->esp0 = tsk->thread.esp0 = (unsigned long) &info->VM86_TSS_ESP0;
disable_sysenter(); disable_sysenter();
......
...@@ -387,6 +387,7 @@ struct thread_struct { ...@@ -387,6 +387,7 @@ struct thread_struct {
struct vm86_struct * vm86_info; struct vm86_struct * vm86_info;
unsigned long screen_bitmap; unsigned long screen_bitmap;
unsigned long v86flags, v86mask, saved_esp0; unsigned long v86flags, v86mask, saved_esp0;
unsigned int saved_fs, saved_gs;
/* IO permissions */ /* IO permissions */
unsigned long *ts_io_bitmap; unsigned long *ts_io_bitmap;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment