Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-3-0]: src/sys/arch Apply patch (requested by bouyer in ticket #20...



details:   https://anonhg.NetBSD.org/src/rev/91d5ff930ae6
branches:  netbsd-3-0
changeset: 579534:91d5ff930ae6
user:      snj <snj%NetBSD.org@localhost>
date:      Thu Apr 30 20:33:12 2009 +0000

description:
Apply patch (requested by bouyer in ticket #2012):
Fix a pmap race.

diffstat:

 sys/arch/amd64/amd64/pmap.c |   8 ++++++--
 sys/arch/i386/i386/pmap.c   |  10 ++++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diffs (74 lines):

diff -r 871972276ae6 -r 91d5ff930ae6 sys/arch/amd64/amd64/pmap.c
--- a/sys/arch/amd64/amd64/pmap.c       Thu Apr 30 17:57:52 2009 +0000
+++ b/sys/arch/amd64/amd64/pmap.c       Thu Apr 30 20:33:12 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.15.8.1 2005/06/06 12:16:28 tron Exp $       */
+/*     $NetBSD: pmap.c,v 1.15.8.1.2.1 2009/04/30 20:33:13 snj Exp $    */
 
 /*
  *
@@ -108,7 +108,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.15.8.1 2005/06/06 12:16:28 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.15.8.1.2.1 2009/04/30 20:33:13 snj Exp $");
 
 #ifndef __x86_64__
 #include "opt_cputype.h"
@@ -2488,6 +2488,8 @@
 
                /* atomically save the old PTE and zap! it */
                opte = pmap_pte_set(pte, 0);
+               if (!pmap_valid_entry(opte))
+                       continue;
 
                if (opte & PG_W)
                        pmap->pm_stats.wired_count--;
@@ -2570,6 +2572,8 @@
 
        /* atomically save the old PTE and zap! it */
        opte = pmap_pte_set(pte, 0);
+       if (!pmap_valid_entry(opte))
+               return(FALSE);
 
        if (opte & PG_W)
                pmap->pm_stats.wired_count--;
diff -r 871972276ae6 -r 91d5ff930ae6 sys/arch/i386/i386/pmap.c
--- a/sys/arch/i386/i386/pmap.c Thu Apr 30 17:57:52 2009 +0000
+++ b/sys/arch/i386/i386/pmap.c Thu Apr 30 20:33:12 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.181.2.2 2005/09/26 20:24:52 tron Exp $      */
+/*     $NetBSD: pmap.c,v 1.181.2.2.2.1 2009/04/30 20:33:12 snj Exp $   */
 
 /*
  *
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.181.2.2 2005/09/26 20:24:52 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.181.2.2.2.1 2009/04/30 20:33:12 snj Exp $");
 
 #include "opt_cputype.h"
 #include "opt_user_ldt.h"
@@ -2423,6 +2423,9 @@
 
                /* atomically save the old PTE and zap! it */
                opte = x86_atomic_testset_ul(pte, 0);
+               if (!pmap_valid_entry(opte))
+                       continue;
+
                pmap_exec_account(pmap, startva, opte, 0);
 
                if (opte & PG_W)
@@ -2512,6 +2515,9 @@
 
        /* atomically save the old PTE and zap! it */
        opte = x86_atomic_testset_ul(pte, 0);
+       if (!pmap_valid_entry(opte))
+               return(FALSE);
+
        pmap_exec_account(pmap, va, opte, 0);
 
        if (opte & PG_W)



Home | Main Index | Thread Index | Old Index