Commit 4cb6066af9ee58ddba58a63cc77b324ac21add75

Authored by David S. Miller
1 parent b11287e8c5

sparc: Kill user copy check code.

For whatever reason GCC isn't able to figure things out in
the control flow (in particular when min() and max() expressions
are involved) on sparc as well as it can on x86.

So lots of useless incorrect user copy warnings get spewed and the
full-on compile failure mode of the user copy checks were never usable
on sparc at all.

People can debug these kinds of problems on x86.

Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 3 changed files with 5 additions and 47 deletions Side-by-side Diff

arch/sparc/Kconfig.debug
... ... @@ -30,19 +30,5 @@
30 30 depends on MCOUNT
31 31 default y
32 32  
33   -config DEBUG_STRICT_USER_COPY_CHECKS
34   - bool "Strict copy size checks"
35   - depends on DEBUG_KERNEL && !TRACE_BRANCH_PROFILING
36   - ---help---
37   - Enabling this option turns a certain set of sanity checks for user
38   - copy operations into compile time failures.
39   -
40   - The copy_from_user() etc checks are there to help test if there
41   - are sufficient security checks on the length argument of
42   - the copy operation, by having gcc prove that the argument is
43   - within bounds.
44   -
45   - If unsure, or if you run an older (pre 4.4) gcc, say N.
46   -
47 33 endmenu
arch/sparc/include/asm/uaccess_32.h
... ... @@ -260,23 +260,8 @@
260 260 return __copy_user(to, (__force void __user *) from, n);
261 261 }
262 262  
263   -extern void copy_from_user_overflow(void)
264   -#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
265   - __compiletime_error("copy_from_user() buffer size is not provably correct")
266   -#else
267   - __compiletime_warning("copy_from_user() buffer size is not provably correct")
268   -#endif
269   -;
270   -
271 263 static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n)
272 264 {
273   - int sz = __compiletime_object_size(to);
274   -
275   - if (unlikely(sz != -1 && sz < n)) {
276   - copy_from_user_overflow();
277   - return n;
278   - }
279   -
280 265 if (n && __access_ok((unsigned long) from, n))
281 266 return __copy_user((__force void __user *) to, from, n);
282 267 else
arch/sparc/include/asm/uaccess_64.h
... ... @@ -205,14 +205,6 @@
205 205  
206 206 extern int __get_user_bad(void);
207 207  
208   -extern void copy_from_user_overflow(void)
209   -#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
210   - __compiletime_error("copy_from_user() buffer size is not provably correct")
211   -#else
212   - __compiletime_warning("copy_from_user() buffer size is not provably correct")
213   -#endif
214   -;
215   -
216 208 extern unsigned long __must_check ___copy_from_user(void *to,
217 209 const void __user *from,
218 210 unsigned long size);
219 211  
... ... @@ -221,16 +213,11 @@
221 213 static inline unsigned long __must_check
222 214 copy_from_user(void *to, const void __user *from, unsigned long size)
223 215 {
224   - int sz = __compiletime_object_size(to);
225   - unsigned long ret = size;
  216 + unsigned long ret = ___copy_from_user(to, from, size);
226 217  
227   - if (likely(sz == -1 || sz >= size)) {
228   - ret = ___copy_from_user(to, from, size);
229   - if (unlikely(ret))
230   - ret = copy_from_user_fixup(to, from, size);
231   - } else {
232   - copy_from_user_overflow();
233   - }
  218 + if (unlikely(ret))
  219 + ret = copy_from_user_fixup(to, from, size);
  220 +
234 221 return ret;
235 222 }
236 223 #define __copy_from_user copy_from_user