ksyms pseudo driver

Kostik Belousov kostikbel at gmail.com
Sat Jul 12 05:34:31 UTC 2008


On Fri, Jul 11, 2008 at 08:18:25PM -0500, Stacey Son wrote:
> Andrew Gallatin wrote:
> >>its already opened snapshot first. Of course, this requires the read()
> >>handler to bounce the buffer into the kernel first before it is written
> >>back out to userspace.  (Maybe there is a simple way to do an userspace
> >>to userspace copy instead?) The reason I went to all this trouble is to
> >>keep /dev/ksyms from turning into an easy way to exhaust all the kernel
> >>memory (unintentionally or intentionally).
> >>     
> >
> >Instead of doing the copy in the kernel, can you just have a simple
> >ioctl which returns the address and size of the snapshot?  Then the
> >userspace side can do the copy itself.
> >   
> Actually that is what the ioctls do now...   You can just open 
> /dev/ksyms to create the snapshot and then use ioctl() to get the size 
> and address where the buffer is mapped.   Or you can use mmap().

Most likely, I miss some obvious reason there. But for me it looks
like you do it in the reverse. The natural setup would be to require
userspace to supply an allocated memory to the driver, and then the
driver fills the memory with symbol table. This solves the problem of
exhaustion of kernel address space.

As usual, when user-supplied region is too small, driver shall return
both an error and new required size. It is understandable that the size
is volatile and may be too small for the next call too. But, in fact,
kernel symtable does not change too often, so I think even the one
iteration mostly succeed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20080712/f7a0cae9/attachment.pgp


More information about the freebsd-arch mailing list