]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/exec.c
ocfs2: Allow binary names in the DLM
[linux-2.6-omap-h63xx.git] / fs / exec.c
index 8c8f2894949da8374450e52376f3528b9038b3c0..54135df2a9662cbf1f222ee468067812f52e1f72 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -22,7 +22,6 @@
  * formats. 
  */
 
-#include <linux/config.h>
 #include <linux/slab.h>
 #include <linux/file.h>
 #include <linux/mman.h>
@@ -487,8 +486,6 @@ struct file *open_exec(const char *name)
                if (!(nd.mnt->mnt_flags & MNT_NOEXEC) &&
                    S_ISREG(inode->i_mode)) {
                        int err = vfs_permission(&nd, MAY_EXEC);
-                       if (!err && !(inode->i_mode & 0111))
-                               err = -EACCES;
                        file = ERR_PTR(err);
                        if (!err) {
                                file = nameidata_to_filp(&nd, O_RDONLY);
@@ -754,7 +751,7 @@ no_thread_group:
 
                write_lock_irq(&tasklist_lock);
                spin_lock(&oldsighand->siglock);
-               spin_lock(&newsighand->siglock);
+               spin_lock_nested(&newsighand->siglock, SINGLE_DEPTH_NESTING);
 
                rcu_assign_pointer(current->sighand, newsighand);
                recalc_sigpending();
@@ -923,12 +920,6 @@ int prepare_binprm(struct linux_binprm *bprm)
        int retval;
 
        mode = inode->i_mode;
-       /*
-        * Check execute perms again - if the caller has CAP_DAC_OVERRIDE,
-        * generic_permission lets a non-executable through
-        */
-       if (!(mode & 0111))     /* with at least _one_ execute bit set */
-               return -EACCES;
        if (bprm->file->f_op == NULL)
                return -EACCES;
 
@@ -1371,13 +1362,7 @@ static void format_corename(char *corename, const char *pattern, long signr)
 static void zap_process(struct task_struct *start)
 {
        struct task_struct *t;
-       unsigned long flags;
 
-       /*
-        * start->sighand can't disappear, but may be
-        * changed by de_thread()
-        */
-       lock_task_sighand(start, &flags);
        start->signal->flags = SIGNAL_GROUP_EXIT;
        start->signal->group_stop_count = 0;
 
@@ -1389,40 +1374,51 @@ static void zap_process(struct task_struct *start)
                        signal_wake_up(t, 1);
                }
        } while ((t = next_thread(t)) != start);
-
-       unlock_task_sighand(start, &flags);
 }
 
 static inline int zap_threads(struct task_struct *tsk, struct mm_struct *mm,
                                int exit_code)
 {
        struct task_struct *g, *p;
+       unsigned long flags;
        int err = -EAGAIN;
 
        spin_lock_irq(&tsk->sighand->siglock);
        if (!(tsk->signal->flags & SIGNAL_GROUP_EXIT)) {
-               tsk->signal->flags = SIGNAL_GROUP_EXIT;
                tsk->signal->group_exit_code = exit_code;
-               tsk->signal->group_stop_count = 0;
+               zap_process(tsk);
                err = 0;
        }
        spin_unlock_irq(&tsk->sighand->siglock);
        if (err)
                return err;
 
+       if (atomic_read(&mm->mm_users) == mm->core_waiters + 1)
+               goto done;
+
        rcu_read_lock();
        for_each_process(g) {
+               if (g == tsk->group_leader)
+                       continue;
+
                p = g;
                do {
                        if (p->mm) {
-                               if (p->mm == mm)
+                               if (p->mm == mm) {
+                                       /*
+                                        * p->sighand can't disappear, but
+                                        * may be changed by de_thread()
+                                        */
+                                       lock_task_sighand(p, &flags);
                                        zap_process(p);
+                                       unlock_task_sighand(p, &flags);
+                               }
                                break;
                        }
                } while ((p = next_thread(p)) != g);
        }
        rcu_read_unlock();
-
+done:
        return mm->core_waiters;
 }