diff options
| author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2014-06-05 04:23:10 -0400 |
|---|---|---|
| committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2014-07-01 05:12:09 -0400 |
| commit | 83de911cf897a4317147dd9cb379378c2c4abf4c (patch) | |
| tree | 0bb9d0b05dce7d740a4d98885a8b44c316e1c5d5 | |
| parent | 03eca200064381d05a54126a711203d443508d80 (diff) | |
ARM: make user_addr_max more robust
With CONFIG_MMU=y get_fs() returns current_thread_info()->addr_limit
which is initialized as USER_DS (which in turn is defined to TASK_SIZE)
for userspace processes. At least theoretically
current_thread_info()->addr_limit is changable by set_fs() to a
different limit, so checking for KERNEL_DS is more robust.
With !CONFIG_MMU get_fs returns KERNEL_DS. To see what the old variant
did you'd have to find out that USER_DS == KERNEL_DS which isn't needed
any more with the variant this patch introduces. So it's a bit easier to
understand, too.
Also if the limit was changed this limit should be returned, not
TASK_SIZE.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
| -rw-r--r-- | arch/arm/include/asm/uaccess.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h index 75d95799b6e6..fd42da46828d 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h | |||
| @@ -224,7 +224,7 @@ static inline void set_fs(mm_segment_t fs) | |||
| 224 | #define access_ok(type,addr,size) (__range_ok(addr,size) == 0) | 224 | #define access_ok(type,addr,size) (__range_ok(addr,size) == 0) |
| 225 | 225 | ||
| 226 | #define user_addr_max() \ | 226 | #define user_addr_max() \ |
| 227 | (segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL) | 227 | (segment_eq(get_fs(), KERNEL_DS) ? ~0UL : get_fs()) |
| 228 | 228 | ||
| 229 | /* | 229 | /* |
| 230 | * The "__xxx" versions of the user access functions do not verify the | 230 | * The "__xxx" versions of the user access functions do not verify the |
