summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2016-07-30 23:13:03 +0200
committerTom Rini <trini@konsulko.com>2016-08-05 20:55:18 -0400
commit0e1709476bd4cbff2c0808c87867b6cd5286818f (patch)
treed2654c16f9b2ff66c664f9dde2b84aed11b021d8 /arch
parentc2fdd34569145ad281aeea5ef16fff83d7075830 (diff)
downloadu-boot-imx-0e1709476bd4cbff2c0808c87867b6cd5286818f.zip
u-boot-imx-0e1709476bd4cbff2c0808c87867b6cd5286818f.tar.gz
u-boot-imx-0e1709476bd4cbff2c0808c87867b6cd5286818f.tar.bz2
armv8: mmu: Detect page table overflow in emergency pt creation
We create 2 sets of page tables: One for normal operation, one for emergency (used while modifying the former). Because the page tables grow dynamically, we have code that checks for overflow. Unfortunately we didn't adjust the available space variable while creating the emergency tables, so potentially someone might run into an overflow there (not seen in real world yet though!). Fix it by properly adjusting the size as well as the base offset in emergency page table creation. Reported-by: York Sun <york.sun@nxp.com> Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: York Sun <york.sun@nxp.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/cpu/armv8/cache_v8.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/arm/cpu/armv8/cache_v8.c b/arch/arm/cpu/armv8/cache_v8.c
index ac909a1..cd3f6c1 100644
--- a/arch/arm/cpu/armv8/cache_v8.c
+++ b/arch/arm/cpu/armv8/cache_v8.c
@@ -380,6 +380,7 @@ void setup_pgtables(void)
static void setup_all_pgtables(void)
{
u64 tlb_addr = gd->arch.tlb_addr;
+ u64 tlb_size = gd->arch.tlb_size;
/* Reset the fill ptr */
gd->arch.tlb_fillptr = tlb_addr;
@@ -388,10 +389,13 @@ static void setup_all_pgtables(void)
setup_pgtables();
/* Create emergency page tables */
+ gd->arch.tlb_size -= (uintptr_t)gd->arch.tlb_fillptr -
+ (uintptr_t)gd->arch.tlb_addr;
gd->arch.tlb_addr = gd->arch.tlb_fillptr;
setup_pgtables();
gd->arch.tlb_emerg = gd->arch.tlb_addr;
gd->arch.tlb_addr = tlb_addr;
+ gd->arch.tlb_size = tlb_size;
}
/* to activate the MMU we need to set up virtual memory */