|
@@ -762,5 +762,30 @@ copy_to_user(void __user *to, const void *from, unsigned long n)
|
|
|
#undef __copy_from_user_overflow
|
|
|
#undef __copy_to_user_overflow
|
|
|
|
|
|
+/*
|
|
|
+ * The "unsafe" user accesses aren't really "unsafe", but the naming
|
|
|
+ * is a big fat warning: you have to not only do the access_ok()
|
|
|
+ * checking before using them, but you have to surround them with the
|
|
|
+ * user_access_begin/end() pair.
|
|
|
+ */
|
|
|
+#define user_access_begin() __uaccess_begin()
|
|
|
+#define user_access_end() __uaccess_end()
|
|
|
+
|
|
|
+#define unsafe_put_user(x, ptr) \
|
|
|
+({ \
|
|
|
+ int __pu_err; \
|
|
|
+ __put_user_size((x), (ptr), sizeof(*(ptr)), __pu_err, -EFAULT); \
|
|
|
+ __builtin_expect(__pu_err, 0); \
|
|
|
+})
|
|
|
+
|
|
|
+#define unsafe_get_user(x, ptr) \
|
|
|
+({ \
|
|
|
+ int __gu_err; \
|
|
|
+ unsigned long __gu_val; \
|
|
|
+ __get_user_size(__gu_val, (ptr), sizeof(*(ptr)), __gu_err, -EFAULT); \
|
|
|
+ (x) = (__force __typeof__(*(ptr)))__gu_val; \
|
|
|
+ __builtin_expect(__gu_err, 0); \
|
|
|
+})
|
|
|
+
|
|
|
#endif /* _ASM_X86_UACCESS_H */
|
|
|
|