Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=44f5c4ced6ddee2f5f2e45fa45b93370245d85bd
Commit:     44f5c4ced6ddee2f5f2e45fa45b93370245d85bd
Parent:     9bebff6ca5871e07b665cdaf71028ea21eb0bf0e
Author:     Jeff Dike <[EMAIL PROTECTED]>
AuthorDate: Wed Mar 7 20:41:26 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Thu Mar 8 07:38:22 2007 -0800

    [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 <[EMAIL PROTECTED]>
    Cc: Paolo 'Blaisorblade' Giarrusso <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 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 01b91f9..b3f6350 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,
 
         switch(code){
        case ARCH_SET_FS:
+               current->thread.arch.fs = (unsigned long) ptr;
+               save_registers(pid, &current->thread.regs.regs);
+               break;
        case ARCH_SET_GS:
                 save_registers(pid, &current->thread.regs.regs);
                break;
@@ -140,9 +143,8 @@ long sys_clone(unsigned long clone_flags, unsigned long 
newsp,
 
 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);
 }
-
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to