lkml.org 
[lkml]   [2003]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    Subject[PATCH] 2.4: Restore current->files in flush_old_exec
    From
    Hi:

    The unshare_files patch to flush_old_exec() did not restore the original
    state when exec_mmap fails. This patch fixes that.

    At this point, I believe the unshare_files stuff should be fine from
    a correctness point of view. However, there is still a performance
    problem as every ELF exec call ends up dupliating the files structure
    as well as walking through all file locks.

    Cheers,
    --
    Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
    Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
    Home Page: http://gondor.apana.org.au/~herbert/
    PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
    Index: kernel-source-2.4/fs/exec.c
    ===================================================================
    RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.4/fs/exec.c,v
    retrieving revision 1.5
    diff -u -r1.5 exec.c
    --- kernel-source-2.4/fs/exec.c 26 Jul 2003 02:54:45 -0000 1.5
    +++ kernel-source-2.4/fs/exec.c 9 Aug 2003 01:00:28 -0000
    @@ -557,7 +557,7 @@
    char * name;
    int i, ch, retval;
    struct signal_struct * oldsig;
    - struct files_struct * files;
    + struct files_struct *files, *ftmp;

    /*
    * Make sure we have a private signal table
    @@ -576,8 +576,6 @@
    retval = unshare_files();
    if(retval)
    goto flush_failed;
    - steal_locks(files, current->files);
    - put_files_struct(files);

    /*
    * Release all of the old mmap stuff
    @@ -586,6 +584,8 @@
    if (retval) goto mmap_failed;

    /* This is the point of no return */
    + steal_locks(files, current->files);
    + put_files_struct(files);
    release_old_signals(oldsig);

    current->sas_ss_sp = current->sas_ss_size = 0;
    @@ -623,6 +623,9 @@
    return 0;

    mmap_failed:
    + ftmp = current->files;
    + current->files = files;
    + put_files_struct(ftmp);
    flush_failed:
    spin_lock_irq(&current->sigmask_lock);
    if (current->sig != oldsig) {
    \
     
     \ /
      Last update: 2005-03-22 13:47    [W:0.024 / U:0.304 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site