linux/arch
Dave Hansen 58ab9a088d x86/pkeys: Check against max pkey to avoid overflows
Kirill reported a warning from UBSAN about undefined behavior when using
protection keys.  He is running on hardware that actually has support for
it, which is not widely available.

The warning triggers because of very large shifts of integers when doing a
pkey_free() of a large, invalid value. This happens because we never check
that the pkey "fits" into the mm_pkey_allocation_map().

I do not believe there is any danger here of anything bad happening
other than some aliasing issues where somebody could do:

	pkey_free(35);

and the kernel would effectively execute:

	pkey_free(8);

While this might be confusing to an app that was doing something stupid, it
has to do something stupid and the effects are limited to the app shooting
itself in the foot.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: stable@vger.kernel.org
Cc: linux-kselftest@vger.kernel.org
Cc: shuah@kernel.org
Cc: kirill.shutemov@linux.intel.com
Link: http://lkml.kernel.org/r/20170223222603.A022ED65@viggo.jf.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2017-03-01 10:51:50 +01:00
..
alpha mm: add new mmgrab() helper 2017-02-27 18:43:48 -08:00
arc mm: add new mmget() helper 2017-02-27 18:43:48 -08:00
arm Merge branch 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm 2017-02-28 11:50:53 -08:00
arm64 mm: add new mmgrab() helper 2017-02-27 18:43:48 -08:00
avr32 kprobes: move kprobe declarations to asm-generic/kprobes.h 2017-02-27 18:43:45 -08:00
blackfin mm: add new mmget() helper 2017-02-27 18:43:48 -08:00
c6x kprobes: move kprobe declarations to asm-generic/kprobes.h 2017-02-27 18:43:45 -08:00
cris kprobes: move kprobe declarations to asm-generic/kprobes.h 2017-02-27 18:43:45 -08:00
frv mm: add new mmget() helper 2017-02-27 18:43:48 -08:00
h8300 kprobes: move kprobe declarations to asm-generic/kprobes.h 2017-02-27 18:43:45 -08:00
hexagon mm: add new mmgrab() helper 2017-02-27 18:43:48 -08:00
ia64 mm: add new mmgrab() helper 2017-02-27 18:43:48 -08:00
m32r mm: add new mmgrab() helper 2017-02-27 18:43:48 -08:00
m68k Merge branch 'akpm' (patches from Andrew) 2017-02-27 23:09:29 -08:00
metag mm: add new mmget() helper 2017-02-27 18:43:48 -08:00
microblaze kprobes: move kprobe declarations to asm-generic/kprobes.h 2017-02-27 18:43:45 -08:00
mips mm: add new mmgrab() helper 2017-02-27 18:43:48 -08:00
mn10300 mm: add new mmgrab() helper 2017-02-27 18:43:48 -08:00
nios2 kprobes: move kprobe declarations to asm-generic/kprobes.h 2017-02-27 18:43:45 -08:00
openrisc scripts/spelling.txt: add "efective" pattern and fix typo instances 2017-02-27 18:43:46 -08:00
parisc mm: add new mmgrab() helper 2017-02-27 18:43:48 -08:00
powerpc mm: add new mmgrab() helper 2017-02-27 18:43:48 -08:00
s390 Merge branch 'akpm' (patches from Andrew) 2017-02-27 23:09:29 -08:00
score mm: add new mmgrab() helper 2017-02-27 18:43:48 -08:00
sh mm: add new mmget() helper 2017-02-27 18:43:48 -08:00
sparc mm: add new mmgrab() helper 2017-02-27 18:43:48 -08:00
tile mm: add new mmgrab() helper 2017-02-27 18:43:48 -08:00
um kprobes: move kprobe declarations to asm-generic/kprobes.h 2017-02-27 18:43:45 -08:00
unicore32 kprobes: move kprobe declarations to asm-generic/kprobes.h 2017-02-27 18:43:45 -08:00
x86 x86/pkeys: Check against max pkey to avoid overflows 2017-03-01 10:51:50 +01:00
xtensa mm: add new mmget() helper 2017-02-27 18:43:48 -08:00
.gitignore
Kconfig scripts/spelling.txt: add "an user" pattern and fix typo instances 2017-02-27 18:43:46 -08:00