aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/exec.c b/fs/exec.c
index ffd7a813ad3d..9c73def87642 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -110,13 +110,14 @@ SYSCALL_DEFINE1(uselib, const char __user *, library)
110 static const struct open_flags uselib_flags = { 110 static const struct open_flags uselib_flags = {
111 .open_flag = O_LARGEFILE | O_RDONLY | __FMODE_EXEC, 111 .open_flag = O_LARGEFILE | O_RDONLY | __FMODE_EXEC,
112 .acc_mode = MAY_READ | MAY_EXEC | MAY_OPEN, 112 .acc_mode = MAY_READ | MAY_EXEC | MAY_OPEN,
113 .intent = LOOKUP_OPEN 113 .intent = LOOKUP_OPEN,
114 .lookup_flags = LOOKUP_FOLLOW,
114 }; 115 };
115 116
116 if (IS_ERR(tmp)) 117 if (IS_ERR(tmp))
117 goto out; 118 goto out;
118 119
119 file = do_filp_open(AT_FDCWD, tmp, &uselib_flags, LOOKUP_FOLLOW); 120 file = do_filp_open(AT_FDCWD, tmp, &uselib_flags);
120 putname(tmp); 121 putname(tmp);
121 error = PTR_ERR(file); 122 error = PTR_ERR(file);
122 if (IS_ERR(file)) 123 if (IS_ERR(file))
@@ -756,10 +757,11 @@ struct file *open_exec(const char *name)
756 static const struct open_flags open_exec_flags = { 757 static const struct open_flags open_exec_flags = {
757 .open_flag = O_LARGEFILE | O_RDONLY | __FMODE_EXEC, 758 .open_flag = O_LARGEFILE | O_RDONLY | __FMODE_EXEC,
758 .acc_mode = MAY_EXEC | MAY_OPEN, 759 .acc_mode = MAY_EXEC | MAY_OPEN,
759 .intent = LOOKUP_OPEN 760 .intent = LOOKUP_OPEN,
761 .lookup_flags = LOOKUP_FOLLOW,
760 }; 762 };
761 763
762 file = do_filp_open(AT_FDCWD, &tmp, &open_exec_flags, LOOKUP_FOLLOW); 764 file = do_filp_open(AT_FDCWD, &tmp, &open_exec_flags);
763 if (IS_ERR(file)) 765 if (IS_ERR(file))
764 goto out; 766 goto out;
765 767
@@ -930,6 +932,7 @@ static int de_thread(struct task_struct *tsk)
930 * also take its birthdate (always earlier than our own). 932 * also take its birthdate (always earlier than our own).
931 */ 933 */
932 tsk->start_time = leader->start_time; 934 tsk->start_time = leader->start_time;
935 tsk->real_start_time = leader->real_start_time;
933 936
934 BUG_ON(!same_thread_group(leader, tsk)); 937 BUG_ON(!same_thread_group(leader, tsk));
935 BUG_ON(has_group_leader_pid(tsk)); 938 BUG_ON(has_group_leader_pid(tsk));
@@ -945,9 +948,8 @@ static int de_thread(struct task_struct *tsk)
945 * Note: The old leader also uses this pid until release_task 948 * Note: The old leader also uses this pid until release_task
946 * is called. Odd but simple and correct. 949 * is called. Odd but simple and correct.
947 */ 950 */
948 detach_pid(tsk, PIDTYPE_PID);
949 tsk->pid = leader->pid; 951 tsk->pid = leader->pid;
950 attach_pid(tsk, PIDTYPE_PID, task_pid(leader)); 952 change_pid(tsk, PIDTYPE_PID, task_pid(leader));
951 transfer_pid(leader, tsk, PIDTYPE_PGID); 953 transfer_pid(leader, tsk, PIDTYPE_PGID);
952 transfer_pid(leader, tsk, PIDTYPE_SID); 954 transfer_pid(leader, tsk, PIDTYPE_SID);
953 955
@@ -1463,7 +1465,6 @@ static int do_execve_common(const char *filename,
1463 struct files_struct *displaced; 1465 struct files_struct *displaced;
1464 bool clear_in_exec; 1466 bool clear_in_exec;
1465 int retval; 1467 int retval;
1466 const struct cred *cred = current_cred();
1467 1468
1468 /* 1469 /*
1469 * We move the actual failure in case of RLIMIT_NPROC excess from 1470 * We move the actual failure in case of RLIMIT_NPROC excess from
@@ -1472,7 +1473,7 @@ static int do_execve_common(const char *filename,
1472 * whether NPROC limit is still exceeded. 1473 * whether NPROC limit is still exceeded.
1473 */ 1474 */
1474 if ((current->flags & PF_NPROC_EXCEEDED) && 1475 if ((current->flags & PF_NPROC_EXCEEDED) &&
1475 atomic_read(&cred->user->processes) > rlimit(RLIMIT_NPROC)) { 1476 atomic_read(&current_user()->processes) > rlimit(RLIMIT_NPROC)) {
1476 retval = -EAGAIN; 1477 retval = -EAGAIN;
1477 goto out_ret; 1478 goto out_ret;
1478 } 1479 }