[lkml]   [2002]   [May]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectAUDIT: copy_from_user is a deathtrap.

Should I change copy_to/from_user to return -EFAULT, or
introduce a new copy_to/from_uspace which does and start moving
everything across?

There are 5,500 uses of copy_to/from_user in 2.5.15. 52 of them use
the return value in a way which would be broken by it returning
-EFAULT. 51 of those don't need to (mainly cut & paste between serial

/* Returns amount which wasn't copied before EFAULT. Used by mount. */
static inline unsigned long
gradual_copy_from_user(void *to, const void *from, unsigned long n)
unsigned long i;
for (i = 0; i < n; i++, to++, from++) {
if (copy_from_user(from, to, 1) != 0)
return n - i;
There are 415 uses of copy_to/from_user which are wrong, despite an
audit 12 months ago by the Stanford checker.

Tired of auditing the same bugs,
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:26    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean