Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Mar 2003 15:22:43 -0800
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc:        arch@freebsd.org
Subject:   Re: GEOM ioctl issue.
Message-ID:  <3E7B9EC3.212B866@mindspring.com>
References:  <11639.1048286747@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
Poul-Henning Kamp wrote:
> If the primary argument is a struct containing pointer(s) to something
> else, a string or maybe another structure, these secondary arguments
> are not handled in the generic ioctl syscall code, it becomes the
> responsibility of the ioctl implementor to explicity call
> copyin(9)/copyout(9) on these arguments.
> 
> The way we have implemented copyin(9) and copyout(9) depends strongly
> on the fact that they are executed in the corresponding thread, it is
> not possible to access userland for one thread with copyin/out from
> another thread, userland or kernel.
> 
> GEOM abandons the original thread as the very first thing, there
> are a multitude of reasons for this, the primary being prevention
> of kernel stack overrun and the second realible and simple serialization.


Go ahead and abandon the thread, but before you do, allocate a
glue structure that contains:

	pointer to first argument
	pointer to thread to be abandoned

Then, when you need it, you can recover the thread context to do
the copyin/copyout, as necessary.

If you are willing to reduce the overall size that you allow for
the data, then you can "steal" it up front.  You probably don't
need this, because it's not like it's performance critical to not
allocated and deallocate a glue structure.

Otherwise, you could halve the size, and take a bit to mean "do
not do early abandonment of the thread".  That's probably overkill.

-- Terry

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3E7B9EC3.212B866>