From 22d3427970e54f676e2b00c131968543d5e158cf Mon Sep 17 00:00:00 2001 From: dyson Date: Sun, 6 Apr 1997 02:29:45 +0000 Subject: Fix the gdb executable modify problem. Thanks to the detective work by Alan Cox , and his description of the problem. The bug was primarily in procfs_mem, but the mistake likely happened due to the lack of vm system support for the operation. I added better support for selective marking of page dirty flags so that vm_map_pageable(wiring) will not cause this problem again. The code in procfs_mem is now less bogus (but maybe still a little so.) --- sys/kern/subr_trap.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'sys/kern') diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 9dca842..5e1f171 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id$ + * $Id: trap.c,v 1.88 1997/02/22 09:32:55 peter Exp $ */ /* @@ -529,7 +529,8 @@ trap_pfault(frame, usermode) } /* Fault in the user page: */ - rv = vm_fault(map, va, ftype, FALSE); + rv = vm_fault(map, va, ftype, + (ftype & VM_PROT_WRITE) ? VM_FAULT_DIRTY : 0); --p->p_lock; } else { @@ -630,14 +631,13 @@ trap_pfault(frame, usermode) } /* Fault in the user page: */ - rv = vm_fault(map, va, ftype, FALSE); + rv = vm_fault(map, va, ftype, + (ftype & VM_PROT_WRITE) ? VM_FAULT_DIRTY : 0); --p->p_lock; } else { /* - * Since we know that kernel virtual address addresses - * always have pte pages mapped, we just have to fault - * the page. + * Don't have to worry about process locking or stacks in the kernel. */ rv = vm_fault(map, va, ftype, FALSE); } @@ -808,7 +808,7 @@ int trapwrite(addr) /* * fault the data page */ - rv = vm_fault(&vm->vm_map, va, VM_PROT_READ|VM_PROT_WRITE, FALSE); + rv = vm_fault(&vm->vm_map, va, VM_PROT_READ|VM_PROT_WRITE, VM_FAULT_DIRTY); --p->p_lock; -- cgit v1.1