Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Oct 2019 19:33:00 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r353481 - head/sys/powerpc/booke
Message-ID:  <201910131933.x9DJX0cv094343@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhibbits
Date: Sun Oct 13 19:33:00 2019
New Revision: 353481
URL: https://svnweb.freebsd.org/changeset/base/353481

Log:
  powerpc/pmap: Tighten condition for removing tracked pages in Book-E pmap
  
  There are cases where there's no vm_page_t structure for a given physical
  address, such as the CCSR.  In this case, trying to obtain the
  md.page_tracked struct member would lead to a NULL dereference, and panic.
  Tighten this up by checking for kernel_pmap AND that the page structure
  actually exists before dereferencing.  The flag can only be set when it's
  tracked in the kernel pmap anyway.
  
  MFC after:	3 weeks

Modified:
  head/sys/powerpc/booke/pmap.c

Modified: head/sys/powerpc/booke/pmap.c
==============================================================================
--- head/sys/powerpc/booke/pmap.c	Sun Oct 13 18:17:08 2019	(r353480)
+++ head/sys/powerpc/booke/pmap.c	Sun Oct 13 19:33:00 2019	(r353481)
@@ -1177,7 +1177,7 @@ pte_remove(mmu_t mmu, pmap_t pmap, vm_offset_t va, u_i
 
 		/* Remove pv_entry from pv_list. */
 		pv_remove(pmap, va, m);
-	} else if (m->md.pv_tracked) {
+	} else if (pmap == kernel_pmap && m && m->md.pv_tracked) {
 		pv_remove(pmap, va, m);
 		if (TAILQ_EMPTY(&m->md.pv_list))
 			m->md.pv_tracked = false;
@@ -1373,7 +1373,7 @@ pte_remove(mmu_t mmu, pmap_t pmap, vm_offset_t va, uin
 			vm_page_aflag_set(m, PGA_REFERENCED);
 
 		pv_remove(pmap, va, m);
-	} else if (m->md.pv_tracked) {
+	} else if (pmap == kernel_pmap && m && m->md.pv_tracked) {
 		/*
 		 * Always pv_insert()/pv_remove() on MPC85XX, in case DPAA is
 		 * used.  This is needed by the NCSW support code for fast



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910131933.x9DJX0cv094343>