Commit 31b1e940 authored by Christopher Covington's avatar Christopher Covington Committed by Catalin Marinas

arm64: Fix __range_ok macro

Without this, the following scenario is incorrectly determined
to be invalid.

addr 0x7f_ffffe000 size 8192 addr_limit 0x80_00000000

This behavior was observed while trying to vmsplice the stack
as part of a CRIU dump of a process on a system started with the
norandmaps kernel parameter.
Signed-off-by: default avatarChristopher Covington <cov@codeaurora.org>
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent 74397174
...@@ -83,7 +83,7 @@ static inline void set_fs(mm_segment_t fs) ...@@ -83,7 +83,7 @@ static inline void set_fs(mm_segment_t fs)
* Returns 1 if the range is valid, 0 otherwise. * Returns 1 if the range is valid, 0 otherwise.
* *
* This is equivalent to the following test: * This is equivalent to the following test:
* (u65)addr + (u65)size < (u65)current->addr_limit * (u65)addr + (u65)size <= current->addr_limit
* *
* This needs 65-bit arithmetic. * This needs 65-bit arithmetic.
*/ */
...@@ -91,7 +91,7 @@ static inline void set_fs(mm_segment_t fs) ...@@ -91,7 +91,7 @@ static inline void set_fs(mm_segment_t fs)
({ \ ({ \
unsigned long flag, roksum; \ unsigned long flag, roksum; \
__chk_user_ptr(addr); \ __chk_user_ptr(addr); \
asm("adds %1, %1, %3; ccmp %1, %4, #2, cc; cset %0, cc" \ asm("adds %1, %1, %3; ccmp %1, %4, #2, cc; cset %0, ls" \
: "=&r" (flag), "=&r" (roksum) \ : "=&r" (flag), "=&r" (roksum) \
: "1" (addr), "Ir" (size), \ : "1" (addr), "Ir" (size), \
"r" (current_thread_info()->addr_limit) \ "r" (current_thread_info()->addr_limit) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment