android_kernel_xiaomi_sm8350/arch/sparc/mm
David S. Miller d8ed1d43e1 sparc64: Validate linear D-TLB misses.
When page alloc debugging is not enabled, we essentially accept any
virtual address for linear kernel TLB misses.  But with kgdb, kernel
address probing, and other facilities we can try to access arbitrary
crap.

So, make sure the address we miss on will translate to physical memory
that actually exists.

In order to make this work we have to embed the valid address bitmap
into the kernel image.  And in order to make that less expensive we
make an adjustment, in that the max physical memory address is
decreased to "1 << 41", even on the chips that support a 42-bit
physical address space.  We can do this because bit 41 indicates
"I/O space" and thus covers non-memory ranges.

The result of this is that:

1) kpte_linear_bitmap shrinks from 2K to 1K in size

2) we need 64K more for the valid address bitmap

We can't let the valid address bitmap be dynamically allocated
once we start using it to validate TLB misses, otherwise we have
crazy issues to deal with wrt. recursive TLB misses and such.

If we're in a TLB miss it could be the deepest trap level that's legal
inside of the cpu.  So if we TLB miss referencing the bitmap, the cpu
will be out of trap levels and enter RED state.

To guard against out-of-range accesses to the bitmap, we have to check
to make sure no bits in the physical address above bit 40 are set.  We
could export and use last_valid_pfn for this check, but that's just an
unnecessary extra memory reference.

On the plus side of all this, since we load all of these translations
into the special 4MB mapping TSB, and we check the TSB first for TLB
misses, there should be absolutely no real cost for these new checks
in the TLB miss path.

Reported-by: heyongli@gmail.com
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-08-25 16:47:46 -07:00
..
btfixup.c
extable.c module: trim exception table on init free. 2009-06-12 21:47:04 +09:30
fault_32.c sparc: Use page_fault_out_of_memory() for VM_FAULT_OOM. 2009-08-02 19:17:15 -07:00
fault_64.c sparc: Use page_fault_out_of_memory() for VM_FAULT_OOM. 2009-08-02 19:17:15 -07:00
generic_32.c
generic_64.c
highmem.c mm: use debug_kmap_atomic 2009-04-01 08:59:14 -07:00
hugetlbpage.c
hypersparc.S
init_32.c sparc: Call OF and MD cpu scanning explicitly from paging_init() 2009-06-16 04:56:19 -07:00
init_64.c sparc64: Validate linear D-TLB misses. 2009-08-25 16:47:46 -07:00
init_64.h sparc64: Validate linear D-TLB misses. 2009-08-25 16:47:46 -07:00
io-unit.c
iommu.c
loadmmu.c
Makefile
nosun4c.c
srmmu.c sparc: Simplify code using is_power_of_2() routine. 2009-06-16 04:56:51 -07:00
sun4c.c
swift.S
tlb.c
tsb.c
tsunami.S
ultra.S sparc64: Reschedule KGDB capture to a software interrupt. 2009-03-18 23:51:57 -07:00
viking.S