Skip to content

Commit c021e19

Browse files
committed
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
2 parents 7521f25 + f6a1892 commit c021e19

File tree

4 files changed

+28
-31
lines changed

4 files changed

+28
-31
lines changed

arch/x86/Kconfig.cpu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ config X86_CMOV
379379
config X86_MINIMUM_CPU_FAMILY
380380
int
381381
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)
383383
default "5" if X86_32 && X86_CMPXCHG64
384384
default "4"
385385

arch/x86/kernel/fpu/signal.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,13 @@ static int __restore_fpregs_from_user(void __user *buf, u64 ufeatures,
274274
* Attempt to restore the FPU registers directly from user memory.
275275
* Pagefaults are handled and any errors returned are fatal.
276276
*/
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)
279278
{
280279
struct fpu *fpu = &current->thread.fpu;
281280
int ret;
282281

282+
/* Restore enabled features only. */
283+
xrestore &= fpu->fpstate->user_xfeatures;
283284
retry:
284285
fpregs_lock();
285286
/* Ensure that XFD is up to date */
@@ -309,7 +310,7 @@ static bool restore_fpregs_from_user(void __user *buf, u64 xrestore,
309310
if (ret != X86_TRAP_PF)
310311
return false;
311312

312-
if (!fault_in_readable(buf, size))
313+
if (!fault_in_readable(buf, fpu->fpstate->user_size))
313314
goto retry;
314315
return false;
315316
}
@@ -339,7 +340,6 @@ static bool __fpu_restore_sig(void __user *buf, void __user *buf_fx,
339340
struct user_i387_ia32_struct env;
340341
bool success, fx_only = false;
341342
union fpregs_state *fpregs;
342-
unsigned int state_size;
343343
u64 user_xfeatures = 0;
344344

345345
if (use_xsave()) {
@@ -349,17 +349,14 @@ static bool __fpu_restore_sig(void __user *buf, void __user *buf_fx,
349349
return false;
350350

351351
fx_only = !fx_sw_user.magic1;
352-
state_size = fx_sw_user.xstate_size;
353352
user_xfeatures = fx_sw_user.xfeatures;
354353
} else {
355354
user_xfeatures = XFEATURE_MASK_FPSSE;
356-
state_size = fpu->fpstate->user_size;
357355
}
358356

359357
if (likely(!ia32_fxstate)) {
360358
/* 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);
363360
}
364361

365362
/*

arch/x86/lib/getuser.S

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -163,23 +163,23 @@ SYM_CODE_END(__get_user_8_handle_exception)
163163
#endif
164164

165165
/* 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)
169169
#ifdef CONFIG_X86_64
170-
_ASM_EXTABLE(4b, __get_user_handle_exception)
170+
_ASM_EXTABLE_UA(4b, __get_user_handle_exception)
171171
#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)
174174
#endif
175175

176176
/* __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)
180180
#ifdef CONFIG_X86_64
181-
_ASM_EXTABLE(9b, __get_user_handle_exception)
181+
_ASM_EXTABLE_UA(9b, __get_user_handle_exception)
182182
#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)
185185
#endif

arch/x86/lib/putuser.S

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,15 @@ SYM_CODE_START_LOCAL(__put_user_handle_exception)
133133
RET
134134
SYM_CODE_END(__put_user_handle_exception)
135135

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)
144144
#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)
147147
#endif

0 commit comments

Comments
 (0)