diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2008-02-08 07:19:16 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:22:28 -0500 |
commit | 69440e76f6121fe7a5193a82f45ccec08e4bb24b (patch) | |
tree | 1a573c55bbcb8d8d83f7a21551ca08c6ac35dfe8 /arch/mips/kernel | |
parent | ac9a8e3f0f43d20fc316162e8e5f9186d295ff49 (diff) |
pid: fix mips irix emulation pid usage
[m.kozlowski@tuxland.pl: fix unbalanced parenthesis in irix_BSDsetpgrp()]
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r-- | arch/mips/kernel/irixelf.c | 14 | ||||
-rw-r--r-- | arch/mips/kernel/irixsig.c | 16 | ||||
-rw-r--r-- | arch/mips/kernel/sysirix.c | 12 |
3 files changed, 23 insertions, 19 deletions
diff --git a/arch/mips/kernel/irixelf.c b/arch/mips/kernel/irixelf.c index 7852c7cdf29e..290d8e3a664d 100644 --- a/arch/mips/kernel/irixelf.c +++ b/arch/mips/kernel/irixelf.c | |||
@@ -591,9 +591,9 @@ static void irix_map_prda_page(void) | |||
591 | return; | 591 | return; |
592 | 592 | ||
593 | pp = (struct prda *) v; | 593 | pp = (struct prda *) v; |
594 | pp->prda_sys.t_pid = current->pid; | 594 | pp->prda_sys.t_pid = task_pid_vnr(current); |
595 | pp->prda_sys.t_prid = read_c0_prid(); | 595 | pp->prda_sys.t_prid = read_c0_prid(); |
596 | pp->prda_sys.t_rpid = current->pid; | 596 | pp->prda_sys.t_rpid = task_pid_vnr(current); |
597 | 597 | ||
598 | /* We leave the rest set to zero */ | 598 | /* We leave the rest set to zero */ |
599 | } | 599 | } |
@@ -1170,11 +1170,11 @@ static int irix_core_dump(long signr, struct pt_regs *regs, struct file *file, u | |||
1170 | prstatus.pr_info.si_signo = prstatus.pr_cursig = signr; | 1170 | prstatus.pr_info.si_signo = prstatus.pr_cursig = signr; |
1171 | prstatus.pr_sigpend = current->pending.signal.sig[0]; | 1171 | prstatus.pr_sigpend = current->pending.signal.sig[0]; |
1172 | prstatus.pr_sighold = current->blocked.sig[0]; | 1172 | prstatus.pr_sighold = current->blocked.sig[0]; |
1173 | psinfo.pr_pid = prstatus.pr_pid = current->pid; | 1173 | psinfo.pr_pid = prstatus.pr_pid = task_pid_vnr(current); |
1174 | psinfo.pr_ppid = prstatus.pr_ppid = current->parent->pid; | 1174 | psinfo.pr_ppid = prstatus.pr_ppid = task_pid_vnr(current->parent); |
1175 | psinfo.pr_pgrp = prstatus.pr_pgrp = task_pgrp_nr(current); | 1175 | psinfo.pr_pgrp = prstatus.pr_pgrp = task_pgrp_vnr(current); |
1176 | psinfo.pr_sid = prstatus.pr_sid = task_session_nr(current); | 1176 | psinfo.pr_sid = prstatus.pr_sid = task_session_vnr(current); |
1177 | if (current->pid == current->tgid) { | 1177 | if (thread_group_leader(current)) { |
1178 | /* | 1178 | /* |
1179 | * This is the record for the group leader. Add in the | 1179 | * This is the record for the group leader. Add in the |
1180 | * cumulative times of previous dead threads. This total | 1180 | * cumulative times of previous dead threads. This total |
diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c index 5b10ac133ec8..0215c805a592 100644 --- a/arch/mips/kernel/irixsig.c +++ b/arch/mips/kernel/irixsig.c | |||
@@ -578,10 +578,11 @@ out: | |||
578 | 578 | ||
579 | #define W_MASK (W_EXITED | W_TRAPPED | W_STOPPED | W_CONT | W_NOHANG) | 579 | #define W_MASK (W_EXITED | W_TRAPPED | W_STOPPED | W_CONT | W_NOHANG) |
580 | 580 | ||
581 | asmlinkage int irix_waitsys(int type, int pid, | 581 | asmlinkage int irix_waitsys(int type, int upid, |
582 | struct irix5_siginfo __user *info, int options, | 582 | struct irix5_siginfo __user *info, int options, |
583 | struct rusage __user *ru) | 583 | struct rusage __user *ru) |
584 | { | 584 | { |
585 | struct pid *pid = NULL; | ||
585 | int flag, retval; | 586 | int flag, retval; |
586 | DECLARE_WAITQUEUE(wait, current); | 587 | DECLARE_WAITQUEUE(wait, current); |
587 | struct task_struct *tsk; | 588 | struct task_struct *tsk; |
@@ -604,6 +605,8 @@ asmlinkage int irix_waitsys(int type, int pid, | |||
604 | if (type != IRIX_P_PID && type != IRIX_P_PGID && type != IRIX_P_ALL) | 605 | if (type != IRIX_P_PID && type != IRIX_P_PGID && type != IRIX_P_ALL) |
605 | return -EINVAL; | 606 | return -EINVAL; |
606 | 607 | ||
608 | if (type != IRIX_P_ALL) | ||
609 | pid = find_get_pid(upid); | ||
607 | add_wait_queue(¤t->signal->wait_chldexit, &wait); | 610 | add_wait_queue(¤t->signal->wait_chldexit, &wait); |
608 | repeat: | 611 | repeat: |
609 | flag = 0; | 612 | flag = 0; |
@@ -612,9 +615,9 @@ repeat: | |||
612 | tsk = current; | 615 | tsk = current; |
613 | list_for_each(_p, &tsk->children) { | 616 | list_for_each(_p, &tsk->children) { |
614 | p = list_entry(_p, struct task_struct, sibling); | 617 | p = list_entry(_p, struct task_struct, sibling); |
615 | if ((type == IRIX_P_PID) && p->pid != pid) | 618 | if ((type == IRIX_P_PID) && task_pid(p) != pid) |
616 | continue; | 619 | continue; |
617 | if ((type == IRIX_P_PGID) && task_pgrp_nr(p) != pid) | 620 | if ((type == IRIX_P_PGID) && task_pgrp(p) != pid) |
618 | continue; | 621 | continue; |
619 | if ((p->exit_signal != SIGCHLD)) | 622 | if ((p->exit_signal != SIGCHLD)) |
620 | continue; | 623 | continue; |
@@ -639,7 +642,7 @@ repeat: | |||
639 | 642 | ||
640 | retval = __put_user(SIGCHLD, &info->sig); | 643 | retval = __put_user(SIGCHLD, &info->sig); |
641 | retval |= __put_user(0, &info->code); | 644 | retval |= __put_user(0, &info->code); |
642 | retval |= __put_user(p->pid, &info->stuff.procinfo.pid); | 645 | retval |= __put_user(task_pid_vnr(p), &info->stuff.procinfo.pid); |
643 | retval |= __put_user((p->exit_code >> 8) & 0xff, | 646 | retval |= __put_user((p->exit_code >> 8) & 0xff, |
644 | &info->stuff.procinfo.procdata.child.status); | 647 | &info->stuff.procinfo.procdata.child.status); |
645 | retval |= __put_user(p->utime, &info->stuff.procinfo.procdata.child.utime); | 648 | retval |= __put_user(p->utime, &info->stuff.procinfo.procdata.child.utime); |
@@ -657,7 +660,7 @@ repeat: | |||
657 | getrusage(p, RUSAGE_BOTH, ru); | 660 | getrusage(p, RUSAGE_BOTH, ru); |
658 | retval = __put_user(SIGCHLD, &info->sig); | 661 | retval = __put_user(SIGCHLD, &info->sig); |
659 | retval |= __put_user(1, &info->code); /* CLD_EXITED */ | 662 | retval |= __put_user(1, &info->code); /* CLD_EXITED */ |
660 | retval |= __put_user(p->pid, &info->stuff.procinfo.pid); | 663 | retval |= __put_user(task_pid_vnr(p), &info->stuff.procinfo.pid); |
661 | retval |= __put_user((p->exit_code >> 8) & 0xff, | 664 | retval |= __put_user((p->exit_code >> 8) & 0xff, |
662 | &info->stuff.procinfo.procdata.child.status); | 665 | &info->stuff.procinfo.procdata.child.status); |
663 | retval |= __put_user(p->utime, | 666 | retval |= __put_user(p->utime, |
@@ -665,7 +668,7 @@ repeat: | |||
665 | retval |= __put_user(p->stime, | 668 | retval |= __put_user(p->stime, |
666 | &info->stuff.procinfo.procdata.child.stime); | 669 | &info->stuff.procinfo.procdata.child.stime); |
667 | if (retval) | 670 | if (retval) |
668 | return retval; | 671 | goto end_waitsys; |
669 | 672 | ||
670 | if (p->real_parent != p->parent) { | 673 | if (p->real_parent != p->parent) { |
671 | write_lock_irq(&tasklist_lock); | 674 | write_lock_irq(&tasklist_lock); |
@@ -698,6 +701,7 @@ repeat: | |||
698 | end_waitsys: | 701 | end_waitsys: |
699 | current->state = TASK_RUNNING; | 702 | current->state = TASK_RUNNING; |
700 | remove_wait_queue(¤t->signal->wait_chldexit, &wait); | 703 | remove_wait_queue(¤t->signal->wait_chldexit, &wait); |
704 | put_pid(pid); | ||
701 | 705 | ||
702 | return retval; | 706 | return retval; |
703 | } | 707 | } |
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c index 22fd41e946b2..d70c4e0e85fb 100644 --- a/arch/mips/kernel/sysirix.c +++ b/arch/mips/kernel/sysirix.c | |||
@@ -582,8 +582,8 @@ out: | |||
582 | 582 | ||
583 | asmlinkage int irix_getpid(struct pt_regs *regs) | 583 | asmlinkage int irix_getpid(struct pt_regs *regs) |
584 | { | 584 | { |
585 | regs->regs[3] = current->real_parent->pid; | 585 | regs->regs[3] = task_pid_vnr(current->real_parent); |
586 | return current->pid; | 586 | return task_pid_vnr(current); |
587 | } | 587 | } |
588 | 588 | ||
589 | asmlinkage int irix_getuid(struct pt_regs *regs) | 589 | asmlinkage int irix_getuid(struct pt_regs *regs) |
@@ -763,11 +763,11 @@ asmlinkage int irix_setpgrp(int flags) | |||
763 | printk("[%s:%d] setpgrp(%d) ", current->comm, current->pid, flags); | 763 | printk("[%s:%d] setpgrp(%d) ", current->comm, current->pid, flags); |
764 | #endif | 764 | #endif |
765 | if(!flags) | 765 | if(!flags) |
766 | error = task_pgrp_nr(current); | 766 | error = task_pgrp_vnr(current); |
767 | else | 767 | else |
768 | error = sys_setsid(); | 768 | error = sys_setsid(); |
769 | #ifdef DEBUG_PROCGRPS | 769 | #ifdef DEBUG_PROCGRPS |
770 | printk("returning %d\n", task_pgrp_nr(current)); | 770 | printk("returning %d\n", error); |
771 | #endif | 771 | #endif |
772 | 772 | ||
773 | return error; | 773 | return error; |
@@ -1093,10 +1093,10 @@ asmlinkage int irix_BSDsetpgrp(int pid, int pgrp) | |||
1093 | pid, pgrp); | 1093 | pid, pgrp); |
1094 | #endif | 1094 | #endif |
1095 | if(!pid) | 1095 | if(!pid) |
1096 | pid = current->pid; | 1096 | pid = task_pid_vnr(current); |
1097 | 1097 | ||
1098 | /* Wheee, weird sysv thing... */ | 1098 | /* Wheee, weird sysv thing... */ |
1099 | if ((pgrp == 0) && (pid == current->pid)) | 1099 | if ((pgrp == 0) && (pid == task_pid_vnr(current))) |
1100 | error = sys_setsid(); | 1100 | error = sys_setsid(); |
1101 | else | 1101 | else |
1102 | error = sys_setpgid(pid, pgrp); | 1102 | error = sys_setpgid(pid, pgrp); |