diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-24 18:10:28 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-24 18:10:28 -0400 |
commit | ce004178be1bbaa292e9e6497939e2970300095a (patch) | |
tree | 1cd5306548947deaedd612189b56d35265217e8e /arch/sparc/include | |
parent | 9978306e31a8f89bd81fbc4c49fd9aefb1d30d10 (diff) | |
parent | c5389831cda3b38a56606a348a537a1332f2d729 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
Pull sparc changes from David S. Miller:
"This has the generic strncpy_from_user() implementation architectures
can now use, which we've been developing on linux-arch over the past
few days.
For good measure I ran both a 32-bit and a 64-bit glibc testsuite run,
and the latter of which pointed out an adjustment I needed to make to
sparc's user_addr_max() definition. Linus, you were right, STACK_TOP
was not the right thing to use, even on sparc itself :-)
From Sam Ravnborg, we have a conversion of sparc32 over to the common
alloc_thread_info_node(), since the aspect which originally blocked
our doing so (sun4c) has been removed."
Fix up trivial arch/sparc/Kconfig and lib/Makefile conflicts.
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc:
sparc: Fix user_addr_max() definition.
lib: Sparc's strncpy_from_user is generic enough, move under lib/
kernel: Move REPEAT_BYTE definition into linux/kernel.h
sparc: Increase portability of strncpy_from_user() implementation.
sparc: Optimize strncpy_from_user() zero byte search.
sparc: Add full proper error handling to strncpy_from_user().
sparc32: use the common implementation of alloc_thread_info_node()
Diffstat (limited to 'arch/sparc/include')
-rw-r--r-- | arch/sparc/include/asm/processor_64.h | 4 | ||||
-rw-r--r-- | arch/sparc/include/asm/thread_info_32.h | 11 | ||||
-rw-r--r-- | arch/sparc/include/asm/uaccess.h | 6 | ||||
-rw-r--r-- | arch/sparc/include/asm/uaccess_32.h | 10 | ||||
-rw-r--r-- | arch/sparc/include/asm/uaccess_64.h | 4 |
5 files changed, 11 insertions, 24 deletions
diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h index 67df5cc1001..4e5a483122a 100644 --- a/arch/sparc/include/asm/processor_64.h +++ b/arch/sparc/include/asm/processor_64.h | |||
@@ -42,7 +42,9 @@ | |||
42 | #define TASK_SIZE_OF(tsk) \ | 42 | #define TASK_SIZE_OF(tsk) \ |
43 | (test_tsk_thread_flag(tsk,TIF_32BIT) ? \ | 43 | (test_tsk_thread_flag(tsk,TIF_32BIT) ? \ |
44 | (1UL << 32UL) : ((unsigned long)-VPTE_SIZE)) | 44 | (1UL << 32UL) : ((unsigned long)-VPTE_SIZE)) |
45 | #define TASK_SIZE TASK_SIZE_OF(current) | 45 | #define TASK_SIZE \ |
46 | (test_thread_flag(TIF_32BIT) ? \ | ||
47 | (1UL << 32UL) : ((unsigned long)-VPTE_SIZE)) | ||
46 | #ifdef __KERNEL__ | 48 | #ifdef __KERNEL__ |
47 | 49 | ||
48 | #define STACK_TOP32 ((1UL << 32UL) - PAGE_SIZE) | 50 | #define STACK_TOP32 ((1UL << 32UL) - PAGE_SIZE) |
diff --git a/arch/sparc/include/asm/thread_info_32.h b/arch/sparc/include/asm/thread_info_32.h index 21a38946541..5af66493245 100644 --- a/arch/sparc/include/asm/thread_info_32.h +++ b/arch/sparc/include/asm/thread_info_32.h | |||
@@ -77,18 +77,11 @@ register struct thread_info *current_thread_info_reg asm("g6"); | |||
77 | /* | 77 | /* |
78 | * thread information allocation | 78 | * thread information allocation |
79 | */ | 79 | */ |
80 | #define THREAD_INFO_ORDER 1 | 80 | #define THREAD_SIZE_ORDER 1 |
81 | |||
82 | struct thread_info * alloc_thread_info_node(struct task_struct *tsk, int node); | ||
83 | void free_thread_info(struct thread_info *); | ||
84 | 81 | ||
85 | #endif /* __ASSEMBLY__ */ | 82 | #endif /* __ASSEMBLY__ */ |
86 | 83 | ||
87 | /* | 84 | /* Size of kernel stack for each process */ |
88 | * Size of kernel stack for each process. | ||
89 | * Observe the order of get_free_pages() in alloc_thread_info_node(). | ||
90 | * The sun4 has 8K stack too, because it's short on memory, and 16K is a waste. | ||
91 | */ | ||
92 | #define THREAD_SIZE (2 * PAGE_SIZE) | 85 | #define THREAD_SIZE (2 * PAGE_SIZE) |
93 | 86 | ||
94 | /* | 87 | /* |
diff --git a/arch/sparc/include/asm/uaccess.h b/arch/sparc/include/asm/uaccess.h index e88fbe5c045..0167d26d0d1 100644 --- a/arch/sparc/include/asm/uaccess.h +++ b/arch/sparc/include/asm/uaccess.h | |||
@@ -5,4 +5,10 @@ | |||
5 | #else | 5 | #else |
6 | #include <asm/uaccess_32.h> | 6 | #include <asm/uaccess_32.h> |
7 | #endif | 7 | #endif |
8 | |||
9 | #define user_addr_max() \ | ||
10 | (segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL) | ||
11 | |||
12 | extern long strncpy_from_user(char *dest, const char __user *src, long count); | ||
13 | |||
8 | #endif | 14 | #endif |
diff --git a/arch/sparc/include/asm/uaccess_32.h b/arch/sparc/include/asm/uaccess_32.h index d50c310f5d3..59586b57ef1 100644 --- a/arch/sparc/include/asm/uaccess_32.h +++ b/arch/sparc/include/asm/uaccess_32.h | |||
@@ -304,16 +304,6 @@ static inline unsigned long clear_user(void __user *addr, unsigned long n) | |||
304 | return n; | 304 | return n; |
305 | } | 305 | } |
306 | 306 | ||
307 | extern long __strncpy_from_user(char *dest, const char __user *src, long count); | ||
308 | |||
309 | static inline long strncpy_from_user(char *dest, const char __user *src, long count) | ||
310 | { | ||
311 | if (__access_ok((unsigned long) src, count)) | ||
312 | return __strncpy_from_user(dest, src, count); | ||
313 | else | ||
314 | return -EFAULT; | ||
315 | } | ||
316 | |||
317 | extern long __strlen_user(const char __user *); | 307 | extern long __strlen_user(const char __user *); |
318 | extern long __strnlen_user(const char __user *, long len); | 308 | extern long __strnlen_user(const char __user *, long len); |
319 | 309 | ||
diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h index a1091afb883..dcdfb89cbf3 100644 --- a/arch/sparc/include/asm/uaccess_64.h +++ b/arch/sparc/include/asm/uaccess_64.h | |||
@@ -257,10 +257,6 @@ extern unsigned long __must_check __clear_user(void __user *, unsigned long); | |||
257 | 257 | ||
258 | #define clear_user __clear_user | 258 | #define clear_user __clear_user |
259 | 259 | ||
260 | extern long __must_check __strncpy_from_user(char *dest, const char __user *src, long count); | ||
261 | |||
262 | #define strncpy_from_user __strncpy_from_user | ||
263 | |||
264 | extern long __strlen_user(const char __user *); | 260 | extern long __strlen_user(const char __user *); |
265 | extern long __strnlen_user(const char __user *, long len); | 261 | extern long __strnlen_user(const char __user *, long len); |
266 | 262 | ||