diff --git a/fs/exec.c b/fs/exec.c index eb088e3cc9a0..0149f828d409 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1364,28 +1364,7 @@ int begin_new_exec(struct linux_binprm * bprm) set_dumpable(current->mm, SUID_DUMP_USER); perf_event_exec(); - - /* - * If the original filename was empty, alloc_bprm() made up a path - * that will probably not be useful to admins running ps or similar. - * Let's fix it up to be something reasonable. - */ - if (bprm->comm_from_dentry) { - /* - * Hold RCU lock to keep the name from being freed behind our back. - * Use acquire semantics to make sure the terminating NUL from - * __d_alloc() is seen. - * - * Note, we're deliberately sloppy here. We don't need to care about - * detecting a concurrent rename and just want a terminated name. - */ - rcu_read_lock(); - __set_task_comm(me, smp_load_acquire(&bprm->file->f_path.dentry->d_name.name), - true); - rcu_read_unlock(); - } else { - __set_task_comm(me, kbasename(bprm->filename), true); - } + __set_task_comm(me, kbasename(bprm->filename), true); /* An exec changes our domain. We are no longer part of the thread group */ @@ -1544,13 +1523,11 @@ static struct linux_binprm *alloc_bprm(int fd, struct filename *filename) if (fd == AT_FDCWD || filename->name[0] == '/') { bprm->filename = filename->name; } else { - if (filename->name[0] == '\0') { + if (filename->name[0] == '\0') bprm->fdpath = kasprintf(GFP_KERNEL, "/dev/fd/%d", fd); - bprm->comm_from_dentry = 1; - } else { + else bprm->fdpath = kasprintf(GFP_KERNEL, "/dev/fd/%d/%s", fd, filename->name); - } if (!bprm->fdpath) goto out_free; diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index af9056d78fad..8d51f69f9f5e 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h @@ -42,9 +42,7 @@ struct linux_binprm { * Set when errors can no longer be returned to the * original userspace. */ - point_of_no_return:1, - /* Set when "comm" must come from the dentry. */ - comm_from_dentry:1; + point_of_no_return:1; struct file *executable; /* Executable to pass to the interpreter */ struct file *interpreter; struct file *file;