]> Pileus Git - ~andy/linux/blobdiff - fs/exec.c
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
[~andy/linux] / fs / exec.c
index ba112bd4a339c93995b66bd639175a37c95a084b..623a5cc3076a114af8808ca030f04bdd82638829 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -46,7 +46,6 @@
 #include <linux/proc_fs.h>
 #include <linux/mount.h>
 #include <linux/security.h>
-#include <linux/ima.h>
 #include <linux/syscalls.h>
 #include <linux/tsacct_kern.h>
 #include <linux/cn_proc.h>
@@ -924,6 +923,15 @@ char *get_task_comm(char *buf, struct task_struct *tsk)
 void set_task_comm(struct task_struct *tsk, char *buf)
 {
        task_lock(tsk);
+
+       /*
+        * Threads may access current->comm without holding
+        * the task lock, so write the string carefully.
+        * Readers without a lock may see incomplete new
+        * names but are safe from non-terminating string reads.
+        */
+       memset(tsk->comm, 0, TASK_COMM_LEN);
+       wmb();
        strlcpy(tsk->comm, buf, sizeof(tsk->comm));
        task_unlock(tsk);
        perf_event_comm(tsk);
@@ -1207,9 +1215,6 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
        struct linux_binfmt *fmt;
 
        retval = security_bprm_check(bprm);
-       if (retval)
-               return retval;
-       retval = ima_bprm_check(bprm);
        if (retval)
                return retval;