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 [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message