From ba2dacab305c598cd4c34a604f8e276bf5bab5ff Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Fri, 12 May 2000 21:05:59 +0000 Subject: Merge with Linux 2.3.99-pre7 and various other bits. --- arch/mips64/defconfig | 1 + arch/mips64/defconfig-ip22 | 1 + arch/mips64/defconfig-ip27 | 1 + arch/mips64/kernel/ptrace.c | 76 ++++++++++++++++++++++----------------- arch/mips64/mm/fault.c | 17 +++++---- arch/mips64/sgi-ip22/ip22-reset.c | 4 +-- 6 files changed, 59 insertions(+), 41 deletions(-) (limited to 'arch/mips64') diff --git a/arch/mips64/defconfig b/arch/mips64/defconfig index cf05380cc..c778eb760 100644 --- a/arch/mips64/defconfig +++ b/arch/mips64/defconfig @@ -352,6 +352,7 @@ CONFIG_SERIAL_CONSOLE=y # CONFIG_HPFS_FS is not set CONFIG_PROC_FS=y # CONFIG_DEVFS_FS is not set +# CONFIG_DEVFS_MOUNT is not set # CONFIG_DEVFS_DEBUG is not set # CONFIG_DEVPTS_FS is not set # CONFIG_QNX4FS_FS is not set diff --git a/arch/mips64/defconfig-ip22 b/arch/mips64/defconfig-ip22 index e888ee8b6..cee0ef70f 100644 --- a/arch/mips64/defconfig-ip22 +++ b/arch/mips64/defconfig-ip22 @@ -272,6 +272,7 @@ CONFIG_VT_CONSOLE=y # CONFIG_HPFS_FS is not set CONFIG_PROC_FS=y # CONFIG_DEVFS_FS is not set +# CONFIG_DEVFS_MOUNT is not set # CONFIG_DEVFS_DEBUG is not set # CONFIG_DEVPTS_FS is not set # CONFIG_QNX4FS_FS is not set diff --git a/arch/mips64/defconfig-ip27 b/arch/mips64/defconfig-ip27 index cf05380cc..c778eb760 100644 --- a/arch/mips64/defconfig-ip27 +++ b/arch/mips64/defconfig-ip27 @@ -352,6 +352,7 @@ CONFIG_SERIAL_CONSOLE=y # CONFIG_HPFS_FS is not set CONFIG_PROC_FS=y # CONFIG_DEVFS_FS is not set +# CONFIG_DEVFS_MOUNT is not set # CONFIG_DEVFS_DEBUG is not set # CONFIG_DEVPTS_FS is not set # CONFIG_QNX4FS_FS is not set diff --git a/arch/mips64/kernel/ptrace.c b/arch/mips64/kernel/ptrace.c index b79a61f0e..a0488107f 100644 --- a/arch/mips64/kernel/ptrace.c +++ b/arch/mips64/kernel/ptrace.c @@ -35,7 +35,6 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data) { struct task_struct *child; - unsigned long flags; int ret; lock_kernel(); @@ -57,15 +56,19 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data) ret = -ESRCH; read_lock(&tasklist_lock); child = find_task_by_pid(pid); - read_unlock(&tasklist_lock); /* FIXME!!! */ + if (child) + get_task_struct(child); + read_unlock(&tasklist_lock); if (!child) goto out; + ret = -EPERM; if (pid == 1) /* you may not mess with init */ - goto out; + goto out_tsk; + if (request == PTRACE_ATTACH) { if (child == current) - goto out; + goto out_tsk; if ((!child->dumpable || (current->uid != child->euid) || (current->uid != child->suid) || @@ -74,33 +77,33 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data) (current->gid != child->sgid) || (!cap_issubset(child->cap_permitted, current->cap_permitted)) || (current->gid != child->gid)) && !capable(CAP_SYS_PTRACE)) - goto out; + goto out_tsk; /* the same process cannot be attached many times */ if (child->flags & PF_PTRACED) - goto out; + goto out_tsk; child->flags |= PF_PTRACED; - write_lock_irqsave(&tasklist_lock, flags); + write_lock_irq(&tasklist_lock); if (child->p_pptr != current) { REMOVE_LINKS(child); child->p_pptr = current; SET_LINKS(child); } - write_unlock_irqrestore(&tasklist_lock, flags); + write_unlock_irq(&tasklist_lock); send_sig(SIGSTOP, child, 1); ret = 0; - goto out; + goto out_tsk; } ret = -ESRCH; if (!(child->flags & PF_PTRACED)) - goto out; + goto out_tsk; if (child->state != TASK_STOPPED) { if (request != PTRACE_KILL) - goto out; + goto out_tsk; } if (child->p_pptr != current) - goto out; + goto out_tsk; switch (request) { /* when I and D space are separate, these will need to be fixed. */ @@ -113,7 +116,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data) ret = -EIO; if (copied != sizeof(tmp)) break; - ret = put_user(tmp,(unsigned int *) data); + ret = put_user(tmp, (unsigned int *) data); break; } @@ -174,10 +177,10 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data) default: tmp = 0; ret = -EIO; - goto out; + goto out_tsk; } ret = put_user(tmp, (unsigned *) data); - goto out; + break; } /* when I and D space are separate, this will have to be fixed. */ case PTRACE_POKETEXT: /* write the word at location addr. */ @@ -273,11 +276,11 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data) break; child->flags &= ~(PF_PTRACED|PF_TRACESYS); child->exit_code = data; - write_lock_irqsave(&tasklist_lock, flags); + write_lock_irq(&tasklist_lock); REMOVE_LINKS(child); child->p_pptr = child->p_opptr; SET_LINKS(child); - write_unlock_irqrestore(&tasklist_lock, flags); + write_unlock_irq(&tasklist_lock); wake_up_process(child); ret = 0; break; @@ -287,6 +290,9 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data) ret = -EIO; break; } + +out_tsk: + free_task_struct(child); out: unlock_kernel(); return ret; @@ -295,7 +301,6 @@ out: asmlinkage int sys_ptrace(long request, long pid, long addr, long data) { struct task_struct *child; - unsigned long flags; int ret; lock_kernel(); @@ -317,15 +322,19 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) ret = -ESRCH; read_lock(&tasklist_lock); child = find_task_by_pid(pid); - read_unlock(&tasklist_lock); /* FIXME!!! */ + if (child) + get_task_struct(child); + read_unlock(&tasklist_lock); if (!child) goto out; + ret = -EPERM; if (pid == 1) /* you may not mess with init */ goto out; + if (request == PTRACE_ATTACH) { if (child == current) - goto out; + goto out_tsk; if ((!child->dumpable || (current->uid != child->euid) || (current->uid != child->suid) || @@ -334,33 +343,33 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) (current->gid != child->sgid) || (!cap_issubset(child->cap_permitted, current->cap_permitted)) || (current->gid != child->gid)) && !capable(CAP_SYS_PTRACE)) - goto out; + goto out_tsk; /* the same process cannot be attached many times */ if (child->flags & PF_PTRACED) - goto out; + goto out_tsk; child->flags |= PF_PTRACED; - write_lock_irqsave(&tasklist_lock, flags); + write_lock_irq(&tasklist_lock); if (child->p_pptr != current) { REMOVE_LINKS(child); child->p_pptr = current; SET_LINKS(child); } - write_unlock_irqrestore(&tasklist_lock, flags); + write_unlock_irq(&tasklist_lock); send_sig(SIGSTOP, child, 1); ret = 0; - goto out; + goto out_tsk; } ret = -ESRCH; if (!(child->flags & PF_PTRACED)) - goto out; + goto out_tsk; if (child->state != TASK_STOPPED) { if (request != PTRACE_KILL) - goto out; + goto out_tsk; } if (child->p_pptr != current) - goto out; + goto out_tsk; switch (request) { /* when I and D space are separate, these will need to be fixed. */ @@ -434,10 +443,10 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) default: tmp = 0; ret = -EIO; - goto out; + goto out_tsk; } ret = put_user(tmp, (unsigned long *) data); - goto out; + break; } /* when I and D space are separate, this will have to be fixed. */ case PTRACE_POKETEXT: /* write the word at location addr. */ @@ -533,11 +542,11 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) break; child->flags &= ~(PF_PTRACED|PF_TRACESYS); child->exit_code = data; - write_lock_irqsave(&tasklist_lock, flags); + write_lock_irq(&tasklist_lock); REMOVE_LINKS(child); child->p_pptr = child->p_opptr; SET_LINKS(child); - write_unlock_irqrestore(&tasklist_lock, flags); + write_unlock_irq(&tasklist_lock); wake_up_process(child); ret = 0; break; @@ -547,6 +556,9 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) ret = -EIO; break; } + +out_tsk: + free_task_struct(child); out: unlock_kernel(); return ret; diff --git a/arch/mips64/mm/fault.c b/arch/mips64/mm/fault.c index f0e60a294..e31c82568 100644 --- a/arch/mips64/mm/fault.c +++ b/arch/mips64/mm/fault.c @@ -111,12 +111,17 @@ good_area: * make sure we exit gracefully rather than endlessly redo * the fault. */ - { - int fault = handle_mm_fault(mm, vma, address, write); - if (fault < 0) - goto out_of_memory; - if (!fault) - goto do_sigbus; + switch (handle_mm_fault(mm, vma, address, write)) { + case 1: + tsk->min_flt++; + break; + case 2: + tsk->maj_flt++; + break; + case 0: + goto do_sigbus; + default: + goto out_of_memory; } up(&mm->mmap_sem); diff --git a/arch/mips64/sgi-ip22/ip22-reset.c b/arch/mips64/sgi-ip22/ip22-reset.c index 7146076d1..e8d4ff345 100644 --- a/arch/mips64/sgi-ip22/ip22-reset.c +++ b/arch/mips64/sgi-ip22/ip22-reset.c @@ -87,9 +87,7 @@ static void blink_timeout(unsigned long data) sgi_hpc_write1 ^= (HPC3_WRITE1_LC0OFF|HPC3_WRITE1_LC1OFF); hpc3mregs->write1 = sgi_hpc_write1; - del_timer(&blink_timer); - blink_timer.expires = jiffies + data; - add_timer(&blink_timer); + mod_timer(&blink_timer, jiffies+data); } static void debounce(unsigned long data) -- cgit v1.2.3