[kernel] r5573 - dists/trunk/arch/mips/linux-patch-2.6.15-mips-2.6.15/debian/patches

Martin Michlmayr tbm at costa.debian.org
Mon Jan 23 18:35:55 UTC 2006


Author: tbm
Date: Mon Jan 23 18:35:55 2006
New Revision: 5573

Modified:
   dists/trunk/arch/mips/linux-patch-2.6.15-mips-2.6.15/debian/patches/66_uaccess_ro_fix.dpatch
Log:
new patch


Modified: dists/trunk/arch/mips/linux-patch-2.6.15-mips-2.6.15/debian/patches/66_uaccess_ro_fix.dpatch
==============================================================================
--- dists/trunk/arch/mips/linux-patch-2.6.15-mips-2.6.15/debian/patches/66_uaccess_ro_fix.dpatch	(original)
+++ dists/trunk/arch/mips/linux-patch-2.6.15-mips-2.6.15/debian/patches/66_uaccess_ro_fix.dpatch	Mon Jan 23 18:35:55 2006
@@ -1,9 +1,19 @@
 #! /bin/sh -e
-## 66_uaccess_ro_fix.dpatch by Stuart Anderson <anderson at netsweng.com>
+## 66_uaccess_ro_fix.dpatch by Ralf Baechle <ralf at linux-mips.org>
 ##
-## DP: Fix compiler error in fs/compat_ioctl.o
-## DP: Upstream status: vetoed by Ralf but needed to build.  Being worked on
-##       http://www.linux-mips.org/archives/linux-mips/2006-01/msg00200.html
+## DP: Bullet proof uaccess.h against 4.0.1 miss-compilation.
+## DP: Upstream status: in linux-mips git
+
+# commit 9b82f61fe60236eb08e1faecc64dcb82e6761aa2
+# Author: Ralf Baechle <ralf at linux-mips.org>
+# Date:   Mon Jan 23 16:15:30 2006 +0000
+
+#    Bullet proof uaccess.h against 4.0.1 miss-compilation.
+
+#    Signed-off-by: Ralf Baechle <ralf at linux-mips.org>
+
+# Among other things, fixes the following error on 64 bit kernel with compat
+# mode:
 
 #   CC      fs/compat_ioctl.o
 # fs/compat_ioctl.c: In function 'fd_ioctl_trans':
@@ -32,48 +42,131 @@
 
 exit 0
 
-diff -urN linux-mips/include/asm-mips/uaccess.h new/include/asm-mips/uaccess.h
---- linux-mips/include/asm-mips/uaccess.h	2006-01-10 11:21:59.000000000 +0000
-+++ new/include/asm-mips/uaccess.h	2006-01-18 14:28:43.000000000 +0000
-@@ -210,17 +210,35 @@
+diff --git a/include/asm-mips/uaccess.h b/include/asm-mips/uaccess.h
+index 41bb96b..6c1c495 100644
+--- a/include/asm-mips/uaccess.h
++++ b/include/asm-mips/uaccess.h
+@@ -202,49 +202,49 @@ struct __large_struct { unsigned long bu
+  * Yuck.  We need two variants, one for 64bit operation and one
+  * for 32 bit mode and old iron.
+  */
+-#ifdef __mips64
+-#define __GET_USER_DW(ptr) __get_user_asm("ld", ptr)
+-#else
+-#define __GET_USER_DW(ptr) __get_user_asm_ll32(ptr)
++#ifdef CONFIG_32BIT
++#define __GET_USER_DW(val, ptr) __get_user_asm_ll32(val, ptr)
++#endif
++#ifdef CONFIG_64BIT
++#define __GET_USER_DW(val, ptr) __get_user_asm(val, "ld", ptr)
+ #endif
  
- #define __get_user_nocheck(x,ptr,size)					\
- ({									\
+-#define __get_user_nocheck(x,ptr,size)					\
+-({									\
 -	__typeof(*(ptr)) __gu_val =  (__typeof(*(ptr))) 0;		\
- 	long __gu_err = 0;						\
- 									\
+-	long __gu_err = 0;						\
+-									\
++extern void __get_user_unknown(void);
++
++#define __get_user_common(val, size, ptr)				\
++do {									\
  	switch (size) {							\
 -	case 1: __get_user_asm("lb", ptr); break;			\
 -	case 2: __get_user_asm("lh", ptr); break;			\
 -	case 4: __get_user_asm("lw", ptr); break;			\
 -	case 8: __GET_USER_DW(ptr); break;				\
-+	case 1: {							\
-+		s8 __gu_val =  (s8) 0;					\
-+		__get_user_asm("lb", ptr); 				\
-+		(x) = (__typeof__(*(ptr))) __gu_val;			\
-+		break;							\
-+		}							\
-+	case 2:	{							\
-+		s16 __gu_val =  (s16) 0;				\
-+		__get_user_asm("lh", ptr);				\
-+		(x) = (__typeof__(*(ptr))) __gu_val;			\
-+		break;							\
-+		}							\
-+	case 4:	{							\
-+		s32 __gu_val = (s32) 0;					\
-+		__get_user_asm("lw", ptr);				\
-+		(x) = (__typeof__(*(ptr))) __gu_val;			\
-+		break;							\
-+		}							\
-+	case 8:	{							\
-+		s64 __gu_val = (s64) 0;					\
-+		__GET_USER_DW(ptr);					\
-+		(x) = (__typeof__(*(ptr))) __gu_val;			\
-+		break;							\
-+		}							\
++	case 1: __get_user_asm(val, "lb", ptr); break;			\
++	case 2: __get_user_asm(val, "lh", ptr); break;			\
++	case 4: __get_user_asm(val, "lw", ptr); break;			\
++	case 8: __GET_USER_DW(val, ptr); break;				\
  	default: __get_user_unknown(); break;				\
  	}								\
 -	(x) = (__typeof__(*(ptr))) __gu_val;				\
++} while (0)
++
++#define __get_user_nocheck(x,ptr,size)					\
++({									\
++	long __gu_err;							\
++									\
++	__get_user_common((x), size, ptr);				\
  	__gu_err;							\
  })
  
+ #define __get_user_check(x,ptr,size)					\
+ ({									\
+-	const __typeof__(*(ptr)) __user * __gu_addr = (ptr);		\
+-	__typeof__(*(ptr)) __gu_val = 0;				\
+ 	long __gu_err = -EFAULT;					\
++	const void * __gu_ptr = (ptr);					\
++									\
++	if (likely(access_ok(VERIFY_READ,  __gu_ptr, size)))		\
++		__get_user_common((x), size, __gu_ptr);			\
+ 									\
+-	if (likely(access_ok(VERIFY_READ,  __gu_addr, size))) {		\
+-		switch (size) {						\
+-		case 1: __get_user_asm("lb", __gu_addr); break;		\
+-		case 2: __get_user_asm("lh", __gu_addr); break;		\
+-		case 4: __get_user_asm("lw", __gu_addr); break;		\
+-		case 8: __GET_USER_DW(__gu_addr); break;		\
+-		default: __get_user_unknown(); break;			\
+-		}							\
+-	}								\
+-	(x) = (__typeof__(*(ptr))) __gu_val;				\
+ 	__gu_err;							\
+ })
+ 
+-#define __get_user_asm(insn, addr)					\
++#define __get_user_asm(val, insn, addr)					\
+ {									\
++	long __gu_tmp;							\
++									\
+ 	__asm__ __volatile__(						\
+ 	"1:	" insn "	%1, %3				\n"	\
+ 	"2:							\n"	\
+@@ -255,14 +255,16 @@ struct __large_struct { unsigned long bu
+ 	"	.section __ex_table,\"a\"			\n"	\
+ 	"	"__UA_ADDR "\t1b, 3b				\n"	\
+ 	"	.previous					\n"	\
+-	: "=r" (__gu_err), "=r" (__gu_val)				\
++	: "=r" (__gu_err), "=r" (__gu_tmp)				\
+ 	: "0" (0), "o" (__m(addr)), "i" (-EFAULT));			\
++									\
++	(val) = (__typeof__(val)) __gu_tmp;				\
+ }
+ 
+ /*
+  * Get a long long 64 using 32 bit registers.
+  */
+-#define __get_user_asm_ll32(addr)					\
++#define __get_user_asm_ll32(val, addr)					\
+ {									\
+ 	__asm__ __volatile__(						\
+ 	"1:	lw	%1, (%3)				\n"	\
+@@ -278,21 +280,20 @@ struct __large_struct { unsigned long bu
+ 	"	" __UA_ADDR "	1b, 4b				\n"	\
+ 	"	" __UA_ADDR "	2b, 4b				\n"	\
+ 	"	.previous					\n"	\
+-	: "=r" (__gu_err), "=&r" (__gu_val)				\
++	: "=r" (__gu_err), "=&r" (val)					\
+ 	: "0" (0), "r" (addr), "i" (-EFAULT));				\
+ }
+ 
+-extern void __get_user_unknown(void);
+-
+ /*
+  * Yuck.  We need two variants, one for 64bit operation and one
+  * for 32 bit mode and old iron.
+  */
+-#ifdef __mips64
+-#define __PUT_USER_DW(ptr) __put_user_asm("sd", ptr)
+-#else
++#ifdef CONFIG_32BIT
+ #define __PUT_USER_DW(ptr) __put_user_asm_ll32(ptr)
+ #endif
++#ifdef CONFIG_64BIT
++#define __PUT_USER_DW(ptr) __put_user_asm("sd", ptr)
++#endif
+ 
+ #define __put_user_nocheck(x,ptr,size)					\
+ ({									\
+



More information about the Kernel-svn-changes mailing list