diff options
author | Dave Hansen <dave.hansen@linux.intel.com> | 2017-02-24 01:26:03 +0300 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2017-03-01 12:51:50 +0300 |
commit | 58ab9a088ddac4efe823471275859d64f735577e (patch) | |
tree | ad50c51ed5b91e1ac95a08811a8df7e3ca385bd8 /tools | |
parent | f2ae5da726172fcf82f7be801489dd585f6a38eb (diff) | |
download | linux-58ab9a088ddac4efe823471275859d64f735577e.tar.xz |
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>
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions