Commit 4a37cca
arm64: signal: Preserve POR_EL0 if poe_context is missing
commit 030e8a4 upstream.
Commit 2e8a1ac ("arm64: signal: Improve POR_EL0 handling to
avoid uaccess failures") delayed the write to POR_EL0 in
rt_sigreturn to avoid spurious uaccess failures. This change however
relies on the poe_context frame record being present: on a system
supporting POE, calling sigreturn without a poe_context record now
results in writing arbitrary data from the kernel stack into POR_EL0.
Fix this by adding a __valid_fields member to struct
user_access_state, and zeroing the struct on allocation.
restore_poe_context() then indicates that the por_el0 field is valid
by setting the corresponding bit in __valid_fields, and
restore_user_access_state() only touches POR_EL0 if there is a valid
value to set it to. This is in line with how POR_EL0 was originally
handled; all frame records are currently optional, except
fpsimd_context.
To ensure that __valid_fields is kept in sync, fields (currently
just por_el0) are now accessed via accessors and prefixed with __ to
discourage direct access.
Fixes: 2e8a1ac ("arm64: signal: Improve POR_EL0 handling to avoid uaccess failures")
Cc: <stable@vger.kernel.org>
Reported-by: Will Deacon <will@kernel.org>
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent c0b654b commit 4a37cca
1 file changed
Lines changed: 43 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
73 | 76 | | |
74 | 77 | | |
75 | 78 | | |
76 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
77 | 84 | | |
78 | 85 | | |
79 | | - | |
| 86 | + | |
| 87 | + | |
80 | 88 | | |
81 | 89 | | |
82 | | - | |
83 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
84 | 109 | | |
85 | 110 | | |
86 | 111 | | |
| |||
94 | 119 | | |
95 | 120 | | |
96 | 121 | | |
97 | | - | |
| 122 | + | |
98 | 123 | | |
99 | 124 | | |
100 | 125 | | |
| |||
122 | 147 | | |
123 | 148 | | |
124 | 149 | | |
125 | | - | |
126 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
127 | 154 | | |
128 | 155 | | |
129 | 156 | | |
| |||
333 | 360 | | |
334 | 361 | | |
335 | 362 | | |
336 | | - | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
337 | 369 | | |
338 | 370 | | |
339 | 371 | | |
340 | | - | |
| 372 | + | |
341 | 373 | | |
342 | 374 | | |
343 | 375 | | |
| |||
353 | 385 | | |
354 | 386 | | |
355 | 387 | | |
356 | | - | |
| 388 | + | |
357 | 389 | | |
358 | 390 | | |
359 | 391 | | |
| |||
1095 | 1127 | | |
1096 | 1128 | | |
1097 | 1129 | | |
1098 | | - | |
| 1130 | + | |
1099 | 1131 | | |
1100 | 1132 | | |
1101 | 1133 | | |
| |||
1507 | 1539 | | |
1508 | 1540 | | |
1509 | 1541 | | |
1510 | | - | |
| 1542 | + | |
1511 | 1543 | | |
1512 | 1544 | | |
1513 | 1545 | | |
| |||
0 commit comments