summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2019-04-16 14:32:45 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2019-04-16 14:32:45 +0000
commit3a60c52d1d6fc6f3844ad136c7d1d06f94f70437 (patch)
tree2b1332fa479dff7ce3c7cc45de99e06710eb63e4
parent4d5e085bc2e781f73e7aad28d88d7b93f5cf0fbb (diff)
When entering kernel pages uncached we need to make sure to flush the
caches. If the physical page was previously used by userland it is likely that this page is still in the cache and writing to the newly mapped page could result in unexpected behaviour. ok kettenis@
-rw-r--r--sys/arch/arm64/arm64/pmap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/arch/arm64/arm64/pmap.c b/sys/arch/arm64/arm64/pmap.c
index f0366c8d8c7..59b018eaddc 100644
--- a/sys/arch/arm64/arm64/pmap.c
+++ b/sys/arch/arm64/arm64/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.60 2019/02/10 22:45:58 tedu Exp $ */
+/* $OpenBSD: pmap.c,v 1.61 2019/04/16 14:32:44 patrick Exp $ */
/*
* Copyright (c) 2008-2009,2014-2016 Dale Rahn <drahn@dalerahn.com>
*
@@ -650,6 +650,8 @@ _pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot, int flags, int cache)
pmap_pte_insert(pted);
ttlb_flush(pm, va & ~PAGE_MASK);
+ if (cache == PMAP_CACHE_CI || cache == PMAP_CACHE_DEV)
+ cpu_idcache_wbinv_range(va & ~PAGE_MASK, PAGE_SIZE);
}
void