mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
Revert "exec: fix up /proc/pid/comm in the execveat(AT_EMPTY_PATH) case"
This reverts commit b45605fac3 which is
commit 543841d1806029889c2f69f040e88b247aba8e22 upstream.
It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.
Bug: 161946584
Change-Id: I22e4874caa735da68f10a3d6477069f24bc0462d
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
29
fs/exec.c
29
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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user