x86/fpu/xstate: Sanitize handling of independent features
authorThomas Gleixner <tglx@linutronix.de>
Wed, 23 Jun 2021 12:02:04 +0000 (14:02 +0200)
committerBorislav Petkov <bp@suse.de>
Wed, 23 Jun 2021 16:46:20 +0000 (18:46 +0200)
commita75c52896b6d42d6600db4d4dd9f7e4bde9218db
treef5d969fc7a9b0799e401fcd67f85e81b150807c1
parent01707b66535872f7a0d87f66078fd018d1814be0
x86/fpu/xstate: Sanitize handling of independent features

The copy functions for the independent features are horribly named and the
supervisor and independent part is just overengineered.

The point is that the supplied mask has either to be a subset of the
independent features or a subset of the task->fpu.xstate managed features.

Rewrite it so it checks for invalid overlaps of these areas in the caller
supplied feature mask. Rename it so it follows the new naming convention
for these operations. Mop up the function documentation.

This allows to use that function for other purposes as well.

Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Tested-by: Kan Liang <kan.liang@linux.intel.com>
Link: https://lkml.kernel.org/r/20210623121455.004880675@linutronix.de
arch/x86/events/intel/lbr.c
arch/x86/include/asm/fpu/xstate.h
arch/x86/kernel/fpu/xstate.c