On Mon, 2 Jul 2007, Nicolas Cormier wrote:

I am trying to map some data allocated in kernel to a user process (via a syscall). I need the proc's vmspace, but the value of p_vmspace of the input proc argument is NULL ... How can I get a valid vmspace ?

When operating in a system call, the 'td' argument to the system call function is the current thread pointer. You can follow td->td_proc to get to the current process (and therefore, its address space). In general, I prefer mapping user pages into kernel instead of kernel pages into user space, as it reduces the chances of leakage of kernel data to user space, and there are some useful primitives for making this easier. For example, take a look at the sf_buf infrastructure used for things like socket zero-copy send, which manages a temporary kernel mapping for a page.

Robert N M Watson
Computer Laboratory
University of Cambridge
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to