diff options
-rw-r--r-- | arch/arm/kernel/armksyms.c | 10 | ||||
-rw-r--r-- | arch/arm/lib/clear_user.S | 4 | ||||
-rw-r--r-- | arch/arm/lib/copy_from_user.S | 4 | ||||
-rw-r--r-- | arch/arm/lib/copy_to_user.S | 4 | ||||
-rw-r--r-- | arch/arm/lib/strncpy_from_user.S | 2 | ||||
-rw-r--r-- | arch/arm/lib/strnlen_user.S | 4 | ||||
-rw-r--r-- | arch/arm/lib/uaccess.S | 8 | ||||
-rw-r--r-- | include/asm-arm/uaccess.h | 45 |
8 files changed, 31 insertions, 50 deletions
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c index c49b5d4d7fca..f8bb7abd3e9b 100644 --- a/arch/arm/kernel/armksyms.c +++ b/arch/arm/kernel/armksyms.c | |||
@@ -109,11 +109,11 @@ EXPORT_SYMBOL(memchr); | |||
109 | EXPORT_SYMBOL(__memzero); | 109 | EXPORT_SYMBOL(__memzero); |
110 | 110 | ||
111 | /* user mem (segment) */ | 111 | /* user mem (segment) */ |
112 | EXPORT_SYMBOL(__arch_copy_from_user); | 112 | EXPORT_SYMBOL(__copy_from_user); |
113 | EXPORT_SYMBOL(__arch_copy_to_user); | 113 | EXPORT_SYMBOL(__copy_to_user); |
114 | EXPORT_SYMBOL(__arch_clear_user); | 114 | EXPORT_SYMBOL(__clear_user); |
115 | EXPORT_SYMBOL(__arch_strnlen_user); | 115 | EXPORT_SYMBOL(__strnlen_user); |
116 | EXPORT_SYMBOL(__arch_strncpy_from_user); | 116 | EXPORT_SYMBOL(__strncpy_from_user); |
117 | 117 | ||
118 | EXPORT_SYMBOL(__get_user_1); | 118 | EXPORT_SYMBOL(__get_user_1); |
119 | EXPORT_SYMBOL(__get_user_2); | 119 | EXPORT_SYMBOL(__get_user_2); |
diff --git a/arch/arm/lib/clear_user.S b/arch/arm/lib/clear_user.S index ea435ae2e4a5..ecb28dcdaf7b 100644 --- a/arch/arm/lib/clear_user.S +++ b/arch/arm/lib/clear_user.S | |||
@@ -12,13 +12,13 @@ | |||
12 | 12 | ||
13 | .text | 13 | .text |
14 | 14 | ||
15 | /* Prototype: int __arch_clear_user(void *addr, size_t sz) | 15 | /* Prototype: int __clear_user(void *addr, size_t sz) |
16 | * Purpose : clear some user memory | 16 | * Purpose : clear some user memory |
17 | * Params : addr - user memory address to clear | 17 | * Params : addr - user memory address to clear |
18 | * : sz - number of bytes to clear | 18 | * : sz - number of bytes to clear |
19 | * Returns : number of bytes NOT cleared | 19 | * Returns : number of bytes NOT cleared |
20 | */ | 20 | */ |
21 | ENTRY(__arch_clear_user) | 21 | ENTRY(__clear_user) |
22 | stmfd sp!, {r1, lr} | 22 | stmfd sp!, {r1, lr} |
23 | mov r2, #0 | 23 | mov r2, #0 |
24 | cmp r1, #4 | 24 | cmp r1, #4 |
diff --git a/arch/arm/lib/copy_from_user.S b/arch/arm/lib/copy_from_user.S index 7497393a0e81..6b7363ce749c 100644 --- a/arch/arm/lib/copy_from_user.S +++ b/arch/arm/lib/copy_from_user.S | |||
@@ -16,7 +16,7 @@ | |||
16 | /* | 16 | /* |
17 | * Prototype: | 17 | * Prototype: |
18 | * | 18 | * |
19 | * size_t __arch_copy_from_user(void *to, const void *from, size_t n) | 19 | * size_t __copy_from_user(void *to, const void *from, size_t n) |
20 | * | 20 | * |
21 | * Purpose: | 21 | * Purpose: |
22 | * | 22 | * |
@@ -83,7 +83,7 @@ | |||
83 | 83 | ||
84 | .text | 84 | .text |
85 | 85 | ||
86 | ENTRY(__arch_copy_from_user) | 86 | ENTRY(__copy_from_user) |
87 | 87 | ||
88 | #include "copy_template.S" | 88 | #include "copy_template.S" |
89 | 89 | ||
diff --git a/arch/arm/lib/copy_to_user.S b/arch/arm/lib/copy_to_user.S index 4a6d8ea14022..5224d94688d9 100644 --- a/arch/arm/lib/copy_to_user.S +++ b/arch/arm/lib/copy_to_user.S | |||
@@ -16,7 +16,7 @@ | |||
16 | /* | 16 | /* |
17 | * Prototype: | 17 | * Prototype: |
18 | * | 18 | * |
19 | * size_t __arch_copy_to_user(void *to, const void *from, size_t n) | 19 | * size_t __copy_to_user(void *to, const void *from, size_t n) |
20 | * | 20 | * |
21 | * Purpose: | 21 | * Purpose: |
22 | * | 22 | * |
@@ -86,7 +86,7 @@ | |||
86 | 86 | ||
87 | .text | 87 | .text |
88 | 88 | ||
89 | ENTRY(__arch_copy_to_user) | 89 | ENTRY(__copy_to_user) |
90 | 90 | ||
91 | #include "copy_template.S" | 91 | #include "copy_template.S" |
92 | 92 | ||
diff --git a/arch/arm/lib/strncpy_from_user.S b/arch/arm/lib/strncpy_from_user.S index 35649f04fcac..36e3741a3772 100644 --- a/arch/arm/lib/strncpy_from_user.S +++ b/arch/arm/lib/strncpy_from_user.S | |||
@@ -20,7 +20,7 @@ | |||
20 | * returns the number of characters copied (strlen of copied string), | 20 | * returns the number of characters copied (strlen of copied string), |
21 | * -EFAULT on exception, or "len" if we fill the whole buffer | 21 | * -EFAULT on exception, or "len" if we fill the whole buffer |
22 | */ | 22 | */ |
23 | ENTRY(__arch_strncpy_from_user) | 23 | ENTRY(__strncpy_from_user) |
24 | mov ip, r1 | 24 | mov ip, r1 |
25 | 1: subs r2, r2, #1 | 25 | 1: subs r2, r2, #1 |
26 | USER( ldrplbt r3, [r1], #1) | 26 | USER( ldrplbt r3, [r1], #1) |
diff --git a/arch/arm/lib/strnlen_user.S b/arch/arm/lib/strnlen_user.S index 3668a15991ef..18d8fa4f925a 100644 --- a/arch/arm/lib/strnlen_user.S +++ b/arch/arm/lib/strnlen_user.S | |||
@@ -14,13 +14,13 @@ | |||
14 | .text | 14 | .text |
15 | .align 5 | 15 | .align 5 |
16 | 16 | ||
17 | /* Prototype: unsigned long __arch_strnlen_user(const char *str, long n) | 17 | /* Prototype: unsigned long __strnlen_user(const char *str, long n) |
18 | * Purpose : get length of a string in user memory | 18 | * Purpose : get length of a string in user memory |
19 | * Params : str - address of string in user memory | 19 | * Params : str - address of string in user memory |
20 | * Returns : length of string *including terminator* | 20 | * Returns : length of string *including terminator* |
21 | * or zero on exception, or n + 1 if too long | 21 | * or zero on exception, or n + 1 if too long |
22 | */ | 22 | */ |
23 | ENTRY(__arch_strnlen_user) | 23 | ENTRY(__strnlen_user) |
24 | mov r2, r0 | 24 | mov r2, r0 |
25 | 1: | 25 | 1: |
26 | USER( ldrbt r3, [r0], #1) | 26 | USER( ldrbt r3, [r0], #1) |
diff --git a/arch/arm/lib/uaccess.S b/arch/arm/lib/uaccess.S index 1f1545d737be..b48bd6d5fd83 100644 --- a/arch/arm/lib/uaccess.S +++ b/arch/arm/lib/uaccess.S | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | #define PAGE_SHIFT 12 | 20 | #define PAGE_SHIFT 12 |
21 | 21 | ||
22 | /* Prototype: int __arch_copy_to_user(void *to, const char *from, size_t n) | 22 | /* Prototype: int __copy_to_user(void *to, const char *from, size_t n) |
23 | * Purpose : copy a block to user memory from kernel memory | 23 | * Purpose : copy a block to user memory from kernel memory |
24 | * Params : to - user memory | 24 | * Params : to - user memory |
25 | * : from - kernel memory | 25 | * : from - kernel memory |
@@ -39,7 +39,7 @@ USER( strgtbt r3, [r0], #1) @ May fault | |||
39 | sub r2, r2, ip | 39 | sub r2, r2, ip |
40 | b .Lc2u_dest_aligned | 40 | b .Lc2u_dest_aligned |
41 | 41 | ||
42 | ENTRY(__arch_copy_to_user) | 42 | ENTRY(__copy_to_user) |
43 | stmfd sp!, {r2, r4 - r7, lr} | 43 | stmfd sp!, {r2, r4 - r7, lr} |
44 | cmp r2, #4 | 44 | cmp r2, #4 |
45 | blt .Lc2u_not_enough | 45 | blt .Lc2u_not_enough |
@@ -283,7 +283,7 @@ USER( strgtbt r3, [r0], #1) @ May fault | |||
283 | 9001: ldmfd sp!, {r0, r4 - r7, pc} | 283 | 9001: ldmfd sp!, {r0, r4 - r7, pc} |
284 | .previous | 284 | .previous |
285 | 285 | ||
286 | /* Prototype: unsigned long __arch_copy_from_user(void *to,const void *from,unsigned long n); | 286 | /* Prototype: unsigned long __copy_from_user(void *to,const void *from,unsigned long n); |
287 | * Purpose : copy a block from user memory to kernel memory | 287 | * Purpose : copy a block from user memory to kernel memory |
288 | * Params : to - kernel memory | 288 | * Params : to - kernel memory |
289 | * : from - user memory | 289 | * : from - user memory |
@@ -302,7 +302,7 @@ USER( ldrgtbt r3, [r1], #1) @ May fault | |||
302 | sub r2, r2, ip | 302 | sub r2, r2, ip |
303 | b .Lcfu_dest_aligned | 303 | b .Lcfu_dest_aligned |
304 | 304 | ||
305 | ENTRY(__arch_copy_from_user) | 305 | ENTRY(__copy_from_user) |
306 | stmfd sp!, {r0, r2, r4 - r7, lr} | 306 | stmfd sp!, {r0, r2, r4 - r7, lr} |
307 | cmp r2, #4 | 307 | cmp r2, #4 |
308 | blt .Lcfu_not_enough | 308 | blt .Lcfu_not_enough |
diff --git a/include/asm-arm/uaccess.h b/include/asm-arm/uaccess.h index 064f0f5e8e2b..f909dc75301a 100644 --- a/include/asm-arm/uaccess.h +++ b/include/asm-arm/uaccess.h | |||
@@ -353,66 +353,47 @@ do { \ | |||
353 | : "r" (x), "i" (-EFAULT) \ | 353 | : "r" (x), "i" (-EFAULT) \ |
354 | : "cc") | 354 | : "cc") |
355 | 355 | ||
356 | extern unsigned long __arch_copy_from_user(void *to, const void __user *from, unsigned long n); | 356 | |
357 | extern unsigned long __arch_copy_to_user(void __user *to, const void *from, unsigned long n); | 357 | extern unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n); |
358 | extern unsigned long __arch_clear_user(void __user *addr, unsigned long n); | 358 | extern unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n); |
359 | extern unsigned long __arch_strncpy_from_user(char *to, const char __user *from, unsigned long count); | 359 | extern unsigned long __clear_user(void __user *addr, unsigned long n); |
360 | extern unsigned long __arch_strnlen_user(const char __user *s, long n); | 360 | extern unsigned long __strncpy_from_user(char *to, const char __user *from, unsigned long count); |
361 | extern unsigned long __strnlen_user(const char __user *s, long n); | ||
361 | 362 | ||
362 | static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) | 363 | static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) |
363 | { | 364 | { |
364 | if (access_ok(VERIFY_READ, from, n)) | 365 | if (access_ok(VERIFY_READ, from, n)) |
365 | n = __arch_copy_from_user(to, from, n); | 366 | n = __copy_from_user(to, from, n); |
366 | else /* security hole - plug it */ | 367 | else /* security hole - plug it */ |
367 | memzero(to, n); | 368 | memzero(to, n); |
368 | return n; | 369 | return n; |
369 | } | 370 | } |
370 | 371 | ||
371 | static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n) | ||
372 | { | ||
373 | return __arch_copy_from_user(to, from, n); | ||
374 | } | ||
375 | |||
376 | static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) | 372 | static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) |
377 | { | 373 | { |
378 | if (access_ok(VERIFY_WRITE, to, n)) | 374 | if (access_ok(VERIFY_WRITE, to, n)) |
379 | n = __arch_copy_to_user(to, from, n); | 375 | n = __copy_to_user(to, from, n); |
380 | return n; | 376 | return n; |
381 | } | 377 | } |
382 | 378 | ||
383 | static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n) | ||
384 | { | ||
385 | return __arch_copy_to_user(to, from, n); | ||
386 | } | ||
387 | |||
388 | #define __copy_to_user_inatomic __copy_to_user | 379 | #define __copy_to_user_inatomic __copy_to_user |
389 | #define __copy_from_user_inatomic __copy_from_user | 380 | #define __copy_from_user_inatomic __copy_from_user |
390 | 381 | ||
391 | static inline unsigned long clear_user (void __user *to, unsigned long n) | 382 | static inline unsigned long clear_user(void __user *to, unsigned long n) |
392 | { | 383 | { |
393 | if (access_ok(VERIFY_WRITE, to, n)) | 384 | if (access_ok(VERIFY_WRITE, to, n)) |
394 | n = __arch_clear_user(to, n); | 385 | n = __clear_user(to, n); |
395 | return n; | 386 | return n; |
396 | } | 387 | } |
397 | 388 | ||
398 | static inline unsigned long __clear_user (void __user *to, unsigned long n) | 389 | static inline long strncpy_from_user(char *dst, const char __user *src, long count) |
399 | { | ||
400 | return __arch_clear_user(to, n); | ||
401 | } | ||
402 | |||
403 | static inline long strncpy_from_user (char *dst, const char __user *src, long count) | ||
404 | { | 390 | { |
405 | long res = -EFAULT; | 391 | long res = -EFAULT; |
406 | if (access_ok(VERIFY_READ, src, 1)) | 392 | if (access_ok(VERIFY_READ, src, 1)) |
407 | res = __arch_strncpy_from_user(dst, src, count); | 393 | res = __strncpy_from_user(dst, src, count); |
408 | return res; | 394 | return res; |
409 | } | 395 | } |
410 | 396 | ||
411 | static inline long __strncpy_from_user (char *dst, const char __user *src, long count) | ||
412 | { | ||
413 | return __arch_strncpy_from_user(dst, src, count); | ||
414 | } | ||
415 | |||
416 | #define strlen_user(s) strnlen_user(s, ~0UL >> 1) | 397 | #define strlen_user(s) strnlen_user(s, ~0UL >> 1) |
417 | 398 | ||
418 | static inline long strnlen_user(const char __user *s, long n) | 399 | static inline long strnlen_user(const char __user *s, long n) |
@@ -420,7 +401,7 @@ static inline long strnlen_user(const char __user *s, long n) | |||
420 | unsigned long res = 0; | 401 | unsigned long res = 0; |
421 | 402 | ||
422 | if (__addr_ok(s)) | 403 | if (__addr_ok(s)) |
423 | res = __arch_strnlen_user(s, n); | 404 | res = __strnlen_user(s, n); |
424 | 405 | ||
425 | return res; | 406 | return res; |
426 | } | 407 | } |