Date: 20 Jan 2000 18:33:38 +0200 From: Ville-Pertti Keinonen <will@iki.fi> To: adsharma@sharmas.dhs.org Cc: hackers@freebsd.org, zzhang@cs.binghamton.edu Subject: Re: Accessing user data from kernel Message-ID: <86puuwd7od.fsf@not.demophon.com> In-Reply-To: adsharma@c62443-a.frmt1.sfba.home.com's message of "20 Jan 2000 04:14:54 %2B0200" References: <Pine.GSO.3.96.1000119104033.19800B-100000@sol.cs.binghamton.edu> <200001200214.SAA17214@c62443-a.frmt1.sfba.home.com>
next in thread | previous in thread | raw e-mail | index | archive | help
adsharma@c62443-a.frmt1.sfba.home.com (Arun Sharma) writes: > 2. For cases where you've entered the kernel synchronously - through syscalls > for example, you need to check for the validity of data. You could > potentially skip the step and validate the data where it is used, rather > than doing it upfront - but that may mean too many checks. It's just > cleaner to copyin/copyout once at entry/exit, rather than repeating the > code all over the place. That's only part of the story. The copyin/copyout interface provides a portable interface. Some architectures have efficient ways of keeping separate user and kernel page tables, so they require that copyin/copyout be done using unusual methods for access. Additionally, you often want to access data in a section of code where page faulting is not acceptable. Accessing a non-wired memory address implicitly allows you to block. Recovering from fatal faults (translating them into errors) is hard to do properly in C... All methods of accessing user pages while avoiding faults are very slow. So copyin/copyout functions implemented in assembly language are probably the most convenient way of accessing user data in FreeBSD or any other similar kernel. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86puuwd7od.fsf>