[patch] bugfix for do_execve

From: manfreds (manfreds@colorfullife.com)
Date: Sat May 13 2000 - 15:58:00 EDT

  • Next message: Jeff Garzik: "Re: PCI_DEVICE_ID_INTEL_82440MX_1 is not defined in 2.3.99-pre9-1"

    Hi Linus,

    I found a SMP race in execve():
    cpu1:
            void main() { execve(argv[0],argv,envp);}

    cpu2:
            $ cd /proc/<pid>;while true;do cat cmdline>/dev/null;done

    After a few seconds, execve on cpu1 will fail: there is a race between
    concurrent access_process_vm and setup_arg_pages().

    setup_arg_pages() must acquire the mmap semaphore, that solved the
    problem.

    Could you add this patch to the next kernel?
    [tested with 2.3.99-pre8, i386, SMP]

    <<<<<<<<<<<
    --- 2.3/fs/exec.c Fri May 12 08:52:15 2000
    +++ build-2.3/fs/exec.c Sat May 13 21:24:38 2000
    @@ -288,6 +288,7 @@
             if (!mpnt)
                     return -ENOMEM;
             
    + down(&current->mm->mmap_sem);
             {
                     mpnt->vm_mm = current->mm;
                     mpnt->vm_start = PAGE_MASK & (unsigned long) bprm->p;
    @@ -311,6 +312,7 @@
                     }
                     stack_base += PAGE_SIZE;
             }
    + up(&current->mm->mmap_sem);
             
             return 0;
     }
    >>>>>>>>>>>

    --
    	Manfred
    

    - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



    This archive was generated by hypermail 2b29 : Sat May 13 2000 - 16:08:27 EDT