Re: AUDIT: copy_from_user is a deathtrap.

Denis Vlasenko
2002-05-17T13:59:32Z

On 17 May 2002 10:58, Rusty Russell wrote:
> > > /* of course this returns 0 or -EFAULT! */
> > > return copy_from_user(xxx);
> >
> > So lets verify and fix them. Post the list to the kenrel janitors
>
> Again, like we did 12 months ago you mean?
>
> We could do that, or, we could fix the actual problem, which is the
> HUGE FUCKING BEARTRAP WHICH CATCHES EVERY SINGLE NEW PROGRAMMER ON THE
> WAY THROUGH.

Looks like it is waiting for me yet (if I'll ever do something useful
for lk).

> Not fixing earlier was criminal, not fixing it today is insane.

What's the problem? People don't understand what copy_x_user() returns
and how to check return value properly?

Maybe good function name(s) will help?

copy_{from,to}_user_and_count()

> There are 415 uses of copy_to/from_user which are wrong, despite an
> audit 12 months ago by the Stanford checker.

What are typical errors?
--
vda