kernel-ark/arch
David Daney ac53c4fca4 MIPS: Avoid mcheck by flushing page range in huge_ptep_set_access_flags()
Problem:

1) Huge page mapping of anonymous memory is initially invalid.  Will be
   faulted in by copy-on-write mechanism.

2) Userspace attempts store at the end of the huge mapping.

3) TLB Refill exception handler fill TLB with a normal (4K sized)
   invalid page at the end of the huge mapping virtual address range.

4) Userspace restarted, and re-attempts the store at the end of the
   huge mapping.

5) Page from #3 is invalid, we get a fault and go to the hugepage
   fault handler.  This tries to map a huge page and calls
   huge_ptep_set_access_flags() to install the mapping.

6) We just call the generic ptep_set_access_flags() to set up the page
   tables, but the flush there assumes a normal (4K sized) page and
   only tries to flush the first part of the huge page virtual address
   out of the TLB, since the existing entry from step #3 doesn't
   conflict, nothing is flushed.

7) We attempt to load the mapping into the TLB, but because it
   conflicts with the entry from step #3, we get a Machine Check
   exception.

The fix: Flush the entire rage covered by the huge page in
huge_ptep_set_access_flags(), and remove the optimization in
local_flush_tlb_range() so that the flush actually does the correct
thing.

Signed-off-by: David Daney <david.daney@cavium.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Cc: Hillf Danton <dhillf@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/4661/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
(cherry picked from commit dd617f258cc39d36be26afee9912624a2d23112c)
2012-12-04 16:57:54 +01:00
..
alpha Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2012-11-18 09:13:48 -10:00
arm Merge branch 'i2c-embedded/for-current' of git://git.pengutronix.de/git/wsa/linux 2012-11-23 11:59:26 -10:00
arm64 arm64: Distinguish between user and kernel XN bits 2012-11-16 15:50:25 +00:00
avr32
blackfin
c6x
cris
frv frv: fix the broken preempt 2012-11-02 12:08:25 -04:00
h8300 h8300: add missing L1_CACHE_SHIFT 2012-11-09 06:41:47 +01:00
hexagon
ia64 revert "mm: fix-up zone present pages" 2012-11-16 14:33:04 -08:00
m32r
m68k m68k: fix sigset_t accessor functions 2012-11-18 10:32:16 +01:00
microblaze
mips MIPS: Avoid mcheck by flushing page range in huge_ptep_set_access_flags() 2012-12-04 16:57:54 +01:00
mn10300
openrisc
parisc [PARISC] fix user-triggerable panic on parisc 2012-11-22 09:33:12 +00:00
powerpc powerpc/eeh: Do not invalidate PE properly 2012-11-26 09:14:16 +11:00
s390 s390/mm: have 16 byte aligned struct pages 2012-11-13 11:03:09 +01:00
score
sh
sparc Device tree regression fix for v3.7 2012-11-23 12:36:06 -10:00
tile arch/tile: avoid build warnings from duplicate ELF_R_xxx #defines 2012-10-23 10:22:48 -04:00
um
unicore32 arch/unicore32: remove CONFIG_EXPERIMENTAL 2012-11-09 17:30:10 +08:00
x86 Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2012-11-23 20:03:14 -10:00
xtensa xtensa: switch to generic sys_execve() 2012-10-25 15:00:44 -07:00
.gitignore
Kconfig