* [PATCH] UML - arch_prctl should set thread fs
@ 2007-03-07 19:01 Jeff Dike
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Dike @ 2007-03-07 19:01 UTC (permalink / raw)
To: Andrew Morton, stable; +Cc: LKML, Blaisorblade
[ Andrew, this is definite 2.6.21 material ]
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>
--
arch/um/sys-x86_64/syscalls.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Index: linux-2.6.18-mm/arch/um/sys-x86_64/syscalls.c
===================================================================
--- linux-2.6.18-mm.orig/arch/um/sys-x86_64/syscalls.c 2007-03-07 12:05:02.000000000 -0500
+++ linux-2.6.18-mm/arch/um/sys-x86_64/syscalls.c 2007-03-07 14:01:16.000000000 -0500
@@ -103,6 +103,9 @@ long arch_prctl_skas(struct task_struct
switch(code){
case ARCH_SET_FS:
+ current->thread.arch.fs = (unsigned long) ptr;
+ save_registers(pid, ¤t->thread.regs.regs);
+ break;
case ARCH_SET_GS:
save_registers(pid, ¤t->thread.regs.regs);
break;
@@ -140,9 +143,8 @@ long sys_clone(unsigned long clone_flags
void arch_switch_to_skas(struct task_struct *from, struct task_struct *to)
{
- if(to->thread.arch.fs == 0)
+ if((to->thread.arch.fs == 0) || (to->mm == NULL))
return;
arch_prctl_skas(to, ARCH_SET_FS, (void __user *) to->thread.arch.fs);
}
-
^ permalink raw reply [flat|nested] 2+ messages in thread* [PATCH] UML - arch_prctl should set thread fs
@ 2007-03-16 16:10 Jeff Dike
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Dike @ 2007-03-16 16:10 UTC (permalink / raw)
To: stable; +Cc: LKML, uml-devel
[ This missed getting into -stable the first time I sent it ]
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>
--
arch/um/sys-x86_64/syscalls.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Index: linux-2.6.17/arch/um/sys-x86_64/syscalls.c
===================================================================
--- linux-2.6.17.orig/arch/um/sys-x86_64/syscalls.c 2007-03-07 12:18:38.000000000 -0500
+++ linux-2.6.17/arch/um/sys-x86_64/syscalls.c 2007-03-16 12:04:40.000000000 -0400
@@ -103,6 +103,9 @@ long arch_prctl_skas(struct task_struct
switch(code){
case ARCH_SET_FS:
+ current->thread.arch.fs = (unsigned long) ptr;
+ save_registers(pid, ¤t->thread.regs.regs);
+ break;
case ARCH_SET_GS:
save_registers(pid, ¤t->thread.regs.regs);
break;
@@ -140,9 +143,8 @@ long sys_clone(unsigned long clone_flags
void arch_switch_to_skas(struct task_struct *from, struct task_struct *to)
{
- if(to->thread.arch.fs == 0)
+ if((to->thread.arch.fs == 0) || (to->mm == NULL))
return;
arch_prctl_skas(to, ARCH_SET_FS, (void __user *) to->thread.arch.fs);
}
-
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-03-16 17:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-07 19:01 [PATCH] UML - arch_prctl should set thread fs Jeff Dike
-- strict thread matches above, loose matches on Subject: below --
2007-03-16 16:10 Jeff Dike
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox