source: MondoRescue/branches/3.2/mindi-busybox/examples/linux-2.6.30_proc_self_exe.patch

Last change on this file was 2725, checked in by Bruno Cornec, 13 years ago
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File size: 966 bytes
  • fs/exec.c

    This patch makes /proc/self/exe executable even if proc
    is not mounted. It is especially useful on NOMMU arches.
    
    diff -urp ../linux-2.6.30.org/fs/exec.c linux-2.6.30/fs/exec.c
    old new struct file *open_exec(const char *name)  
    652652    file = do_filp_open(AT_FDCWD, name,
    653653                O_LARGEFILE | O_RDONLY | FMODE_EXEC, 0,
    654654                MAY_EXEC | MAY_OPEN);
    655     if (IS_ERR(file))
    656         goto out;
     655    if (IS_ERR(file)) {
     656        if ((PTR_ERR(file) == -ENOENT || PTR_ERR(file) == -EACCES)
     657         && strcmp(name, "/proc/self/exe") == 0
     658        ) {
     659            struct file *sv = file;
     660            struct mm_struct *mm;
    657661
     662            mm = get_task_mm(current);
     663            if (!mm)
     664                goto out;
     665            file = get_mm_exe_file(mm);
     666            mmput(mm);
     667            if (file)
     668                goto ok;
     669            file = sv;
     670        }
     671        goto out;
     672    }
     673ok:
    658674    err = -EACCES;
    659675    if (!S_ISREG(file->f_path.dentry->d_inode->i_mode))
    660676        goto exit;
Note: See TracBrowser for help on using the repository browser.