On Tue, Feb 09, 2010 at 04:11:43PM -0800, Marcel Moolenaar wrote: > > On Feb 9, 2010, at 11:17 AM, Marcel Moolenaar wrote: > > > Action items: > > > >>>> - vmspace should be referenced by vmspace_acquire_ref() > >>>> - vm_map should be read-locked before iterating the map entries. > > > > I'll implement it and send a patch for review to avoid unnecessary > > repository churn... > > Please review attached patch. I have a sample session of how > a debugger can use the information (see XXX lines): > > hob% /usr/obj/nfs/bsddbg/trunk/bdb/bdb images/abort/abort > [cursor=0x2000000000000560:0] > bdb> run > process 1539 created > process 1539 stopped with signal 5 > XXX: 1: 0x2000000000000000-0x2000000000001fff, 5, 0 37 > `/nfs/bsddbg/trunk/images/abort/abort` > XXX: 2: 0x2000000000010000-0x2000000000011fff, 3, 0 0 `` > XXX: 3: 0x2000000040010000-0x2000000040077fff, 5, 0 21 `/libexec/ld-elf.so.1` > XXX: 4: 0x2000000040086000-0x2000000040089fff, 3, 0x66000 21 > `/libexec/ld-elf.so.1` > XXX: 5: 0x200000004008a000-0x2000000040091fff, 3, 0 0 `` > XXX: 6: 0x8000000000000000-0x800000000001ffff, 3, 0 0 `` > XXX: 7: 0x9ffffffffffe0000-0x9fffffffffffffff, 3, 0 0 `` > 0x200000004001c560: { // MFB; > > alloc r2 = ar.pfs, 0x0, 0x3, 0x3, 0x0 > nop.f 0x0 > nop.b 0x0 ;; > } > [cursor=0x200000004001c560:0] > bdb> step > process 1575 stopped with signal 5 > 0x200000004001c560: { // MFB; > alloc r2 = ar.pfs, 0x0, 0x3, 0x3, 0x0 > > nop.f 0x0 > nop.b 0x0 ;; > } > [cursor=0x200000004001c560:1] > bdb> continue > process 1539 stopped with signal 6 > XXX: 1: 0x2000000000000000-0x2000000000001fff, 5, 0 37 > `/nfs/bsddbg/trunk/images/abort/abort` > XXX: 2: 0x2000000000010000-0x2000000000011fff, 3, 0 0 `` > XXX: 3: 0x2000000040010000-0x2000000040077fff, 5, 0 21 `/libexec/ld-elf.so.1` > XXX: 4: 0x200000004007e000-0x2000000040085fff, 3, 0x6000 0 `` > XXX: 5: 0x2000000040086000-0x2000000040089fff, 3, 0x66000 21 > `/libexec/ld-elf.so.1` > XXX: 6: 0x200000004008a000-0x2000000040099fff, 3, 0 0 `` > XXX: 7: 0x200000004009c000-0x20000000402e1fff, 5, 0 15 `/lib/libc.so.7` > XXX: 8: 0x20000000402e2000-0x20000000402effff, 0, 0x246000 0 `` > XXX: 9: 0x20000000402f0000-0x20000000402fdfff, 3, 0x244000 15 `/lib/libc.so.7` > XXX: 10: 0x20000000402fe000-0x2000000040319fff, 3, 0x262000 0 `` > XXX: 11: 0x2000000040328000-0x2000000040339fff, 3, 0xe000 0 `` > XXX: 12: 0x8000000000000000-0x800000000001ffff, 3, 0 0 `` > XXX: 13: 0x9ffffffffffe0000-0x9fffffffffffffff, 3, 0 0 `` > 0x20000000402a0c40: { // MBB; > > cmp.eq p0, p6 = r0, r10 > (p6) br.sptk.few 20000000400ded00 > br.ret.sptk.few rp ;; > } > [cursor=0x20000000402a0c40:0] > bdb>
Vnode locks are before vm map locks in global lock order. vn_fullpath() may need to lock vnodes to call VOP_VPTOCNP(). I think you should (and can) drop both vm map lock and vmspace reference much earlier. Would it be cleaner to use explicitely sized types for compat32 structure members ? Comparing ptrace_vm_entry with kinfo_vmentry, I think that it might be good idea to add fsid and inode number to ptrace_vm_entry, to give at least some information when vn_fullpath failed.
pgpNq3yp1V4vV.pgp
Description: PGP signature