]> git.baikalelectronics.ru Git - kernel.git/commit
x86/fpu/xstate: Add XFD #NM handler
authorChang S. Bae <chang.seok.bae@intel.com>
Thu, 21 Oct 2021 22:55:21 +0000 (15:55 -0700)
committerBorislav Petkov <bp@suse.de>
Tue, 26 Oct 2021 08:53:02 +0000 (10:53 +0200)
commit1ebda8f6c16b1ad3ae41b4d01b53d74575315799
treea7d6b08b8ca1045a43d668a482fe6f83238882cd
parent931a06ab5c5b95987cfd947abce851f7e0491f04
x86/fpu/xstate: Add XFD #NM handler

If the XFD MSR has feature bits set then #NM will be raised when user space
attempts to use an instruction related to one of these features.

When the task has no permissions to use that feature, raise SIGILL, which
is the same behavior as #UD.

If the task has permissions, calculate the new buffer size for the extended
feature set and allocate a larger fpstate. In the unlikely case that
vzalloc() fails, SIGSEGV is raised.

The allocation function will be added in the next step. Provide a stub
which fails for now.

  [ tglx: Updated serialization ]

Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20211021225527.10184-18-chang.seok.bae@intel.com
arch/x86/include/asm/fpu/xstate.h
arch/x86/kernel/fpu/xstate.c
arch/x86/kernel/traps.c