Author: markj
Date: Wed Oct 23 17:58:19 2019
New Revision: 353956
URL: https://svnweb.freebsd.org/changeset/base/353956

Log:
  Verify identity after checking for WAITFAIL in vm_page_busy_acquire().
  
  A caller that does not guarantee that a page's identity won't change
  while sleeping for a busy lock must specify either NOWAIT or WAITFAIL.
  
  Reported by:  syzkaller
  Reviewed by:  alc, kib
  Discussed with:       jeff
  Sponsored by: The FreeBSD Foundation
  Differential Revision:        https://reviews.freebsd.org/D22124

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c       Wed Oct 23 17:53:20 2019        (r353955)
+++ head/sys/vm/vm_page.c       Wed Oct 23 17:58:19 2019        (r353956)
@@ -900,9 +900,11 @@ vm_page_busy_acquire(vm_page_t m, int allocflags)
                    (allocflags & VM_ALLOC_SBUSY) != 0, locked);
                if (locked)
                        VM_OBJECT_WLOCK(obj);
-               MPASS(m->object == obj || m->object == NULL);
                if ((allocflags & VM_ALLOC_WAITFAIL) != 0)
                        return (FALSE);
+               KASSERT(m->object == obj || m->object == NULL,
+                   ("vm_page_busy_acquire: page %p does not belong to %p",
+                   m, obj));
        }
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to