From owner-svn-src-head@FreeBSD.ORG Wed May 27 14:38:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E0201065674; Wed, 27 May 2009 14:38:09 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 1ADBF8FC13; Wed, 27 May 2009 14:38:08 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1M9KGd-000GOY-Mo; Wed, 27 May 2009 17:38:07 +0300 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 n4REc32x054250 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 27 May 2009 17:38:03 +0300 (EEST) (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 n4REc3uI052307; Wed, 27 May 2009 17:38:03 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n4REc2vn052306; Wed, 27 May 2009 17:38:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 27 May 2009 17:38:02 +0300 From: Kostik Belousov To: Stacey Son Message-ID: <20090527143802.GJ1927@deviant.kiev.zoral.com.ua> References: <200905262139.n4QLd9pI074530@svn.freebsd.org> <20090527111741.GH1927@deviant.kiev.zoral.com.ua> <4A1D4EE1.5040902@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="eC/ZNrsTjQGziECw" Content-Disposition: inline In-Reply-To: <4A1D4EE1.5040902@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.1 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 X-Virus-Scanned: mail.terabit.net.ua 1M9KGd-000GOY-Mo aa2b7cd58086ea54cc8cd3c8bc60b08b X-Terabit: YES Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192859 - in head: share/man/man4 sys/conf sys/dev/ksyms sys/kern sys/modules sys/modules/ksyms sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 14:38:10 -0000 --eC/ZNrsTjQGziECw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 27, 2009 at 09:32:01AM -0500, Stacey Son wrote: > Kostik Belousov wrote: > >On Tue, May 26, 2009 at 09:39:09PM +0000, Stacey Son wrote: > > =20 > >>Author: sson > >>Date: Tue May 26 21:39:09 2009 > >>New Revision: 192859 > >>URL: http://svn.freebsd.org/changeset/base/192859 > >> > >>Log: > >> Add the ksyms(4) pseudo driver. The ksyms driver allows a process to > >> get a quick snapshot of the kernel's symbol table including the symbo= ls > >> from any loaded modules (the symbols are all merged into one symbol > >> table). Unlike like other implementations, this ksyms driver maps > >> memory in the process memory space to store the snapshot at the time > >> /dev/ksyms is opened. It also checks to see if the process has alrea= dy > >> a snapshot open and won't allow it to open /dev/ksyms it again until = it > >> closes first. This prevents kernel and process memory from being > >> exhausted. Note that /dev/ksyms is used by the lockstat(1) command. > >> =20 > >> Reviewed by: gallatin kib (freebsd-arch) > >> Approved by: gnn (mentor) > >> =20 > > > >What is the reason to have ksyms_unmap() ? >=20 >=20 > ksyms_unmap() is used to free the mapping of the memory when /dev/ksyms= =20 > is closed or if the driver fails to create the symbol table snapshot. That was introduction sentence for the next question. And actually, it should be formulated as "why you did not used vm_map_remove()". >=20 > >Why do you think that checking > >for the present mapping of the freed region is neccessary ? >=20 > ksyms_unmap() does check to make sure the memory region is mapped since= =20 > it is possible that the process could have unmap it or changed its=20 > protection before calling close(). I haven't looked at vm_map_delete()= =20 > closely but maybe it make makes this check as well. If so, this check=20 > might be redundant. How this check verifies that process did not unmapped the region and then mapped something other over it ? My point is that this check is not needed at all. If user mode unmapped this area, so be it. If it mapped something over it, then it should be ready to loose the mapping on ksyms close. Replace the ksyms_unmap() with vm_map_remove. --eC/ZNrsTjQGziECw Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkodUEkACgkQC3+MBN1Mb4iSQgCeMPSPiCOMr78jgxn8dIjiml8c rv0AoIJRTlobWNVFdxDvbMqzDw9/W7n5 =w6fj -----END PGP SIGNATURE----- --eC/ZNrsTjQGziECw--