1
- From aef1d9a42c562406030cb0f4ba9fab7e9b7d5145 Mon Sep 17 00:00:00 2001
1
+ From 3b5f7c47389865240a781933324d165897e00abc Mon Sep 17 00:00:00 2001
2
2
From: Nathan Chancellor <
[email protected] >
3
3
Date: Sat, 5 Jan 2019 11:51:39 -0700
4
4
Subject: [PATCH 1/2] DO-NOT-UPSTREAM: x86: Revert two commits that break the
@@ -11,7 +11,9 @@ We've been fortunate enough to get around the asm goto requirement
11
11
introduced in commit e501ce957a78 ("x86: Force asm-goto") until now.
12
12
13
13
This is not a clean revert because of commit 2a418cf3f5f1 ("x86/uaccess:
14
- Don't leak the AC flag into __put_user() value evaluation").
14
+ Don't leak the AC flag into __put_user() value evaluation") and commit
15
+ 6ae865615fc4 ("x86/uaccess: Dont leak the AC flag into __put_user()
16
+ argument evaluation").
15
17
16
18
Link: https://github.com/ClangBuiltLinux/linux/issues/6
17
19
Signed-off-by: Nathan Chancellor <
[email protected] >
20
22
1 file changed, 41 insertions(+), 39 deletions(-)
21
23
22
24
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
23
- index 22ba683afdc2..9352dbef0fdd 100644
25
+ index c82abd6e4ca3..5abc7e144e01 100644
24
26
--- a/arch/x86/include/asm/uaccess.h
25
27
+++ b/arch/x86/include/asm/uaccess.h
26
28
@@ -182,14 +182,19 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
@@ -90,24 +92,25 @@ index 22ba683afdc2..9352dbef0fdd 100644
90
92
break; \
91
93
default: \
92
94
__put_user_bad(); \
93
- @@ -425,14 +431,11 @@ do { \
95
+ @@ -425,15 +431,12 @@ do { \
94
96
95
97
#define __put_user_nocheck(x, ptr, size) \
96
98
({ \
97
99
- __label__ __pu_label; \
98
100
- int __pu_err = -EFAULT; \
99
101
+ int __pu_err; \
100
- __typeof__(*(ptr)) __pu_val; \
101
- __pu_val = x; \
102
+ __typeof__(*(ptr)) __pu_val = (x); \
103
+ __typeof__(ptr) __pu_ptr = (ptr); \
104
+ __typeof__(size) __pu_size = (size); \
102
105
__uaccess_begin(); \
103
- - __put_user_size(__pu_val, (ptr), (size) , __pu_label); \
106
+ - __put_user_size(__pu_val, __pu_ptr, __pu_size , __pu_label); \
104
107
- __pu_err = 0; \
105
108
- __pu_label: \
106
- + __put_user_size(__pu_val, (ptr), (size) , __pu_err, -EFAULT);\
109
+ + __put_user_size(__pu_val, __pu_ptr, __pu_size , __pu_err, -EFAULT);\
107
110
__uaccess_end(); \
108
111
__builtin_expect(__pu_err, 0); \
109
112
})
110
- @@ -457 ,23 +460 ,17 @@ struct __large_struct { unsigned long buf[100]; };
113
+ @@ -458 ,23 +461 ,17 @@ struct __large_struct { unsigned long buf[100]; };
111
114
* we do not write to any memory gcc knows about, so there are no
112
115
* aliasing issues.
113
116
*/
@@ -142,7 +145,7 @@ index 22ba683afdc2..9352dbef0fdd 100644
142
145
143
146
#define __put_user_asm_ex(x, addr, itype, rtype, ltype) \
144
147
asm volatile("1: mov"itype" %"rtype"0,%1\n" \
145
- @@ -717 ,8 +714 ,13 @@ static __must_check __always_inline bool user_access_begin(const void __user *pt
148
+ @@ -718 ,8 +715 ,13 @@ static __must_check __always_inline bool user_access_begin(const void __user *pt
146
149
#define user_access_save() smap_save()
147
150
#define user_access_restore(x) smap_restore(x)
148
151
@@ -162,7 +165,7 @@ index 22ba683afdc2..9352dbef0fdd 100644
162
165
2.21.0
163
166
164
167
165
- From fdd79fe62ad7170ba301686ff66750959d6d53f1 Mon Sep 17 00:00:00 2001
168
+ From f272bf78754e6250c2ea118520686c5b873a114c Mon Sep 17 00:00:00 2001
166
169
From: Nathan Chancellor <
[email protected] >
167
170
Date: Tue, 25 Sep 2018 13:32:33 -0700
168
171
Subject: [PATCH 2/2] DO-NOT-UPSTREAM: x86: Avoid warnings/errors due to lack
0 commit comments