diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-03-07 23:41:26 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-03-08 10:38:22 -0500 |
commit | 44f5c4ced6ddee2f5f2e45fa45b93370245d85bd (patch) | |
tree | 0ba80acf1666a3fe82a3cb09ae0052b58c1d2af1 /arch/um | |
parent | 9bebff6ca5871e07b665cdaf71028ea21eb0bf0e (diff) |
[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>
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/sys-x86_64/syscalls.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c index 01b91f9fa789..b3f6350cac44 100644 --- a/arch/um/sys-x86_64/syscalls.c +++ b/arch/um/sys-x86_64/syscalls.c | |||
@@ -103,6 +103,9 @@ long arch_prctl_skas(struct task_struct *task, int code, | |||
103 | 103 | ||
104 | switch(code){ | 104 | switch(code){ |
105 | case ARCH_SET_FS: | 105 | case ARCH_SET_FS: |
106 | current->thread.arch.fs = (unsigned long) ptr; | ||
107 | save_registers(pid, ¤t->thread.regs.regs); | ||
108 | break; | ||
106 | case ARCH_SET_GS: | 109 | case ARCH_SET_GS: |
107 | save_registers(pid, ¤t->thread.regs.regs); | 110 | save_registers(pid, ¤t->thread.regs.regs); |
108 | break; | 111 | break; |
@@ -140,9 +143,8 @@ long sys_clone(unsigned long clone_flags, unsigned long newsp, | |||
140 | 143 | ||
141 | void arch_switch_to_skas(struct task_struct *from, struct task_struct *to) | 144 | void arch_switch_to_skas(struct task_struct *from, struct task_struct *to) |
142 | { | 145 | { |
143 | if(to->thread.arch.fs == 0) | 146 | if((to->thread.arch.fs == 0) || (to->mm == NULL)) |
144 | return; | 147 | return; |
145 | 148 | ||
146 | arch_prctl_skas(to, ARCH_SET_FS, (void __user *) to->thread.arch.fs); | 149 | arch_prctl_skas(to, ARCH_SET_FS, (void __user *) to->thread.arch.fs); |
147 | } | 150 | } |
148 | |||