svn commit: r192859 - in head: share/man/man4 sys/conf
sys/dev/ksyms sys/kern sys/modules sys/modules/ksyms sys/sys
kostikbel at gmail.com
Wed May 27 14:38:10 UTC 2009
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:
> >>Author: sson
> >>Date: Tue May 26 21:39:09 2009
> >>New Revision: 192859
> >>URL: http://svn.freebsd.org/changeset/base/192859
> >> 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 symbols
> >> 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 already
> >> 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.
> >> Reviewed by: gallatin kib (freebsd-arch)
> >> Approved by: gnn (mentor)
> >What is the reason to have ksyms_unmap() ?
> ksyms_unmap() is used to free the mapping of the memory when /dev/ksyms
> 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()".
> >Why do you think that checking
> >for the present mapping of the freed region is neccessary ?
> ksyms_unmap() does check to make sure the memory region is mapped since
> it is possible that the process could have unmap it or changed its
> protection before calling close(). I haven't looked at vm_map_delete()
> closely but maybe it make makes this check as well. If so, this check
> 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()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090527/d89ec743/attachment.pgp
More information about the svn-src-all