Date: Wed, 19 Jan 2000 18:14:10 -0800 From: Arun Sharma <adsharma@c62443-a.frmt1.sfba.home.com> To: zzhang@cs.binghamton.edu, hackers@freebsd.org Subject: Re: Accessing user data from kernel Message-ID: <200001200214.SAA17214@c62443-a.frmt1.sfba.home.com> In-Reply-To: <Pine.GSO.3.96.1000119104033.19800B-100000@sol.cs.binghamton.edu> References: <Pine.GSO.3.96.1000119104033.19800B-100000@sol.cs.binghamton.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
In muc.lists.freebsd.hackers, you wrote: > > When the kernel wants to access any user data, it either copies them into > the kernel or maps them into kernel address space. Can anyone tell me the > reasons why this is done? When a process enters the kernel mode, the > page tables are not changed. > > I have taken this for granted for a long time without knowing the reasons. 1. The kernel may be entered asynchronously - from interrupts and traps. You can't always be sure of which is the currently running user process. 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. -Arun 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?200001200214.SAA17214>