From owner-svn-src-all@FreeBSD.ORG Tue Feb 9 09:57:28 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6FD2106566C; Tue, 9 Feb 2010 09:57:28 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 3DC4E8FC08; Tue, 9 Feb 2010 09:57:27 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o199vNuu013275 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 9 Feb 2010 11:57:23 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id o199vMJC080918; Tue, 9 Feb 2010 11:57:22 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id o199vM1V080917; Tue, 9 Feb 2010 11:57:22 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 9 Feb 2010 11:57:22 +0200 From: Kostik Belousov To: Marcel Moolenaar Message-ID: <20100209095722.GQ9991@deviant.kiev.zoral.com.ua> References: <201002090552.o195qZcD074581@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="SvyA5ywaG/v2A5dH" Content-Disposition: inline In-Reply-To: <201002090552.o195qZcD074581@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r203696 - in head: lib/libc/sys sys/kern sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Feb 2010 09:57:28 -0000 --SvyA5ywaG/v2A5dH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 09, 2010 at 05:52:35AM +0000, Marcel Moolenaar wrote: > Author: marcel > Date: Tue Feb 9 05:52:35 2010 > New Revision: 203696 > URL: http://svn.freebsd.org/changeset/base/203696 >=20 > Log: > Add PT_VM_TIMESTAMP and PT_VM_ENTRY so that the tracing process can > obtain the memory map of the traced process. PT_VM_TIMESTAMP can be > used to check if the memory map changed since the last time to avoid > iterating over all the VM entries unnecesarily. > =20 > MFC after: 1 month >=20 =2E.. > +static int > +ptrace_vm_entry(struct thread *td, struct proc *p, struct ptrace_vm_entr= y *pve) > +{ > + vm_map_t map; > + vm_map_entry_t entry; > + vm_object_t obj, tobj, lobj; > + struct vnode *vp; > + char *freepath, *fullpath; > + u_int pathlen; > + int error, vfslocked; > + > + map =3D &p->p_vmspace->vm_map; I think this place lacks two safety measures: - vmspace should be referenced by vmspace_acquire_ref() - vm_map should be read-locked before iterating the map entries. Vmspace may be shared between stopped debugee and other process using rfork(2), thus modified despite the fact that traced process is stopped. > + entry =3D map->header.next; > + if (pve->pve_cookie !=3D NULL) { > + while (entry !=3D &map->header && entry !=3D pve->pve_cookie) > + entry =3D entry->next; Could the entry pointed by pve_cookie be reused between ptrace(PT_VM_ENTRY) invocations ? I think the debugger should be informed about this situation, otherwise interface is too unreliable. --SvyA5ywaG/v2A5dH Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAktxMYIACgkQC3+MBN1Mb4g9HwCdFsQObkursJJXS765f2p7ATI8 xCUAnjGm+G1dpuXNQy2PoSfeYyPxCzDd =3LyT -----END PGP SIGNATURE----- --SvyA5ywaG/v2A5dH--