Re: convert_fxsr_from_user

Andrew Morton (akpm@digeo.com)
Tue, 8 Apr 2003 16:51:13 -0700


Dave Jones <davej@codemonkey.org.uk> wrote:
>
> Andrew,
> A while back you optimised this routine to not do lots of memory
> copies. I've noticed it does no checking on the validity of the
> addresses it dereferences from userspace.

It never has performed those checks. The check is in the caller,
arch/i386/kernel/signal.c:restore_i387.

Bless you for merging Jon's uaccess.h documentation patch.

My __get_user()'s are arse-about.

diff -puN arch/i386/kernel/i387.c~convert_fxsr_from_user-get_user-fixes arch/i386/kernel/i387.c
--- 25/arch/i386/kernel/i387.c~convert_fxsr_from_user-get_user-fixes Tue Apr 8 16:47:08 2003
+++ 25-akpm/arch/i386/kernel/i387.c Tue Apr 8 16:48:13 2003
@@ -275,9 +275,9 @@ static int convert_fxsr_from_user( struc
unsigned long *t = (unsigned long *)to;
unsigned long *f = (unsigned long *)from;

- if (__get_user(*f, t) ||
- __get_user(*(f + 1), t + 1) ||
- __get_user(from->exponent, &to->exponent))
+ if (__get_user(*t, f) ||
+ __get_user(*(t + 1), f + 1) ||
+ __get_user(to->exponent, &from->exponent))
return 1;
}
return 0;

_

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