|
8 | 8 | #include <asm/extable.h> |
9 | 9 | #include <asm/kup.h> |
10 | 10 |
|
11 | | -/* |
12 | | - * The fs value determines whether argument validity checking should be |
13 | | - * performed or not. If get_fs() == USER_DS, checking is performed, with |
14 | | - * get_fs() == KERNEL_DS, checking is bypassed. |
15 | | - * |
16 | | - * For historical reasons, these macros are grossly misnamed. |
17 | | - * |
18 | | - * The fs/ds values are now the highest legal address in the "segment". |
19 | | - * This simplifies the checking in the routines below. |
20 | | - */ |
21 | | - |
22 | | -#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) |
23 | | - |
24 | | -#define KERNEL_DS MAKE_MM_SEG(~0UL) |
25 | 11 | #ifdef __powerpc64__ |
26 | 12 | /* We use TASK_SIZE_USER64 as TASK_SIZE is not constant */ |
27 | | -#define USER_DS MAKE_MM_SEG(TASK_SIZE_USER64 - 1) |
| 13 | +#define TASK_SIZE_MAX TASK_SIZE_USER64 |
28 | 14 | #else |
29 | | -#define USER_DS MAKE_MM_SEG(TASK_SIZE - 1) |
| 15 | +#define TASK_SIZE_MAX TASK_SIZE |
30 | 16 | #endif |
31 | 17 |
|
32 | | -#define get_fs() (current->thread.addr_limit) |
33 | | - |
34 | | -static inline void set_fs(mm_segment_t fs) |
| 18 | +static inline bool __access_ok(unsigned long addr, unsigned long size) |
35 | 19 | { |
36 | | - current->thread.addr_limit = fs; |
37 | | - /* On user-mode return check addr_limit (fs) is correct */ |
38 | | - set_thread_flag(TIF_FSCHECK); |
| 20 | + return addr < TASK_SIZE_MAX && size <= TASK_SIZE_MAX - addr; |
39 | 21 | } |
40 | 22 |
|
41 | | -#define uaccess_kernel() (get_fs().seg == KERNEL_DS.seg) |
42 | | -#define user_addr_max() (get_fs().seg) |
43 | | - |
44 | | -#ifdef __powerpc64__ |
45 | | -/* |
46 | | - * This check is sufficient because there is a large enough |
47 | | - * gap between user addresses and the kernel addresses |
48 | | - */ |
49 | | -#define __access_ok(addr, size, segment) \ |
50 | | - (((addr) <= (segment).seg) && ((size) <= (segment).seg)) |
51 | | - |
52 | | -#else |
53 | | - |
54 | | -static inline int __access_ok(unsigned long addr, unsigned long size, |
55 | | - mm_segment_t seg) |
56 | | -{ |
57 | | - if (addr > seg.seg) |
58 | | - return 0; |
59 | | - return (size == 0 || size - 1 <= seg.seg - addr); |
60 | | -} |
61 | | - |
62 | | -#endif |
63 | | - |
64 | 23 | #define access_ok(addr, size) \ |
65 | 24 | (__chk_user_ptr(addr), \ |
66 | | - __access_ok((__force unsigned long)(addr), (size), get_fs())) |
| 25 | + __access_ok((unsigned long)(addr), (size))) |
67 | 26 |
|
68 | 27 | /* |
69 | 28 | * These are the main single-value transfer routines. They automatically |
|
0 commit comments