Date: Wed, 30 Jul 1997 12:19:48 +0930 (CST) From: Michael Smith <msmith@atrad.adelaide.edu.au> To: dg@root.com Cc: msmith@atrad.adelaide.edu.au, freebsd-hackers@FreeBSD.ORG Subject: Re: Location of copyin() and copyout().. Message-ID: <199707300249.MAA17292@genesis.atrad.adelaide.edu.au> In-Reply-To: <199707300230.TAA11782@implode.root.com> from David Greenman at "Jul 29, 97 07:30:39 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
David Greenman stands accused of saying: > >David Greenman stands accused of saying: > >> > >> There is no problem with using copyout() in the kernel to copy data out to > >> a user process, assuming that the currently running process is the intended > >> target of the copy. That is the sole purpose of the function. copyout() > >> correctly handles all issues of COW/ZF/page faults. > > > >The only issue here is that the consumer of your service may _not_ be > >a user process, eg. in the case of an ABI emulation module. I would > >specifically request that people avoid using copyout unless they can > >be _absolutely_ certain that they will only ever be talking to user > >processes. > > > >As I said, this has already caused me heartache several times 8( > > I don't understand the distinction you're making. copyout *always* runs in > the (kernel) context of a user process and the destination is always process > (as opposed to kernel) memory. Please explain. If I am writing an ABI emulation function that exchanges data with the emulated binary in one format, but need to pass the data in a different format to/from the function(s) in the kernel which provide the required functionality, I have to perform the format translation in buffers in kernel space. If the kernel function(s) use copyin/copyout, they cannot access these buffers, and thus the emulation cannot be performed. > David Greenman -- ]] Mike Smith, Software Engineer msmith@gsoft.com.au [[ ]] Genesis Software genesis@gsoft.com.au [[ ]] High-speed data acquisition and (GSM mobile) 0411-222-496 [[ ]] realtime instrument control. (ph) +61-8-8267-3493 [[ ]] Unix hardware collector. "Where are your PEZ?" The Tick [[
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199707300249.MAA17292>