Craig Bergstrom ce56a86e2a x86/mm: Limit mmap() of /dev/mem to valid physical addresses
Currently, it is possible to mmap() any offset from /dev/mem.  If a
program mmaps() /dev/mem offsets outside of the addressable limits
of a system, the page table can be corrupted by setting reserved bits.

For example if you mmap() offset 0x0001000000000000 of /dev/mem on an
x86_64 system with a 48-bit bus, the page fault handler will be called
with error_code set to RSVD.  The kernel then crashes with a page table
corruption error.

This change prevents this page table corruption on x86 by refusing
to mmap offsets higher than the highest valid address in the system.

Signed-off-by: Craig Bergstrom <craigb@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Luis R. Rodriguez <mcgrof@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Toshi Kani <toshi.kani@hp.com>
Cc: dsafonov@virtuozzo.com
Cc: kirill.shutemov@linux.intel.com
Cc: mhocko@suse.com
Cc: oleg@redhat.com
Link: http://lkml.kernel.org/r/20171019192856.39672-1-craigb@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-10-20 09:48:00 +02:00
..
2017-09-29 12:24:28 -07:00
2017-07-20 12:31:04 +02:00
2016-07-27 11:35:37 -07:00
2014-12-11 11:35:02 +01:00
2015-05-28 15:31:53 +02:00
2015-10-21 11:17:32 +02:00
2015-04-24 15:36:55 +02:00
2015-07-31 13:31:10 +02:00
2017-10-05 14:23:06 +02:00
2017-09-07 11:53:11 +02:00
2014-02-27 08:07:39 -08:00
2017-07-26 13:18:20 +02:00
2017-07-26 13:18:20 +02:00
2017-07-26 13:18:20 +02:00
2017-06-28 22:32:55 +02:00
2017-08-21 11:35:50 +02:00
2017-08-03 23:26:22 +02:00
2015-05-19 15:47:30 +02:00
2016-01-30 11:22:17 +01:00
2017-08-23 18:37:37 +02:00
2015-07-31 13:31:10 +02:00
2017-03-29 12:06:28 -04:00
2017-04-17 12:52:22 -04:00
2016-06-16 00:04:31 +02:00
2015-05-19 15:47:30 +02:00