WSL2-Linux-Kernel/arch/x86
Feng Tang a7a1849899 x86/fpu: Set X86_FEATURE_OSXSAVE feature after enabling OSXSAVE in CR4
commit 2c66ca3949 upstream.

0-Day found a 34.6% regression in stress-ng's 'af-alg' test case, and
bisected it to commit b81fac906a ("x86/fpu: Move FPU initialization into
arch_cpu_finalize_init()"), which optimizes the FPU init order, and moves
the CR4_OSXSAVE enabling into a later place:

   arch_cpu_finalize_init
       identify_boot_cpu
	   identify_cpu
	       generic_identify
                   get_cpu_cap --> setup cpu capability
       ...
       fpu__init_cpu
           fpu__init_cpu_xstate
               cr4_set_bits(X86_CR4_OSXSAVE);

As the FPU is not yet initialized the CPU capability setup fails to set
X86_FEATURE_OSXSAVE. Many security module like 'camellia_aesni_avx_x86_64'
depend on this feature and therefore fail to load, causing the regression.

Cure this by setting X86_FEATURE_OSXSAVE feature right after OSXSAVE
enabling.

[ tglx: Moved it into the actual BSP FPU initialization code and added a comment ]

Fixes: b81fac906a ("x86/fpu: Move FPU initialization into arch_cpu_finalize_init()")
Reported-by: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Feng Tang <feng.tang@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/lkml/202307192135.203ac24e-oliver.sang@intel.com
Link: https://lore.kernel.org/lkml/20230823065747.92257-1-feng.tang@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-30 16:18:19 +02:00
..
boot x86/boot: Wrap literal addresses in absolute_pointer() 2023-06-09 10:32:30 +02:00
configs x86/kbuild: Enable CONFIG_KALLSYMS_ALL=y in the defconfigs 2022-01-27 11:04:56 +01:00
crypto crypto: x86/ghash - fix unaligned access in ghash_setkey() 2023-03-10 09:39:08 +01:00
entry x86/mm: Fix VDSO and VVAR placement on 5-level paging machines 2023-08-16 18:21:59 +02:00
events perf/ibs: Fix interface via core pmu events 2023-07-23 13:46:47 +02:00
hyperv x86/hyperv: Remove unregister syscore call from Hyper-V cleanup 2022-12-31 13:14:39 +01:00
ia32 binfmt: remove in-tree usage of MAP_DENYWRITE 2021-09-03 18:42:01 +02:00
include x86/fpu: Invalidate FPU state correctly on exec() 2023-08-30 16:18:19 +02:00
kernel x86/fpu: Set X86_FEATURE_OSXSAVE feature after enabling OSXSAVE in CR4 2023-08-30 16:18:19 +02:00
kvm Revert "KVM: x86: enable TDP MMU by default" 2023-08-30 16:18:16 +02:00
lib x86/retpoline,kprobes: Fix position of thunk sections with CONFIG_LTO_CLANG 2023-08-26 14:23:40 +02:00
math-emu x86: Prepare asm files for straight-line-speculation 2022-05-15 20:18:49 +02:00
mm x86/mm: Use mm_alloc() in poking_init() 2023-08-08 19:58:33 +02:00
net x86/extable: Extend extable functionality 2022-07-29 17:25:26 +02:00
pci x86/PCI: Add quirk for AMD XHCI controller that loses MSI-X state in D3hot 2023-04-20 12:13:55 +02:00
platform x86/olpc: fix 'logical not is only applied to the left hand side' 2022-08-17 14:24:18 +02:00
power x86/pm: Add enumeration check before spec MSRs save/restore setup 2022-12-02 17:41:09 +01:00
purgatory x86/purgatory: remove PGO flags 2023-06-21 15:59:14 +02:00
ras
realmode x86/mm: Flush global TLB when switching to trampoline page-table 2022-01-27 11:04:35 +01:00
tools - Remove cc-option checks which are old and already supported by the 2021-08-30 13:27:16 -07:00
um x86: um: vdso: Add '%rcx' and '%r11' to the syscall clobber list 2023-03-11 13:57:26 +01:00
video
xen x86/xen: Fix secondary processors' FPU initialization 2023-08-08 19:58:32 +02:00
.gitignore
Kbuild
Kconfig x86/srso: Add a Speculative RAS Overflow mitigation 2023-08-08 19:58:34 +02:00
Kconfig.assembler
Kconfig.cpu
Kconfig.debug arch: make TRACE_IRQFLAGS_NMI_SUPPORT generic 2022-08-17 14:23:00 +02:00
Makefile x86/realmode: build with -D__DISABLE_EXPORTS 2022-07-23 12:53:56 +02:00
Makefile.um um: allow not setting extra rpaths in the linux binary 2021-06-17 21:54:15 +02:00
Makefile_32.cpu x86/build: Do not add -falign flags unconditionally for clang 2021-09-19 10:35:53 +09:00