Commit c021e191 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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
parents 7521f258 f6a18925
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -379,7 +379,7 @@ config X86_CMOV
config X86_MINIMUM_CPU_FAMILY
	int
	default "64" if X86_64
	default "6" if X86_32 && (MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MEFFICEON || MATOM || MCRUSOE || MCORE2 || MK7 || MK8)
	default "6" if X86_32 && (MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MEFFICEON || MATOM || MCORE2 || MK7 || MK8)
	default "5" if X86_32 && X86_CMPXCHG64
	default "4"

+5 −8
Original line number Diff line number Diff line
@@ -274,12 +274,13 @@ static int __restore_fpregs_from_user(void __user *buf, u64 ufeatures,
 * Attempt to restore the FPU registers directly from user memory.
 * Pagefaults are handled and any errors returned are fatal.
 */
static bool restore_fpregs_from_user(void __user *buf, u64 xrestore,
				     bool fx_only, unsigned int size)
static bool restore_fpregs_from_user(void __user *buf, u64 xrestore, bool fx_only)
{
	struct fpu *fpu = &current->thread.fpu;
	int ret;

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

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

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

		fx_only = !fx_sw_user.magic1;
		state_size = fx_sw_user.xstate_size;
		user_xfeatures = fx_sw_user.xfeatures;
	} else {
		user_xfeatures = XFEATURE_MASK_FPSSE;
		state_size = fpu->fpstate->user_size;
	}

	if (likely(!ia32_fxstate)) {
		/* Restore the FPU registers directly from user memory. */
		return restore_fpregs_from_user(buf_fx, user_xfeatures, fx_only,
						state_size);
		return restore_fpregs_from_user(buf_fx, user_xfeatures, fx_only);
	}

	/*
+12 −12
Original line number Diff line number Diff line
@@ -163,23 +163,23 @@ SYM_CODE_END(__get_user_8_handle_exception)
#endif

/* get_user */
	_ASM_EXTABLE(1b, __get_user_handle_exception)
	_ASM_EXTABLE(2b, __get_user_handle_exception)
	_ASM_EXTABLE(3b, __get_user_handle_exception)
	_ASM_EXTABLE_UA(1b, __get_user_handle_exception)
	_ASM_EXTABLE_UA(2b, __get_user_handle_exception)
	_ASM_EXTABLE_UA(3b, __get_user_handle_exception)
#ifdef CONFIG_X86_64
	_ASM_EXTABLE(4b, __get_user_handle_exception)
	_ASM_EXTABLE_UA(4b, __get_user_handle_exception)
#else
	_ASM_EXTABLE(4b, __get_user_8_handle_exception)
	_ASM_EXTABLE(5b, __get_user_8_handle_exception)
	_ASM_EXTABLE_UA(4b, __get_user_8_handle_exception)
	_ASM_EXTABLE_UA(5b, __get_user_8_handle_exception)
#endif

/* __get_user */
	_ASM_EXTABLE(6b, __get_user_handle_exception)
	_ASM_EXTABLE(7b, __get_user_handle_exception)
	_ASM_EXTABLE(8b, __get_user_handle_exception)
	_ASM_EXTABLE_UA(6b, __get_user_handle_exception)
	_ASM_EXTABLE_UA(7b, __get_user_handle_exception)
	_ASM_EXTABLE_UA(8b, __get_user_handle_exception)
#ifdef CONFIG_X86_64
	_ASM_EXTABLE(9b, __get_user_handle_exception)
	_ASM_EXTABLE_UA(9b, __get_user_handle_exception)
#else
	_ASM_EXTABLE(9b, __get_user_8_handle_exception)
	_ASM_EXTABLE(10b, __get_user_8_handle_exception)
	_ASM_EXTABLE_UA(9b, __get_user_8_handle_exception)
	_ASM_EXTABLE_UA(10b, __get_user_8_handle_exception)
#endif
+10 −10
Original line number Diff line number Diff line
@@ -133,15 +133,15 @@ SYM_CODE_START_LOCAL(__put_user_handle_exception)
	RET
SYM_CODE_END(__put_user_handle_exception)

	_ASM_EXTABLE(1b, __put_user_handle_exception)
	_ASM_EXTABLE(2b, __put_user_handle_exception)
	_ASM_EXTABLE(3b, __put_user_handle_exception)
	_ASM_EXTABLE(4b, __put_user_handle_exception)
	_ASM_EXTABLE(5b, __put_user_handle_exception)
	_ASM_EXTABLE(6b, __put_user_handle_exception)
	_ASM_EXTABLE(7b, __put_user_handle_exception)
	_ASM_EXTABLE(9b, __put_user_handle_exception)
	_ASM_EXTABLE_UA(1b, __put_user_handle_exception)
	_ASM_EXTABLE_UA(2b, __put_user_handle_exception)
	_ASM_EXTABLE_UA(3b, __put_user_handle_exception)
	_ASM_EXTABLE_UA(4b, __put_user_handle_exception)
	_ASM_EXTABLE_UA(5b, __put_user_handle_exception)
	_ASM_EXTABLE_UA(6b, __put_user_handle_exception)
	_ASM_EXTABLE_UA(7b, __put_user_handle_exception)
	_ASM_EXTABLE_UA(9b, __put_user_handle_exception)
#ifdef CONFIG_X86_32
	_ASM_EXTABLE(8b, __put_user_handle_exception)
	_ASM_EXTABLE(10b, __put_user_handle_exception)
	_ASM_EXTABLE_UA(8b, __put_user_handle_exception)
	_ASM_EXTABLE_UA(10b, __put_user_handle_exception)
#endif