alistair23-linux/arch/x86/kernel/fpu
Dave Hansen 16171bffc8 x86/pkeys: Add check for pkey "overflow"
Alex Shi reported the pkey macros above arch_set_user_pkey_access()
to be unused.  They are unused, and even refer to a nonexistent
CONFIG option.

But, they might have served a good use, which was to ensure that
the code does not try to set values that would not fit in the
PKRU register.  As it stands, a too-large 'pkey' value would
be likely to silently overflow the u32 new_pkru_bits.

Add a check to look for overflows.  Also add a comment to remind
any future developer to closely examine the types used to store
pkey values if arch_max_pkey() ever changes.

This boots and passes the x86 pkey selftests.

Reported-by: Alex Shi <alex.shi@linux.alibaba.com>
Signed-off-by: Dave Hansen <dave.hansen@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20200122165346.AD4DA150@viggo.jf.intel.com
2020-02-24 20:25:21 +01:00
..
bugs.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
core.c x86/fpu: Remove the fpu__save() export 2019-06-17 12:21:26 +02:00
init.c x86/fpu: Inline fpu__xstate_clear_all_cpu_caps() 2019-07-07 12:01:47 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
regset.c x86/fpu: Remove fpu->initialized 2019-04-10 15:42:40 +02:00
signal.c x86/fpu: Deactivate FPU state after failure during state load 2020-01-07 13:44:42 +01:00
xstate.c x86/pkeys: Add check for pkey "overflow" 2020-02-24 20:25:21 +01:00