Re: userspace vs. kernelspace address

From: Jan Hudec
Date: Sun Jan 30 2005 - 03:44:00 EST


On Fri, Jan 28, 2005 at 20:23:55 -0800, Om wrote:
> On Fri, Jan 28, 2005 at 01:40:51PM -0800, Rock Gordon wrote:
> > Hi everbody,
> >
> > Thanks for your replies.
> >
> > However I think my copy_to_user and copy_from_user are
> > failing since the kernel-mode thread is copying data
> > into another process's address space, and I am not
> > sure how to do this. Do the get_fs() and set_fs()
> > combinations let you do that? If not, then how do I do
> My idea is on kernel thread is limited. But I think it is not possible to
> any userspace address from any kernel thread because they do not have access
> to it. Their proc_struct->mm field is empty.

Right. You can't access any user-space from kernel thread, because it
does not have any.

> I am not sure whether set_fs and get_fs help in this case.

Sure it can. set_fs(KERNEL_DS) sets things so, that if you pass kernel
address to copy_to/from_user, it will silently accept it and copy
to/from there.

-------------------------------------------------------------------------------
Jan 'Bulb' Hudec <bulb@xxxxxx>

Attachment: signature.asc
Description: Digital signature