x86/fpu/signal: Let xrstor handle the features to init
authorThomas Gleixner <tglx@linutronix.de>
Wed, 23 Jun 2021 12:02:32 +0000 (14:02 +0200)
committerBorislav Petkov <bp@suse.de>
Wed, 23 Jun 2021 21:45:31 +0000 (23:45 +0200)
commit6f9866a166cd1ad3ebb2dcdb3874aa8fee8dea2f
treec181cfba9a9a3d30cd64d4b749fd0cb682e1e219
parentfcb3635f5018e53024c6be3c3213737f469f74ff
x86/fpu/signal: Let xrstor handle the features to init

There is no reason to do an extra XRSTOR from init_fpstate for feature
bits which have been cleared by user space in the FX magic xfeatures
storage.

Just clear them in the task's XSTATE header and do a full restore which
will put these cleared features into init state.

There is no real difference in performance because the current code
already does a full restore when the xfeatures bits are preserved as the
signal frame setup has stored them, which is the full UABI feature set.

 [ bp: Use the negated mxcsr_feature_mask in the MXCSR check. ]

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210623121457.804115017@linutronix.de
arch/x86/kernel/fpu/signal.c