X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fmips%2Fkernel%2Fsysirix.c;h=e26ff1dc5575596053c056ad7ba6045c07d93c6e;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=e82b61fbed523e7b80d06b4f2bcbe21018a389cc;hpb=9bf4aaab3e101692164d49b7ca357651eb691cb6;p=linux-2.6.git diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c index e82b61fbe..e26ff1dc5 100644 --- a/arch/mips/kernel/sysirix.c +++ b/arch/mips/kernel/sysirix.c @@ -129,16 +129,21 @@ asmlinkage int irix_prctl(struct pt_regs *regs) if (value > RLIM_INFINITY) value = RLIM_INFINITY; if (capable(CAP_SYS_ADMIN)) { - current->rlim[RLIMIT_STACK].rlim_max = - current->rlim[RLIMIT_STACK].rlim_cur = value; + task_lock(current->group_leader); + current->signal->rlim[RLIMIT_STACK].rlim_max = + current->signal->rlim[RLIMIT_STACK].rlim_cur = value; + task_unlock(current->group_leader); error = value; break; } - if (value > current->rlim[RLIMIT_STACK].rlim_max) { + task_lock(current->group_leader); + if (value > current->signal->rlim[RLIMIT_STACK].rlim_max) { error = -EINVAL; + task_unlock(current->group_leader); break; } - current->rlim[RLIMIT_STACK].rlim_cur = value; + current->signal->rlim[RLIMIT_STACK].rlim_cur = value; + task_unlock(current->group_leader); error = value; break; } @@ -146,7 +151,7 @@ asmlinkage int irix_prctl(struct pt_regs *regs) case PR_GETSTACKSIZE: printk("irix_prctl[%s:%d]: Wants PR_GETSTACKSIZE\n", current->comm, current->pid); - error = current->rlim[RLIMIT_STACK].rlim_cur; + error = current->signal->rlim[RLIMIT_STACK].rlim_cur; break; case PR_MAXPPROCS: @@ -283,9 +288,9 @@ asmlinkage int irix_syssgi(struct pt_regs *regs) int pid = (int) regs->regs[base + 5]; char *buf = (char *) regs->regs[base + 6]; struct task_struct *p; - char comm[16]; + char tcomm[sizeof(current->comm)]; - retval = verify_area(VERIFY_WRITE, buf, 16); + retval = verify_area(VERIFY_WRITE, buf, sizeof(tcomm)); if (retval) break; read_lock(&tasklist_lock); @@ -295,11 +300,11 @@ asmlinkage int irix_syssgi(struct pt_regs *regs) retval = -ESRCH; break; } - memcpy(comm, p->comm, 16); + get_task_comm(tcomm, p); read_unlock(&tasklist_lock); /* XXX Need to check sizes. */ - copy_to_user(buf, p->comm, 16); + copy_to_user(buf, tcomm, sizeof(tcomm)); retval = 0; break; } @@ -559,7 +564,7 @@ asmlinkage int irix_brk(unsigned long brk) /* * Check against rlimit and stack.. */ - rlim = current->rlim[RLIMIT_DATA].rlim_cur; + rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur; if (rlim >= RLIM_INFINITY) rlim = ~0; if (brk - mm->end_code > rlim) { @@ -616,8 +621,14 @@ asmlinkage int irix_getgid(struct pt_regs *regs) asmlinkage int irix_stime(int value) { - if (!capable(CAP_SYS_TIME)) - return -EPERM; + int err; + struct timespec tv; + + tv.tv_sec = value; + tv.tv_nsec = 0; + err = security_settime(&tv, NULL); + if (err) + return err; write_seqlock_irq(&xtime_lock); xtime.tv_sec = value; @@ -812,8 +823,8 @@ asmlinkage int irix_times(struct tms * tbuf) return err; err |= __put_user(current->utime, &tbuf->tms_utime); err |= __put_user(current->stime, &tbuf->tms_stime); - err |= __put_user(current->cutime, &tbuf->tms_cutime); - err |= __put_user(current->cstime, &tbuf->tms_cstime); + err |= __put_user(current->signal->cutime, &tbuf->tms_cutime); + err |= __put_user(current->signal->cstime, &tbuf->tms_cstime); } return err; @@ -915,8 +926,8 @@ asmlinkage int irix_getdomainname(char *name, int len) return error; down_read(&uts_sem); - if(len > (__NEW_UTS_LEN - 1)) - len = __NEW_UTS_LEN - 1; + if (len > __NEW_UTS_LEN) + len = __NEW_UTS_LEN; error = 0; if (copy_to_user(name, system_utsname.domainname, len)) error = -EFAULT; @@ -1639,7 +1650,7 @@ asmlinkage int irix_statvfs64(char *fname, struct irix_statvfs64 *buf) struct kstatfs kbuf; int error, i; - printk("[%s:%d] Wheee.. irix_statvfs(%s,%p)\n", + printk("[%s:%d] Wheee.. irix_statvfs64(%s,%p)\n", current->comm, current->pid, fname, buf); error = verify_area(VERIFY_WRITE, buf, sizeof(struct irix_statvfs64)); if(error) @@ -1685,7 +1696,7 @@ asmlinkage int irix_fstatvfs64(int fd, struct irix_statvfs *buf) struct file *file; int error, i; - printk("[%s:%d] Wheee.. irix_fstatvfs(%d,%p)\n", + printk("[%s:%d] Wheee.. irix_fstatvfs64(%d,%p)\n", current->comm, current->pid, fd, buf); error = verify_area(VERIFY_WRITE, buf, sizeof(struct irix_statvfs)); @@ -2134,7 +2145,7 @@ asmlinkage int irix_ulimit(int cmd, int arg) retval = -EINVAL; goto out; #endif - retval = current->rlim[RLIMIT_NOFILE].rlim_cur; + retval = current->signal->rlim[RLIMIT_NOFILE].rlim_cur; goto out; case 5: