uaccess.h (95a0c7c2d6cfde3fb5fdb713428ed0df4d6bdd58) uaccess.h (f5caf621ee357279e759c0911daf6d55c7d36f03)
1#ifndef _ASM_X86_UACCESS_H
2#define _ASM_X86_UACCESS_H
3/*
4 * User space memory access functions
5 */
6#include <linux/compiler.h>
7#include <linux/kasan-checks.h>
8#include <linux/string.h>

--- 12 unchanged lines hidden (view full) ---

21
22#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
23
24#define KERNEL_DS MAKE_MM_SEG(-1UL)
25#define USER_DS MAKE_MM_SEG(TASK_SIZE_MAX)
26
27#define get_ds() (KERNEL_DS)
28#define get_fs() (current->thread.addr_limit)
1#ifndef _ASM_X86_UACCESS_H
2#define _ASM_X86_UACCESS_H
3/*
4 * User space memory access functions
5 */
6#include <linux/compiler.h>
7#include <linux/kasan-checks.h>
8#include <linux/string.h>

--- 12 unchanged lines hidden (view full) ---

21
22#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
23
24#define KERNEL_DS MAKE_MM_SEG(-1UL)
25#define USER_DS MAKE_MM_SEG(TASK_SIZE_MAX)
26
27#define get_ds() (KERNEL_DS)
28#define get_fs() (current->thread.addr_limit)
29#define set_fs(x) (current->thread.addr_limit = (x))
29static inline void set_fs(mm_segment_t fs)
30{
31 current->thread.addr_limit = fs;
32 /* On user-mode return, check fs is correct */
33 set_thread_flag(TIF_FSCHECK);
34}
30
31#define segment_eq(a, b) ((a).seg == (b).seg)
32
33#define user_addr_max() (current->thread.addr_limit.seg)
34#define __addr_ok(addr) \
35 ((unsigned long __force)(addr) < user_addr_max())
36
37/*

--- 118 unchanged lines hidden (view full) ---

156 *
157 * Clang/LLVM cares about the size of the register, but still wants
158 * the base register for something that ends up being a pair.
159 */
160#define get_user(x, ptr) \
161({ \
162 int __ret_gu; \
163 register __inttype(*(ptr)) __val_gu asm("%"_ASM_DX); \
35
36#define segment_eq(a, b) ((a).seg == (b).seg)
37
38#define user_addr_max() (current->thread.addr_limit.seg)
39#define __addr_ok(addr) \
40 ((unsigned long __force)(addr) < user_addr_max())
41
42/*

--- 118 unchanged lines hidden (view full) ---

161 *
162 * Clang/LLVM cares about the size of the register, but still wants
163 * the base register for something that ends up being a pair.
164 */
165#define get_user(x, ptr) \
166({ \
167 int __ret_gu; \
168 register __inttype(*(ptr)) __val_gu asm("%"_ASM_DX); \
164 register void *__sp asm(_ASM_SP); \
165 __chk_user_ptr(ptr); \
166 might_fault(); \
167 asm volatile("call __get_user_%P4" \
169 __chk_user_ptr(ptr); \
170 might_fault(); \
171 asm volatile("call __get_user_%P4" \
168 : "=a" (__ret_gu), "=r" (__val_gu), "+r" (__sp) \
172 : "=a" (__ret_gu), "=r" (__val_gu), \
173 ASM_CALL_CONSTRAINT \
169 : "0" (ptr), "i" (sizeof(*(ptr)))); \
170 (x) = (__force __typeof__(*(ptr))) __val_gu; \
171 __builtin_expect(__ret_gu, 0); \
172})
173
174#define __put_user_x(size, x, ptr, __ret_pu) \
175 asm volatile("call __put_user_" #size : "=a" (__ret_pu) \
176 : "0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx")

--- 541 unchanged lines hidden ---
174 : "0" (ptr), "i" (sizeof(*(ptr)))); \
175 (x) = (__force __typeof__(*(ptr))) __val_gu; \
176 __builtin_expect(__ret_gu, 0); \
177})
178
179#define __put_user_x(size, x, ptr, __ret_pu) \
180 asm volatile("call __put_user_" #size : "=a" (__ret_pu) \
181 : "0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx")

--- 541 unchanged lines hidden ---