Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Jul 2008 07:58:37 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Stacey Son <sson@freebsd.org>
Cc:        Andrew Gallatin <gallatin@cs.duke.edu>, freebsd-arch@freebsd.org
Subject:   Re: ksyms pseudo driver
Message-ID:  <20080712045837.GD17123@deviant.kiev.zoral.com.ua>
In-Reply-To: <48780661.5050002@freebsd.org>
References:  <4875A5D2.8030902@freebsd.org> <20080711155232.A96384@grasshopper.cs.duke.edu> <48780661.5050002@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--GAc89RRdceylj63L
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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).
> >>    =20
> >
> >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.
> >  =20
> Actually that is what the ioctls do now...   You can just open=20
> /dev/ksyms to create the snapshot and then use ioctl() to get the size=20
> 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.

--GAc89RRdceylj63L
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkh4OfwACgkQC3+MBN1Mb4jxtgCgofnRqwzq8QzlqE6jtIHXOI3Q
cCYAmwS9jsXBz9CuvdmwtyqXRsdyRTkC
=roYt
-----END PGP SIGNATURE-----

--GAc89RRdceylj63L--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080712045837.GD17123>