ChangeSet 1.2231.1.46, 2005/03/28 19:29:31-08:00, [EMAIL PROTECTED] [PATCH] fix put_user for 80386 Linus noticed that put_user doesn't to the manual page table lookup that is required for cpus without a working WP flag. The solution is simple: if CONFIG_X86_WP_WORKS_OK is not set, then the put_user macros must call __copy_to_user_ll(). That function contains the required checks. This is already implemented for __put_user_size(), somehow I overlooked __put_user_{1,2,4,8,X}. Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
uaccess.h | 17 +++++++++++++++++ 1 files changed, 17 insertions(+) diff -Nru a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h --- a/include/asm-i386/uaccess.h 2005-03-28 21:16:25 -08:00 +++ b/include/asm-i386/uaccess.h 2005-03-28 21:16:25 -08:00 @@ -217,6 +217,8 @@ * * Returns zero on success, or -EFAULT on error. */ +#ifdef CONFIG_X86_WP_WORKS_OK + #define put_user(x,ptr) \ ({ int __ret_pu; \ __chk_user_ptr(ptr); \ @@ -229,6 +231,21 @@ } \ __ret_pu; \ }) + +#else +#define put_user(x,ptr) \ +({ \ + int __ret_pu; \ + __typeof__(*(ptr)) __pus_tmp = x; \ + __ret_pu=0; \ + if(unlikely(__copy_to_user_ll(ptr, &__pus_tmp, \ + sizeof(*(ptr))) != 0)) \ + __ret_pu=-EFAULT; \ + __ret_pu; \ + }) + + +#endif /** * __get_user: - Get a simple variable from user space, with less checking. - To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html