From owner-freebsd-hackers Tue Jul 29 19:50:02 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id TAA01629 for hackers-outgoing; Tue, 29 Jul 1997 19:50:02 -0700 (PDT) Received: from genesis.atrad.adelaide.edu.au (genesis.atrad.adelaide.edu.au [129.127.96.120]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id TAA01597 for ; Tue, 29 Jul 1997 19:49:57 -0700 (PDT) Received: (from msmith@localhost) by genesis.atrad.adelaide.edu.au (8.8.5/8.7.3) id MAA17292; Wed, 30 Jul 1997 12:19:49 +0930 (CST) From: Michael Smith Message-Id: <199707300249.MAA17292@genesis.atrad.adelaide.edu.au> Subject: Re: Location of copyin() and copyout().. In-Reply-To: <199707300230.TAA11782@implode.root.com> from David Greenman at "Jul 29, 97 07:30:39 pm" To: dg@root.com Date: Wed, 30 Jul 1997 12:19:48 +0930 (CST) Cc: msmith@atrad.adelaide.edu.au, freebsd-hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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 [[