Re: copy_from_user/copy_to_user question

From: Vinay Venkataraghavan
Date: Tue Dec 06 2005 - 12:52:34 EST



Thanks to Steve and everybody who sent such detailed
and timely responses to my question.

The motivation for the copy to user question is due to
the handling of ioctl calls in the driver for a chip
that is widely used. I just could not beleive that
they would/could commit such a mistake.

It looks like the old driver code still seems to work
even without performing copy_to_user and
copy_from_user.

But this brings about another scenario. What if the
case statement in the ioctl call only needs to have
access to the members of the structure passed in
through the arg pointer but does not need to modify
these values and return values.

Is this still a problem if copy_to_user and
copy_from_user is not used?

Thanks,
Vinay


--- Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> On Sat, 2005-12-03 at 15:35 -0700, Andi Kleen wrote:
> > Steven Rostedt <rostedt@xxxxxxxxxxx> writes:
> > >
> > > Nope, the kernel is always locked into memory.
> If you take a page fault
> > > from the kernel world, you will crash and burn.
> The kernel is never
> > > "swapped out". So if you are in kernel mode,
> going into do_page_fault
> > > in arch/i386/mm/fault.c there is no path to swap
> a page in.
> >
> > Actually there is - when the page fault was caused
> by *_user.
>
> Sorry I wasn't clearer. I know the copy_user case
> (and explained it in
> detail earlier in this thread). I was talking about
> what happens in the
> memcpy case. So that should have said "outside of
> copy_user and
> friends, there is no path to swap a page in".
>
> -- Steve
>
>
>




__________________________________________
Yahoo! DSL ? Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/