From owner-freebsd-emulation Tue Sep 9 21:52:46 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id VAA05390 for emulation-outgoing; Tue, 9 Sep 1997 21:52:46 -0700 (PDT) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id VAA05385 for ; Tue, 9 Sep 1997 21:52:41 -0700 (PDT) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.5/8.6.9) id OAA10269; Wed, 10 Sep 1997 14:40:45 +1000 Date: Wed, 10 Sep 1997 14:40:45 +1000 From: Bruce Evans Message-Id: <199709100440.OAA10269@godzilla.zeta.org.au> To: bde@zeta.org.au, jlemon@americantv.com Subject: Re: Doscmd, debugging with gdb Cc: emulation@FreeBSD.ORG, hfwirth@ping.at Sender: owner-freebsd-emulation@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >> > > cat /proc//map >> > [.. snip ..] >> > 0x8012000 0x8014000 0 2 rwx COW vnode >> > 0x8014000 0x801c000 0 8 rwx default >> > [.. snip ..] >> > (gdb) set *0x8012000 = 0 >> > (gdb) set *0x8014000 = 0 >> > Error accessing memory address 0x8014000: Bad address. >> >> `w' apparently means write-protected here :-). All the r-x COW vnodes >> are writable and all the rwx COW vnodes are non-writable. > >No, I don't think that's it; the write to the 'rwx COW vnode' entry >succeeds, while the write to the 'rwx default' entry fails. Oops, I read from the wrong column in the map. >Also, the 'default' region in doscmd was allocated via brk(), so I'd >certainly hope that allocated memory isn't non-writeable. :-) > >I neglected to mention that this was on a -current machine, BTW. Even the stack is currently non-writable via ptrace :-). Try this fix. diff -c2 vm_map.c~ vm_map.c *** vm_map.c~ Mon Sep 1 18:00:38 1997 --- vm_map.c Wed Sep 10 14:02:48 1997 *************** *** 2288,2292 **** (entry->eflags & MAP_ENTRY_COW) == 0 || (entry->wired_count != 0)) { ! if ((fault_type & (prot)) != fault_type) RETURN(KERN_PROTECTION_FAILURE); } --- 2288,2293 ---- (entry->eflags & MAP_ENTRY_COW) == 0 || (entry->wired_count != 0)) { ! if ((fault_type & prot) != ! (fault_type & ~VM_PROT_OVERRIDE_WRITE)) RETURN(KERN_PROTECTION_FAILURE); } Bruce