summaryrefslogtreecommitdiffstats
path: root/kernel/ptrace.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2001-04-05 04:55:58 +0000
committerRalf Baechle <ralf@linux-mips.org>2001-04-05 04:55:58 +0000
commit74a9f2e1b4d3ab45a9f72cb5b556c9f521524ab3 (patch)
tree7c4cdb103ab1b388c9852a88bd6fb1e73eba0b5c /kernel/ptrace.c
parentee6374c8b0d333c08061c6a97bc77090d7461225 (diff)
Merge with Linux 2.4.3.
Note that mingetty does no longer work with serial console, you have to switch to another getty like getty_ps. This commit also includes a fix for a setitimer bug which did prevent getty_ps from working on older kernels.
Diffstat (limited to 'kernel/ptrace.c')
-rw-r--r--kernel/ptrace.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 410f9de93..bb094496a 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -28,6 +28,7 @@ static int access_one_page(struct mm_struct * mm, struct vm_area_struct * vma, u
struct page *page;
repeat:
+ spin_lock(&mm->page_table_lock);
pgdir = pgd_offset(vma->vm_mm, addr);
if (pgd_none(*pgdir))
goto fault_in_page;
@@ -47,9 +48,13 @@ repeat:
/* ZERO_PAGE is special: reads from it are ok even though it's marked reserved */
if (page != ZERO_PAGE(addr) || write) {
- if ((!VALID_PAGE(page)) || PageReserved(page))
+ if ((!VALID_PAGE(page)) || PageReserved(page)) {
+ spin_unlock(&mm->page_table_lock);
return 0;
+ }
}
+ get_page(page);
+ spin_unlock(&mm->page_table_lock);
flush_cache_page(vma, addr);
if (write) {
@@ -64,19 +69,23 @@ repeat:
flush_page_to_ram(page);
kunmap(page);
}
+ put_page(page);
return len;
fault_in_page:
+ spin_unlock(&mm->page_table_lock);
/* -1: out of memory. 0 - unmapped page */
if (handle_mm_fault(mm, vma, addr, write) > 0)
goto repeat;
return 0;
bad_pgd:
+ spin_unlock(&mm->page_table_lock);
pgd_ERROR(*pgdir);
return 0;
bad_pmd:
+ spin_unlock(&mm->page_table_lock);
pmd_ERROR(*pgmiddle);
return 0;
}
@@ -131,13 +140,13 @@ int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, in
if (!mm)
return 0;
- down(&mm->mmap_sem);
+ down_read(&mm->mmap_sem);
vma = find_extend_vma(mm, addr);
copied = 0;
if (vma)
copied = access_mm(mm, vma, addr, buf, len, write);
- up(&mm->mmap_sem);
+ up_read(&mm->mmap_sem);
mmput(mm);
return copied;
}