diff options
-rw-r--r-- | arch/mips/kernel/irixelf.c | 2 | ||||
-rw-r--r-- | drivers/char/mxser.c | 2 | ||||
-rw-r--r-- | drivers/char/rocket.c | 2 | ||||
-rw-r--r-- | drivers/char/tty_io.c | 12 | ||||
-rw-r--r-- | fs/binfmt_elf.c | 4 | ||||
-rw-r--r-- | fs/binfmt_elf_fdpic.c | 4 | ||||
-rw-r--r-- | include/linux/sched.h | 5 | ||||
-rw-r--r-- | kernel/exit.c | 19 | ||||
-rw-r--r-- | kernel/fork.c | 4 | ||||
-rw-r--r-- | kernel/signal.c | 2 | ||||
-rw-r--r-- | kernel/sys.c | 8 |
11 files changed, 35 insertions, 29 deletions
diff --git a/arch/mips/kernel/irixelf.c b/arch/mips/kernel/irixelf.c index 1bbefbf43373..37cad5de515c 100644 --- a/arch/mips/kernel/irixelf.c +++ b/arch/mips/kernel/irixelf.c | |||
@@ -1145,7 +1145,7 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file) | |||
1145 | psinfo.pr_pid = prstatus.pr_pid = current->pid; | 1145 | psinfo.pr_pid = prstatus.pr_pid = current->pid; |
1146 | psinfo.pr_ppid = prstatus.pr_ppid = current->parent->pid; | 1146 | psinfo.pr_ppid = prstatus.pr_ppid = current->parent->pid; |
1147 | psinfo.pr_pgrp = prstatus.pr_pgrp = process_group(current); | 1147 | psinfo.pr_pgrp = prstatus.pr_pgrp = process_group(current); |
1148 | psinfo.pr_sid = prstatus.pr_sid = current->signal->session; | 1148 | psinfo.pr_sid = prstatus.pr_sid = process_session(current); |
1149 | if (current->pid == current->tgid) { | 1149 | if (current->pid == current->tgid) { |
1150 | /* | 1150 | /* |
1151 | * This is the record for the group leader. Add in the | 1151 | * This is the record for the group leader. Add in the |
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 5ed2486b7581..b1cc89c89820 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
@@ -994,7 +994,7 @@ static int mxser_open(struct tty_struct *tty, struct file *filp) | |||
994 | mxser_change_speed(info, NULL); | 994 | mxser_change_speed(info, NULL); |
995 | } | 995 | } |
996 | 996 | ||
997 | info->session = current->signal->session; | 997 | info->session = process_session(current); |
998 | info->pgrp = process_group(current); | 998 | info->pgrp = process_group(current); |
999 | 999 | ||
1000 | /* | 1000 | /* |
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index bac80056f7e0..4fdf52e9f3b1 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c | |||
@@ -1017,7 +1017,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp) | |||
1017 | /* | 1017 | /* |
1018 | * Info->count is now 1; so it's safe to sleep now. | 1018 | * Info->count is now 1; so it's safe to sleep now. |
1019 | */ | 1019 | */ |
1020 | info->session = current->signal->session; | 1020 | info->session = process_session(current); |
1021 | info->pgrp = process_group(current); | 1021 | info->pgrp = process_group(current); |
1022 | 1022 | ||
1023 | if ((info->flags & ROCKET_INITIALIZED) == 0) { | 1023 | if ((info->flags & ROCKET_INITIALIZED) == 0) { |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 8a2d26e98ac4..4ebba7ca1dc9 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -1511,7 +1511,7 @@ void disassociate_ctty(int on_exit) | |||
1511 | 1511 | ||
1512 | spin_lock_irq(¤t->sighand->siglock); | 1512 | spin_lock_irq(¤t->sighand->siglock); |
1513 | current->signal->tty_old_pgrp = 0; | 1513 | current->signal->tty_old_pgrp = 0; |
1514 | session = current->signal->session; | 1514 | session = process_session(current); |
1515 | spin_unlock_irq(¤t->sighand->siglock); | 1515 | spin_unlock_irq(¤t->sighand->siglock); |
1516 | 1516 | ||
1517 | mutex_lock(&tty_mutex); | 1517 | mutex_lock(&tty_mutex); |
@@ -2897,7 +2897,7 @@ static int tiocsctty(struct tty_struct *tty, int arg) | |||
2897 | { | 2897 | { |
2898 | int ret = 0; | 2898 | int ret = 0; |
2899 | if (current->signal->leader && | 2899 | if (current->signal->leader && |
2900 | (current->signal->session == tty->session)) | 2900 | (process_session(current) == tty->session)) |
2901 | return ret; | 2901 | return ret; |
2902 | 2902 | ||
2903 | mutex_lock(&tty_mutex); | 2903 | mutex_lock(&tty_mutex); |
@@ -2979,13 +2979,13 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t | |||
2979 | return retval; | 2979 | return retval; |
2980 | if (!current->signal->tty || | 2980 | if (!current->signal->tty || |
2981 | (current->signal->tty != real_tty) || | 2981 | (current->signal->tty != real_tty) || |
2982 | (real_tty->session != current->signal->session)) | 2982 | (real_tty->session != process_session(current))) |
2983 | return -ENOTTY; | 2983 | return -ENOTTY; |
2984 | if (get_user(pgrp, p)) | 2984 | if (get_user(pgrp, p)) |
2985 | return -EFAULT; | 2985 | return -EFAULT; |
2986 | if (pgrp < 0) | 2986 | if (pgrp < 0) |
2987 | return -EINVAL; | 2987 | return -EINVAL; |
2988 | if (session_of_pgrp(pgrp) != current->signal->session) | 2988 | if (session_of_pgrp(pgrp) != process_session(current)) |
2989 | return -EPERM; | 2989 | return -EPERM; |
2990 | real_tty->pgrp = pgrp; | 2990 | real_tty->pgrp = pgrp; |
2991 | return 0; | 2991 | return 0; |
@@ -3338,7 +3338,7 @@ static void __do_SAK(struct work_struct *work) | |||
3338 | /* Kill the entire session */ | 3338 | /* Kill the entire session */ |
3339 | do_each_task_pid(session, PIDTYPE_SID, p) { | 3339 | do_each_task_pid(session, PIDTYPE_SID, p) { |
3340 | printk(KERN_NOTICE "SAK: killed process %d" | 3340 | printk(KERN_NOTICE "SAK: killed process %d" |
3341 | " (%s): p->signal->session==tty->session\n", | 3341 | " (%s): process_session(p)==tty->session\n", |
3342 | p->pid, p->comm); | 3342 | p->pid, p->comm); |
3343 | send_sig(SIGKILL, p, 1); | 3343 | send_sig(SIGKILL, p, 1); |
3344 | } while_each_task_pid(session, PIDTYPE_SID, p); | 3344 | } while_each_task_pid(session, PIDTYPE_SID, p); |
@@ -3348,7 +3348,7 @@ static void __do_SAK(struct work_struct *work) | |||
3348 | do_each_thread(g, p) { | 3348 | do_each_thread(g, p) { |
3349 | if (p->signal->tty == tty) { | 3349 | if (p->signal->tty == tty) { |
3350 | printk(KERN_NOTICE "SAK: killed process %d" | 3350 | printk(KERN_NOTICE "SAK: killed process %d" |
3351 | " (%s): p->signal->session==tty->session\n", | 3351 | " (%s): process_session(p)==tty->session\n", |
3352 | p->pid, p->comm); | 3352 | p->pid, p->comm); |
3353 | send_sig(SIGKILL, p, 1); | 3353 | send_sig(SIGKILL, p, 1); |
3354 | continue; | 3354 | continue; |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index c6dbb4a7ec78..d3adfd353ff9 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -1317,7 +1317,7 @@ static void fill_prstatus(struct elf_prstatus *prstatus, | |||
1317 | prstatus->pr_pid = p->pid; | 1317 | prstatus->pr_pid = p->pid; |
1318 | prstatus->pr_ppid = p->parent->pid; | 1318 | prstatus->pr_ppid = p->parent->pid; |
1319 | prstatus->pr_pgrp = process_group(p); | 1319 | prstatus->pr_pgrp = process_group(p); |
1320 | prstatus->pr_sid = p->signal->session; | 1320 | prstatus->pr_sid = process_session(p); |
1321 | if (thread_group_leader(p)) { | 1321 | if (thread_group_leader(p)) { |
1322 | /* | 1322 | /* |
1323 | * This is the record for the group leader. Add in the | 1323 | * This is the record for the group leader. Add in the |
@@ -1363,7 +1363,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p, | |||
1363 | psinfo->pr_pid = p->pid; | 1363 | psinfo->pr_pid = p->pid; |
1364 | psinfo->pr_ppid = p->parent->pid; | 1364 | psinfo->pr_ppid = p->parent->pid; |
1365 | psinfo->pr_pgrp = process_group(p); | 1365 | psinfo->pr_pgrp = process_group(p); |
1366 | psinfo->pr_sid = p->signal->session; | 1366 | psinfo->pr_sid = process_session(p); |
1367 | 1367 | ||
1368 | i = p->state ? ffz(~p->state) + 1 : 0; | 1368 | i = p->state ? ffz(~p->state) + 1 : 0; |
1369 | psinfo->pr_state = i; | 1369 | psinfo->pr_state = i; |
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index 9f0b7efc3df5..76f06f6bc2f6 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c | |||
@@ -1322,7 +1322,7 @@ static void fill_prstatus(struct elf_prstatus *prstatus, | |||
1322 | prstatus->pr_pid = p->pid; | 1322 | prstatus->pr_pid = p->pid; |
1323 | prstatus->pr_ppid = p->parent->pid; | 1323 | prstatus->pr_ppid = p->parent->pid; |
1324 | prstatus->pr_pgrp = process_group(p); | 1324 | prstatus->pr_pgrp = process_group(p); |
1325 | prstatus->pr_sid = p->signal->session; | 1325 | prstatus->pr_sid = process_session(p); |
1326 | if (thread_group_leader(p)) { | 1326 | if (thread_group_leader(p)) { |
1327 | /* | 1327 | /* |
1328 | * This is the record for the group leader. Add in the | 1328 | * This is the record for the group leader. Add in the |
@@ -1371,7 +1371,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p, | |||
1371 | psinfo->pr_pid = p->pid; | 1371 | psinfo->pr_pid = p->pid; |
1372 | psinfo->pr_ppid = p->parent->pid; | 1372 | psinfo->pr_ppid = p->parent->pid; |
1373 | psinfo->pr_pgrp = process_group(p); | 1373 | psinfo->pr_pgrp = process_group(p); |
1374 | psinfo->pr_sid = p->signal->session; | 1374 | psinfo->pr_sid = process_session(p); |
1375 | 1375 | ||
1376 | i = p->state ? ffz(~p->state) + 1 : 0; | 1376 | i = p->state ? ffz(~p->state) + 1 : 0; |
1377 | psinfo->pr_state = i; | 1377 | psinfo->pr_state = i; |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 5e8a0ba61749..270d864a8ff1 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1047,6 +1047,11 @@ static inline pid_t process_group(struct task_struct *tsk) | |||
1047 | return tsk->signal->pgrp; | 1047 | return tsk->signal->pgrp; |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | static inline pid_t process_session(struct task_struct *tsk) | ||
1051 | { | ||
1052 | return tsk->signal->session; | ||
1053 | } | ||
1054 | |||
1050 | static inline struct pid *task_pid(struct task_struct *task) | 1055 | static inline struct pid *task_pid(struct task_struct *task) |
1051 | { | 1056 | { |
1052 | return task->pids[PIDTYPE_PID].pid; | 1057 | return task->pids[PIDTYPE_PID].pid; |
diff --git a/kernel/exit.c b/kernel/exit.c index fa0495e167e9..8d289bfc13d1 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -193,14 +193,14 @@ int session_of_pgrp(int pgrp) | |||
193 | 193 | ||
194 | read_lock(&tasklist_lock); | 194 | read_lock(&tasklist_lock); |
195 | do_each_task_pid(pgrp, PIDTYPE_PGID, p) { | 195 | do_each_task_pid(pgrp, PIDTYPE_PGID, p) { |
196 | if (p->signal->session > 0) { | 196 | if (process_session(p) > 0) { |
197 | sid = p->signal->session; | 197 | sid = process_session(p); |
198 | goto out; | 198 | goto out; |
199 | } | 199 | } |
200 | } while_each_task_pid(pgrp, PIDTYPE_PGID, p); | 200 | } while_each_task_pid(pgrp, PIDTYPE_PGID, p); |
201 | p = find_task_by_pid(pgrp); | 201 | p = find_task_by_pid(pgrp); |
202 | if (p) | 202 | if (p) |
203 | sid = p->signal->session; | 203 | sid = process_session(p); |
204 | out: | 204 | out: |
205 | read_unlock(&tasklist_lock); | 205 | read_unlock(&tasklist_lock); |
206 | 206 | ||
@@ -225,8 +225,8 @@ static int will_become_orphaned_pgrp(int pgrp, struct task_struct *ignored_task) | |||
225 | || p->exit_state | 225 | || p->exit_state |
226 | || is_init(p->real_parent)) | 226 | || is_init(p->real_parent)) |
227 | continue; | 227 | continue; |
228 | if (process_group(p->real_parent) != pgrp | 228 | if (process_group(p->real_parent) != pgrp && |
229 | && p->real_parent->signal->session == p->signal->session) { | 229 | process_session(p->real_parent) == process_session(p)) { |
230 | ret = 0; | 230 | ret = 0; |
231 | break; | 231 | break; |
232 | } | 232 | } |
@@ -302,7 +302,7 @@ void __set_special_pids(pid_t session, pid_t pgrp) | |||
302 | { | 302 | { |
303 | struct task_struct *curr = current->group_leader; | 303 | struct task_struct *curr = current->group_leader; |
304 | 304 | ||
305 | if (curr->signal->session != session) { | 305 | if (process_session(curr) != session) { |
306 | detach_pid(curr, PIDTYPE_SID); | 306 | detach_pid(curr, PIDTYPE_SID); |
307 | curr->signal->session = session; | 307 | curr->signal->session = session; |
308 | attach_pid(curr, PIDTYPE_SID, session); | 308 | attach_pid(curr, PIDTYPE_SID, session); |
@@ -647,10 +647,11 @@ reparent_thread(struct task_struct *p, struct task_struct *father, int traced) | |||
647 | * outside, so the child pgrp is now orphaned. | 647 | * outside, so the child pgrp is now orphaned. |
648 | */ | 648 | */ |
649 | if ((process_group(p) != process_group(father)) && | 649 | if ((process_group(p) != process_group(father)) && |
650 | (p->signal->session == father->signal->session)) { | 650 | (process_session(p) == process_session(father))) { |
651 | int pgrp = process_group(p); | 651 | int pgrp = process_group(p); |
652 | 652 | ||
653 | if (will_become_orphaned_pgrp(pgrp, NULL) && has_stopped_jobs(pgrp)) { | 653 | if (will_become_orphaned_pgrp(pgrp, NULL) && |
654 | has_stopped_jobs(pgrp)) { | ||
654 | __kill_pg_info(SIGHUP, SEND_SIG_PRIV, pgrp); | 655 | __kill_pg_info(SIGHUP, SEND_SIG_PRIV, pgrp); |
655 | __kill_pg_info(SIGCONT, SEND_SIG_PRIV, pgrp); | 656 | __kill_pg_info(SIGCONT, SEND_SIG_PRIV, pgrp); |
656 | } | 657 | } |
@@ -784,7 +785,7 @@ static void exit_notify(struct task_struct *tsk) | |||
784 | t = tsk->real_parent; | 785 | t = tsk->real_parent; |
785 | 786 | ||
786 | if ((process_group(t) != process_group(tsk)) && | 787 | if ((process_group(t) != process_group(tsk)) && |
787 | (t->signal->session == tsk->signal->session) && | 788 | (process_session(t) == process_session(tsk)) && |
788 | will_become_orphaned_pgrp(process_group(tsk), tsk) && | 789 | will_become_orphaned_pgrp(process_group(tsk), tsk) && |
789 | has_stopped_jobs(process_group(tsk))) { | 790 | has_stopped_jobs(process_group(tsk))) { |
790 | __kill_pg_info(SIGHUP, SEND_SIG_PRIV, process_group(tsk)); | 791 | __kill_pg_info(SIGHUP, SEND_SIG_PRIV, process_group(tsk)); |
diff --git a/kernel/fork.c b/kernel/fork.c index 597707819327..298c4d6ab512 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -1259,9 +1259,9 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1259 | if (thread_group_leader(p)) { | 1259 | if (thread_group_leader(p)) { |
1260 | p->signal->tty = current->signal->tty; | 1260 | p->signal->tty = current->signal->tty; |
1261 | p->signal->pgrp = process_group(current); | 1261 | p->signal->pgrp = process_group(current); |
1262 | p->signal->session = current->signal->session; | 1262 | p->signal->session = process_session(current); |
1263 | attach_pid(p, PIDTYPE_PGID, process_group(p)); | 1263 | attach_pid(p, PIDTYPE_PGID, process_group(p)); |
1264 | attach_pid(p, PIDTYPE_SID, p->signal->session); | 1264 | attach_pid(p, PIDTYPE_SID, process_session(p)); |
1265 | 1265 | ||
1266 | list_add_tail_rcu(&p->tasks, &init_task.tasks); | 1266 | list_add_tail_rcu(&p->tasks, &init_task.tasks); |
1267 | __get_cpu_var(process_counts)++; | 1267 | __get_cpu_var(process_counts)++; |
diff --git a/kernel/signal.c b/kernel/signal.c index ec81defde339..9eac4db60eda 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -583,7 +583,7 @@ static int check_kill_permission(int sig, struct siginfo *info, | |||
583 | error = -EPERM; | 583 | error = -EPERM; |
584 | if ((info == SEND_SIG_NOINFO || (!is_si_special(info) && SI_FROMUSER(info))) | 584 | if ((info == SEND_SIG_NOINFO || (!is_si_special(info) && SI_FROMUSER(info))) |
585 | && ((sig != SIGCONT) || | 585 | && ((sig != SIGCONT) || |
586 | (current->signal->session != t->signal->session)) | 586 | (process_session(current) != process_session(t))) |
587 | && (current->euid ^ t->suid) && (current->euid ^ t->uid) | 587 | && (current->euid ^ t->suid) && (current->euid ^ t->uid) |
588 | && (current->uid ^ t->suid) && (current->uid ^ t->uid) | 588 | && (current->uid ^ t->suid) && (current->uid ^ t->uid) |
589 | && !capable(CAP_KILL)) | 589 | && !capable(CAP_KILL)) |
diff --git a/kernel/sys.c b/kernel/sys.c index 1ac2d1c5d84e..4f9d23a3095f 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -1381,7 +1381,7 @@ asmlinkage long sys_setpgid(pid_t pid, pid_t pgid) | |||
1381 | 1381 | ||
1382 | if (p->real_parent == group_leader) { | 1382 | if (p->real_parent == group_leader) { |
1383 | err = -EPERM; | 1383 | err = -EPERM; |
1384 | if (p->signal->session != group_leader->signal->session) | 1384 | if (process_session(p) != process_session(group_leader)) |
1385 | goto out; | 1385 | goto out; |
1386 | err = -EACCES; | 1386 | err = -EACCES; |
1387 | if (p->did_exec) | 1387 | if (p->did_exec) |
@@ -1400,7 +1400,7 @@ asmlinkage long sys_setpgid(pid_t pid, pid_t pgid) | |||
1400 | struct task_struct *p; | 1400 | struct task_struct *p; |
1401 | 1401 | ||
1402 | do_each_task_pid(pgid, PIDTYPE_PGID, p) { | 1402 | do_each_task_pid(pgid, PIDTYPE_PGID, p) { |
1403 | if (p->signal->session == group_leader->signal->session) | 1403 | if (process_session(p) == process_session(group_leader)) |
1404 | goto ok_pgid; | 1404 | goto ok_pgid; |
1405 | } while_each_task_pid(pgid, PIDTYPE_PGID, p); | 1405 | } while_each_task_pid(pgid, PIDTYPE_PGID, p); |
1406 | goto out; | 1406 | goto out; |
@@ -1459,7 +1459,7 @@ asmlinkage long sys_getpgrp(void) | |||
1459 | asmlinkage long sys_getsid(pid_t pid) | 1459 | asmlinkage long sys_getsid(pid_t pid) |
1460 | { | 1460 | { |
1461 | if (!pid) | 1461 | if (!pid) |
1462 | return current->signal->session; | 1462 | return process_session(current); |
1463 | else { | 1463 | else { |
1464 | int retval; | 1464 | int retval; |
1465 | struct task_struct *p; | 1465 | struct task_struct *p; |
@@ -1471,7 +1471,7 @@ asmlinkage long sys_getsid(pid_t pid) | |||
1471 | if (p) { | 1471 | if (p) { |
1472 | retval = security_task_getsid(p); | 1472 | retval = security_task_getsid(p); |
1473 | if (!retval) | 1473 | if (!retval) |
1474 | retval = p->signal->session; | 1474 | retval = process_session(p); |
1475 | } | 1475 | } |
1476 | read_unlock(&tasklist_lock); | 1476 | read_unlock(&tasklist_lock); |
1477 | return retval; | 1477 | return retval; |