Pull x86 fixes from Borislav Petkov: - Correct the minimum CPU family for Transmeta Crusoe in Kconfig so that such hw can boot again - Do not take into accout XSTATE buffer size info supplied by userspace when constructing a sigreturn frame - Switch get_/put_user* to EX_TYPE_UACCESS exception handling when an MCE is encountered so that it can be properly recovered from instead of simply panicking * tag 'x86_urgent_for_v6.8_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/Kconfig: Transmeta Crusoe is CPU family 5, not 6 x86/fpu: Stop relying on userspace for info to fault in xsave buffer x86/lib: Revert to _ASM_EXTABLE_UA() for {get,put}_user() fixups
Unified · Split
| @@ -379,7 +379,7 @@ config X86_CMOV · 378 unmodified lines | ||
| 379 | 379 | config X86_MINIMUM_CPU_FAMILY |
| 380 | 380 | int |
| 381 | 381 | default "64" if X86_64 |
| 382 | − default "6" if X86_32 && (MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MEFFICEON || MATOM || MCRUSOE || MCORE2 || MK7 || MK8) | |
| 382 | + default "6" if X86_32 && (MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MEFFICEON || MATOM || MCORE2 || MK7 || MK8) | |
| 383 | 383 | default "5" if X86_32 && X86_CMPXCHG64 |
| 384 | 384 | default "4" |
| 385 | 385 | |
| @@ -274,12 +274,13 @@ static int __restore_fpregs_from_user(void __user *buf, u64 ufeatures, · 273 unmodified lines | ||
| 274 | 274 | * Attempt to restore the FPU registers directly from user memory. |
| 275 | 275 | * Pagefaults are handled and any errors returned are fatal. |
| 276 | 276 | */ |
| 277 | −static bool restore_fpregs_from_user(void __user *buf, u64 xrestore, | |
| 278 | − bool fx_only, unsigned int size) | |
| 277 | +static bool restore_fpregs_from_user(void __user *buf, u64 xrestore, bool fx_only) | |
| 279 | 278 | { |
| 280 | 279 | struct fpu *fpu = ¤t->thread.fpu; |
| 281 | 280 | int ret; |
| 282 | 281 | |
| 282 | + /* Restore enabled features only. */ | |
| 283 | + xrestore &= fpu->fpstate->user_xfeatures; | |
| 283 | 284 | retry: |
| 284 | 285 | fpregs_lock(); |
| 285 | 286 | /* Ensure that XFD is up to date */ |
| @@ -309,7 +310,7 @@ retry: · 23 unmodified lines | ||
| 309 | 310 | if (ret != X86_TRAP_PF) |
| 310 | 311 | return false; |
| 311 | 312 | |
| 312 | − if (!fault_in_readable(buf, size)) | |
| 313 | + if (!fault_in_readable(buf, fpu->fpstate->user_size)) | |
| 313 | 314 | goto retry; |
| 314 | 315 | return false; |
| 315 | 316 | } |
| @@ -339,7 +340,6 @@ static bool __fpu_restore_sig(void __user *buf, void __user *buf_fx, · 23 unmodified lines | ||
| 339 | 340 | struct user_i387_ia32_struct env; |
| 340 | 341 | bool success, fx_only = false; |
| 341 | 342 | union fpregs_state *fpregs; |
| 342 | − unsigned int state_size; | |
| 343 | 343 | u64 user_xfeatures = 0; |
| 344 | 344 | |
| 345 | 345 | if (use_xsave()) { |
| @@ -349,17 +349,14 @@ static bool __fpu_restore_sig(void __user *buf, void __user *buf_fx, · 3 unmodified lines | ||
| 349 | 349 | return false; |
| 350 | 350 | |
| 351 | 351 | fx_only = !fx_sw_user.magic1; |
| 352 | − state_size = fx_sw_user.xstate_size; | |
| 353 | 352 | user_xfeatures = fx_sw_user.xfeatures; |
| 354 | 353 | } else { |
| 355 | 354 | user_xfeatures = XFEATURE_MASK_FPSSE; |
| 356 | − state_size = fpu->fpstate->user_size; | |
| 357 | 355 | } |
| 358 | 356 | |
| 359 | 357 | if (likely(!ia32_fxstate)) { |
| 360 | 358 | /* Restore the FPU registers directly from user memory. */ |
| 361 | − return restore_fpregs_from_user(buf_fx, user_xfeatures, fx_only, | |
| 362 | − state_size); | |
| 359 | + return restore_fpregs_from_user(buf_fx, user_xfeatures, fx_only); | |
| 363 | 360 | } |
| 364 | 361 | |
| 365 | 362 | /* |
| @@ -163,23 +163,23 @@ SYM_CODE_END(__get_user_8_handle_exception) · 162 unmodified lines | ||
| 163 | 163 | #endif |
| 164 | 164 | |
| 165 | 165 | /* get_user */ |
| 166 | − _ASM_EXTABLE(1b, __get_user_handle_exception) | |
| 167 | − _ASM_EXTABLE(2b, __get_user_handle_exception) | |
| 168 | − _ASM_EXTABLE(3b, __get_user_handle_exception) | |
| 166 | + _ASM_EXTABLE_UA(1b, __get_user_handle_exception) | |
| 167 | + _ASM_EXTABLE_UA(2b, __get_user_handle_exception) | |
| 168 | + _ASM_EXTABLE_UA(3b, __get_user_handle_exception) | |
| 169 | 169 | #ifdef CONFIG_X86_64 |
| 170 | − _ASM_EXTABLE(4b, __get_user_handle_exception) | |
| 170 | + _ASM_EXTABLE_UA(4b, __get_user_handle_exception) | |
| 171 | 171 | #else |
| 172 | − _ASM_EXTABLE(4b, __get_user_8_handle_exception) | |
| 173 | − _ASM_EXTABLE(5b, __get_user_8_handle_exception) | |
| 172 | + _ASM_EXTABLE_UA(4b, __get_user_8_handle_exception) | |
| 173 | + _ASM_EXTABLE_UA(5b, __get_user_8_handle_exception) | |
| 174 | 174 | #endif |
| 175 | 175 | |
| 176 | 176 | /* __get_user */ |
| 177 | − _ASM_EXTABLE(6b, __get_user_handle_exception) | |
| 178 | − _ASM_EXTABLE(7b, __get_user_handle_exception) | |
| 179 | − _ASM_EXTABLE(8b, __get_user_handle_exception) | |
| 177 | + _ASM_EXTABLE_UA(6b, __get_user_handle_exception) | |
| 178 | + _ASM_EXTABLE_UA(7b, __get_user_handle_exception) | |
| 179 | + _ASM_EXTABLE_UA(8b, __get_user_handle_exception) | |
| 180 | 180 | #ifdef CONFIG_X86_64 |
| 181 | − _ASM_EXTABLE(9b, __get_user_handle_exception) | |
| 181 | + _ASM_EXTABLE_UA(9b, __get_user_handle_exception) | |
| 182 | 182 | #else |
| 183 | − _ASM_EXTABLE(9b, __get_user_8_handle_exception) | |
| 184 | − _ASM_EXTABLE(10b, __get_user_8_handle_exception) | |
| 183 | + _ASM_EXTABLE_UA(9b, __get_user_8_handle_exception) | |
| 184 | + _ASM_EXTABLE_UA(10b, __get_user_8_handle_exception) | |
| 185 | 185 | #endif |
| @@ -133,15 +133,15 @@ SYM_CODE_START_LOCAL(__put_user_handle_exception) · 132 unmodified lines | ||
| 133 | 133 | RET |
| 134 | 134 | SYM_CODE_END(__put_user_handle_exception) |
| 135 | 135 | |
| 136 | − _ASM_EXTABLE(1b, __put_user_handle_exception) | |
| 137 | − _ASM_EXTABLE(2b, __put_user_handle_exception) | |
| 138 | − _ASM_EXTABLE(3b, __put_user_handle_exception) | |
| 139 | − _ASM_EXTABLE(4b, __put_user_handle_exception) | |
| 140 | − _ASM_EXTABLE(5b, __put_user_handle_exception) | |
| 141 | − _ASM_EXTABLE(6b, __put_user_handle_exception) | |
| 142 | − _ASM_EXTABLE(7b, __put_user_handle_exception) | |
| 143 | − _ASM_EXTABLE(9b, __put_user_handle_exception) | |
| 136 | + _ASM_EXTABLE_UA(1b, __put_user_handle_exception) | |
| 137 | + _ASM_EXTABLE_UA(2b, __put_user_handle_exception) | |
| 138 | + _ASM_EXTABLE_UA(3b, __put_user_handle_exception) | |
| 139 | + _ASM_EXTABLE_UA(4b, __put_user_handle_exception) | |
| 140 | + _ASM_EXTABLE_UA(5b, __put_user_handle_exception) | |
| 141 | + _ASM_EXTABLE_UA(6b, __put_user_handle_exception) | |
| 142 | + _ASM_EXTABLE_UA(7b, __put_user_handle_exception) | |
| 143 | + _ASM_EXTABLE_UA(9b, __put_user_handle_exception) | |
| 144 | 144 | #ifdef CONFIG_X86_32 |
| 145 | − _ASM_EXTABLE(8b, __put_user_handle_exception) | |
| 146 | − _ASM_EXTABLE(10b, __put_user_handle_exception) | |
| 145 | + _ASM_EXTABLE_UA(8b, __put_user_handle_exception) | |
| 146 | + _ASM_EXTABLE_UA(10b, __put_user_handle_exception) | |
| 147 | 147 | #endif |