[PATCH] uml: arch_prctl should set thread fs

In my previous x86_64 thread fix, I forgot to initialize thread.arch.fs in
arch_prctl. A process calling arch_prctl to set %fs would lose it on the
next context switch.

It also turns out that you can switch to a process which is in the process
of exiting and which has lost its mm. In this case, it's worse than
useless to try to call arch_prctl on the host process.

Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Jeff Dike and committed by Linus Torvalds 44f5c4ce 9bebff6c

+4 -2
+4 -2
arch/um/sys-x86_64/syscalls.c
··· 103 103 104 104 switch(code){ 105 105 case ARCH_SET_FS: 106 + current->thread.arch.fs = (unsigned long) ptr; 107 + save_registers(pid, &current->thread.regs.regs); 108 + break; 106 109 case ARCH_SET_GS: 107 110 save_registers(pid, &current->thread.regs.regs); 108 111 break; ··· 143 140 144 141 void arch_switch_to_skas(struct task_struct *from, struct task_struct *to) 145 142 { 146 - if(to->thread.arch.fs == 0) 143 + if((to->thread.arch.fs == 0) || (to->mm == NULL)) 147 144 return; 148 145 149 146 arch_prctl_skas(to, ARCH_SET_FS, (void __user *) to->thread.arch.fs); 150 147 } 151 -