linux/arch/x86/kernel/fpu
Andy Lutomirski a6d9692cad x86/ptrace: Fix xfpregs_set()'s incorrect xmm clearing
commit 44cad52cc1 upstream.

xfpregs_set() handles 32-bit REGSET_XFP and 64-bit REGSET_FP. The actual
code treats these regsets as modern FX state (i.e. the beginning part of
XSTATE). The declarations of the regsets thought they were the legacy
i387 format. The code thought they were the 32-bit (no xmm8..15) variant
of XSTATE and, for good measure, made the high bits disappear by zeroing
the wrong part of the buffer. The latter broke ptrace, and everything
else confused anyone trying to understand the code. In particular, the
nonsense definitions of the regsets confused me when I wrote this code.

Clean this all up. Change the declarations to match reality (which
shouldn't change the generated code, let alone the ABI) and fix
xfpregs_set() to clear the correct bits and to only do so for 32-bit
callers.

Fixes: 6164331d15 ("x86/fpu: Rewrite xfpregs_set()")
Reported-by: Luís Ferreira <contact@lsferreira.net>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: <stable@vger.kernel.org>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=215524
Link: https://lore.kernel.org/r/YgpFnZpF01WwR8wU@zn.tnic
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-03-02 11:47:47 +01:00
..
bugs.c
core.c x86/fpu: Mark init_fpstate __ro_after_init 2021-06-23 19:58:45 +02:00
init.c x86/fpu: Get rid of fpu__get_supported_xfeatures_mask() 2021-06-23 17:49:46 +02:00
Makefile
regset.c x86/ptrace: Fix xfpregs_set()'s incorrect xmm clearing 2022-03-02 11:47:47 +01:00
signal.c x86/fpu: Mask out the invalid MXCSR bits properly 2021-10-16 12:37:50 +02:00
xstate.c x86/fpu/xstate: Clear xstate header in copy_xstate_to_uabi_buf() again 2021-06-24 17:19:51 +02:00