History

Merge tag 'x86_urgent_for_v6.8_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

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

Linus Torvalds committed 2 years ago

Commit c021e192 parents 7521f25 f6a18924 files · +28 −31Browse files

Unified · Split

4 files
  1. arch/x86/Kconfig.cpu +1 −1
  2. arch/x86/kernel/fpu/signal.c +5 −8
  3. arch/x86/lib/getuser.S +12 −12
  4. arch/x86/lib/putuser.S +10 −10
arch/x86/Kconfig.cpu+1−1
@@ -379,7 +379,7 @@ config X86_CMOV · 378 unmodified lines
379config X86_MINIMUM_CPU_FAMILY379config X86_MINIMUM_CPU_FAMILY
380 int380 int
381 default "64" if X86_64381 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 default "5" if X86_32 && X86_CMPXCHG64383 default "5" if X86_32 && X86_CMPXCHG64
384 default "4"384 default "4"
385 385
arch/x86/kernel/fpu/signal.c+5−8
@@ -274,12 +274,13 @@ static int __restore_fpregs_from_user(void __user *buf, u64 ufeatures, · 273 unmodified lines
274 * Attempt to restore the FPU registers directly from user memory.274 * Attempt to restore the FPU registers directly from user memory.
275 * Pagefaults are handled and any errors returned are fatal.275 * Pagefaults are handled and any errors returned are fatal.
276 */276 */
277static bool restore_fpregs_from_user(void __user *buf, u64 xrestore,277static bool restore_fpregs_from_user(void __user *buf, u64 xrestore, bool fx_only)
278 bool fx_only, unsigned int size)
279{278{
280 struct fpu *fpu = &current->thread.fpu;279 struct fpu *fpu = &current->thread.fpu;
281 int ret;280 int ret;
282 281
282 /* Restore enabled features only. */
283 xrestore &= fpu->fpstate->user_xfeatures;
283retry:284retry:
284 fpregs_lock();285 fpregs_lock();
285 /* Ensure that XFD is up to date */286 /* Ensure that XFD is up to date */
@@ -309,7 +310,7 @@ retry: · 23 unmodified lines
309 if (ret != X86_TRAP_PF)310 if (ret != X86_TRAP_PF)
310 return false;311 return false;
311 312
312 if (!fault_in_readable(buf, size))313 if (!fault_in_readable(buf, fpu->fpstate->user_size))
313 goto retry;314 goto retry;
314 return false;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 struct user_i387_ia32_struct env;340 struct user_i387_ia32_struct env;
340 bool success, fx_only = false;341 bool success, fx_only = false;
341 union fpregs_state *fpregs;342 union fpregs_state *fpregs;
342 unsigned int state_size;
343 u64 user_xfeatures = 0;343 u64 user_xfeatures = 0;
344 344
345 if (use_xsave()) {345 if (use_xsave()) {
@@ -349,17 +349,14 @@ static bool __fpu_restore_sig(void __user *buf, void __user *buf_fx, · 3 unmodified lines
349 return false;349 return false;
350 350
351 fx_only = !fx_sw_user.magic1;351 fx_only = !fx_sw_user.magic1;
352 state_size = fx_sw_user.xstate_size;
353 user_xfeatures = fx_sw_user.xfeatures;352 user_xfeatures = fx_sw_user.xfeatures;
354 } else {353 } else {
355 user_xfeatures = XFEATURE_MASK_FPSSE;354 user_xfeatures = XFEATURE_MASK_FPSSE;
356 state_size = fpu->fpstate->user_size;
357 }355 }
358 356
359 if (likely(!ia32_fxstate)) {357 if (likely(!ia32_fxstate)) {
360 /* Restore the FPU registers directly from user memory. */358 /* Restore the FPU registers directly from user memory. */
361 return restore_fpregs_from_user(buf_fx, user_xfeatures, fx_only,359 return restore_fpregs_from_user(buf_fx, user_xfeatures, fx_only);
362 state_size);
363 }360 }
364 361
365 /*362 /*
arch/x86/lib/getuser.S+12−12
@@ -163,23 +163,23 @@ SYM_CODE_END(__get_user_8_handle_exception) · 162 unmodified lines
163#endif163#endif
164 164
165/* get_user */165/* get_user */
166 _ASM_EXTABLE(1b, __get_user_handle_exception)166 _ASM_EXTABLE_UA(1b, __get_user_handle_exception)
167 _ASM_EXTABLE(2b, __get_user_handle_exception)167 _ASM_EXTABLE_UA(2b, __get_user_handle_exception)
168 _ASM_EXTABLE(3b, __get_user_handle_exception)168 _ASM_EXTABLE_UA(3b, __get_user_handle_exception)
169#ifdef CONFIG_X86_64169#ifdef CONFIG_X86_64
170 _ASM_EXTABLE(4b, __get_user_handle_exception)170 _ASM_EXTABLE_UA(4b, __get_user_handle_exception)
171#else171#else
172 _ASM_EXTABLE(4b, __get_user_8_handle_exception)172 _ASM_EXTABLE_UA(4b, __get_user_8_handle_exception)
173 _ASM_EXTABLE(5b, __get_user_8_handle_exception)173 _ASM_EXTABLE_UA(5b, __get_user_8_handle_exception)
174#endif174#endif
175 175
176/* __get_user */176/* __get_user */
177 _ASM_EXTABLE(6b, __get_user_handle_exception)177 _ASM_EXTABLE_UA(6b, __get_user_handle_exception)
178 _ASM_EXTABLE(7b, __get_user_handle_exception)178 _ASM_EXTABLE_UA(7b, __get_user_handle_exception)
179 _ASM_EXTABLE(8b, __get_user_handle_exception)179 _ASM_EXTABLE_UA(8b, __get_user_handle_exception)
180#ifdef CONFIG_X86_64180#ifdef CONFIG_X86_64
181 _ASM_EXTABLE(9b, __get_user_handle_exception)181 _ASM_EXTABLE_UA(9b, __get_user_handle_exception)
182#else182#else
183 _ASM_EXTABLE(9b, __get_user_8_handle_exception)183 _ASM_EXTABLE_UA(9b, __get_user_8_handle_exception)
184 _ASM_EXTABLE(10b, __get_user_8_handle_exception)184 _ASM_EXTABLE_UA(10b, __get_user_8_handle_exception)
185#endif185#endif
arch/x86/lib/putuser.S+10−10
@@ -133,15 +133,15 @@ SYM_CODE_START_LOCAL(__put_user_handle_exception) · 132 unmodified lines
133 RET133 RET
134SYM_CODE_END(__put_user_handle_exception)134SYM_CODE_END(__put_user_handle_exception)
135 135
136 _ASM_EXTABLE(1b, __put_user_handle_exception)136 _ASM_EXTABLE_UA(1b, __put_user_handle_exception)
137 _ASM_EXTABLE(2b, __put_user_handle_exception)137 _ASM_EXTABLE_UA(2b, __put_user_handle_exception)
138 _ASM_EXTABLE(3b, __put_user_handle_exception)138 _ASM_EXTABLE_UA(3b, __put_user_handle_exception)
139 _ASM_EXTABLE(4b, __put_user_handle_exception)139 _ASM_EXTABLE_UA(4b, __put_user_handle_exception)
140 _ASM_EXTABLE(5b, __put_user_handle_exception)140 _ASM_EXTABLE_UA(5b, __put_user_handle_exception)
141 _ASM_EXTABLE(6b, __put_user_handle_exception)141 _ASM_EXTABLE_UA(6b, __put_user_handle_exception)
142 _ASM_EXTABLE(7b, __put_user_handle_exception)142 _ASM_EXTABLE_UA(7b, __put_user_handle_exception)
143 _ASM_EXTABLE(9b, __put_user_handle_exception)143 _ASM_EXTABLE_UA(9b, __put_user_handle_exception)
144#ifdef CONFIG_X86_32144#ifdef CONFIG_X86_32
145 _ASM_EXTABLE(8b, __put_user_handle_exception)145 _ASM_EXTABLE_UA(8b, __put_user_handle_exception)
146 _ASM_EXTABLE(10b, __put_user_handle_exception)146 _ASM_EXTABLE_UA(10b, __put_user_handle_exception)
147#endif147#endif