diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-12-29 03:45:15 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-12-29 03:45:15 -0500 |
commit | e1df957670aef74ffd9a4ad93e6d2c90bf6b4845 (patch) | |
tree | bca1fcfef55b3e3e82c9a822b4ac6428fce2b419 /kernel/exit.c | |
parent | 2b583d8bc8d7105b58d7481a4a0ceb718dac49c6 (diff) | |
parent | 3c92ec8ae91ecf59d88c798301833d7cf83f2179 (diff) |
Merge branch 'linus' into perfcounters/core
Conflicts:
fs/exec.c
include/linux/init_task.h
Simple context conflicts.
Diffstat (limited to 'kernel/exit.c')
-rw-r--r-- | kernel/exit.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 101b7eeff44c..ad8d04d83a2e 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -46,12 +46,18 @@ | |||
46 | #include <linux/blkdev.h> | 46 | #include <linux/blkdev.h> |
47 | #include <linux/task_io_accounting_ops.h> | 47 | #include <linux/task_io_accounting_ops.h> |
48 | #include <linux/tracehook.h> | 48 | #include <linux/tracehook.h> |
49 | #include <linux/init_task.h> | ||
49 | #include <trace/sched.h> | 50 | #include <trace/sched.h> |
50 | 51 | ||
51 | #include <asm/uaccess.h> | 52 | #include <asm/uaccess.h> |
52 | #include <asm/unistd.h> | 53 | #include <asm/unistd.h> |
53 | #include <asm/pgtable.h> | 54 | #include <asm/pgtable.h> |
54 | #include <asm/mmu_context.h> | 55 | #include <asm/mmu_context.h> |
56 | #include "cred-internals.h" | ||
57 | |||
58 | DEFINE_TRACE(sched_process_free); | ||
59 | DEFINE_TRACE(sched_process_exit); | ||
60 | DEFINE_TRACE(sched_process_wait); | ||
55 | 61 | ||
56 | static void exit_mm(struct task_struct * tsk); | 62 | static void exit_mm(struct task_struct * tsk); |
57 | 63 | ||
@@ -167,7 +173,10 @@ void release_task(struct task_struct * p) | |||
167 | int zap_leader; | 173 | int zap_leader; |
168 | repeat: | 174 | repeat: |
169 | tracehook_prepare_release_task(p); | 175 | tracehook_prepare_release_task(p); |
170 | atomic_dec(&p->user->processes); | 176 | /* don't need to get the RCU readlock here - the process is dead and |
177 | * can't be modifying its own credentials */ | ||
178 | atomic_dec(&__task_cred(p)->user->processes); | ||
179 | |||
171 | proc_flush_task(p); | 180 | proc_flush_task(p); |
172 | write_lock_irq(&tasklist_lock); | 181 | write_lock_irq(&tasklist_lock); |
173 | tracehook_finish_release_task(p); | 182 | tracehook_finish_release_task(p); |
@@ -342,12 +351,12 @@ static void reparent_to_kthreadd(void) | |||
342 | /* cpus_allowed? */ | 351 | /* cpus_allowed? */ |
343 | /* rt_priority? */ | 352 | /* rt_priority? */ |
344 | /* signals? */ | 353 | /* signals? */ |
345 | security_task_reparent_to_init(current); | ||
346 | memcpy(current->signal->rlim, init_task.signal->rlim, | 354 | memcpy(current->signal->rlim, init_task.signal->rlim, |
347 | sizeof(current->signal->rlim)); | 355 | sizeof(current->signal->rlim)); |
348 | atomic_inc(&(INIT_USER->__count)); | 356 | |
357 | atomic_inc(&init_cred.usage); | ||
358 | commit_creds(&init_cred); | ||
349 | write_unlock_irq(&tasklist_lock); | 359 | write_unlock_irq(&tasklist_lock); |
350 | switch_uid(INIT_USER); | ||
351 | } | 360 | } |
352 | 361 | ||
353 | void __set_special_pids(struct pid *pid) | 362 | void __set_special_pids(struct pid *pid) |
@@ -1081,7 +1090,6 @@ NORET_TYPE void do_exit(long code) | |||
1081 | check_stack_usage(); | 1090 | check_stack_usage(); |
1082 | exit_thread(); | 1091 | exit_thread(); |
1083 | cgroup_exit(tsk, 1); | 1092 | cgroup_exit(tsk, 1); |
1084 | exit_keys(tsk); | ||
1085 | 1093 | ||
1086 | if (group_dead && tsk->signal->leader) | 1094 | if (group_dead && tsk->signal->leader) |
1087 | disassociate_ctty(1); | 1095 | disassociate_ctty(1); |
@@ -1122,7 +1130,6 @@ NORET_TYPE void do_exit(long code) | |||
1122 | preempt_disable(); | 1130 | preempt_disable(); |
1123 | /* causes final put_task_struct in finish_task_switch(). */ | 1131 | /* causes final put_task_struct in finish_task_switch(). */ |
1124 | tsk->state = TASK_DEAD; | 1132 | tsk->state = TASK_DEAD; |
1125 | |||
1126 | schedule(); | 1133 | schedule(); |
1127 | BUG(); | 1134 | BUG(); |
1128 | /* Avoid "noreturn function does return". */ | 1135 | /* Avoid "noreturn function does return". */ |
@@ -1262,12 +1269,12 @@ static int wait_task_zombie(struct task_struct *p, int options, | |||
1262 | unsigned long state; | 1269 | unsigned long state; |
1263 | int retval, status, traced; | 1270 | int retval, status, traced; |
1264 | pid_t pid = task_pid_vnr(p); | 1271 | pid_t pid = task_pid_vnr(p); |
1272 | uid_t uid = __task_cred(p)->uid; | ||
1265 | 1273 | ||
1266 | if (!likely(options & WEXITED)) | 1274 | if (!likely(options & WEXITED)) |
1267 | return 0; | 1275 | return 0; |
1268 | 1276 | ||
1269 | if (unlikely(options & WNOWAIT)) { | 1277 | if (unlikely(options & WNOWAIT)) { |
1270 | uid_t uid = p->uid; | ||
1271 | int exit_code = p->exit_code; | 1278 | int exit_code = p->exit_code; |
1272 | int why, status; | 1279 | int why, status; |
1273 | 1280 | ||
@@ -1394,7 +1401,7 @@ static int wait_task_zombie(struct task_struct *p, int options, | |||
1394 | if (!retval && infop) | 1401 | if (!retval && infop) |
1395 | retval = put_user(pid, &infop->si_pid); | 1402 | retval = put_user(pid, &infop->si_pid); |
1396 | if (!retval && infop) | 1403 | if (!retval && infop) |
1397 | retval = put_user(p->uid, &infop->si_uid); | 1404 | retval = put_user(uid, &infop->si_uid); |
1398 | if (!retval) | 1405 | if (!retval) |
1399 | retval = pid; | 1406 | retval = pid; |
1400 | 1407 | ||
@@ -1459,7 +1466,8 @@ static int wait_task_stopped(int ptrace, struct task_struct *p, | |||
1459 | if (!unlikely(options & WNOWAIT)) | 1466 | if (!unlikely(options & WNOWAIT)) |
1460 | p->exit_code = 0; | 1467 | p->exit_code = 0; |
1461 | 1468 | ||
1462 | uid = p->uid; | 1469 | /* don't need the RCU readlock here as we're holding a spinlock */ |
1470 | uid = __task_cred(p)->uid; | ||
1463 | unlock_sig: | 1471 | unlock_sig: |
1464 | spin_unlock_irq(&p->sighand->siglock); | 1472 | spin_unlock_irq(&p->sighand->siglock); |
1465 | if (!exit_code) | 1473 | if (!exit_code) |
@@ -1533,10 +1541,10 @@ static int wait_task_continued(struct task_struct *p, int options, | |||
1533 | } | 1541 | } |
1534 | if (!unlikely(options & WNOWAIT)) | 1542 | if (!unlikely(options & WNOWAIT)) |
1535 | p->signal->flags &= ~SIGNAL_STOP_CONTINUED; | 1543 | p->signal->flags &= ~SIGNAL_STOP_CONTINUED; |
1544 | uid = __task_cred(p)->uid; | ||
1536 | spin_unlock_irq(&p->sighand->siglock); | 1545 | spin_unlock_irq(&p->sighand->siglock); |
1537 | 1546 | ||
1538 | pid = task_pid_vnr(p); | 1547 | pid = task_pid_vnr(p); |
1539 | uid = p->uid; | ||
1540 | get_task_struct(p); | 1548 | get_task_struct(p); |
1541 | read_unlock(&tasklist_lock); | 1549 | read_unlock(&tasklist_lock); |
1542 | 1550 | ||