Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Sep 2018 14:11:01 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r338998 - head/sys/vm
Message-ID:  <201809281411.w8SEB10J077969@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Sep 28 14:11:01 2018
New Revision: 338998
URL: https://svnweb.freebsd.org/changeset/base/338998

Log:
  In vm_fault_copy_entry(), we should not assert that entry is charged
  if the dst_object is not of swap type.
  
  It can only happen when entry does not require copy, otherwise
  vm_map_protect() already adds the charge. So the assert was right for
  the case where swap object was allocated in the vm_fault_copy_entry(),
  but not when it was just copied from src_entry and its type is not
  swap.
  
  Reported by:	andrew using syzkaller
  Reviewed by:	alc
  Sponsored by:	The FreeBSD Foundation
  Approved by:	re (gjb)
  MFC after:	1 week
  Differential revision:	https://reviews.freebsd.org/D17323

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==============================================================================
--- head/sys/vm/vm_fault.c	Fri Sep 28 14:10:12 2018	(r338997)
+++ head/sys/vm/vm_fault.c	Fri Sep 28 14:11:01 2018	(r338998)
@@ -1650,7 +1650,9 @@ vm_fault_copy_entry(vm_map_t dst_map, vm_map_t src_map
 		dst_object->cred = curthread->td_ucred;
 		crhold(dst_object->cred);
 		*fork_charge += dst_object->charge;
-	} else if (dst_object->cred == NULL) {
+	} else if ((dst_object->type == OBJT_DEFAULT ||
+	    dst_object->type == OBJT_SWAP) &&
+	    dst_object->cred == NULL) {
 		KASSERT(dst_entry->cred != NULL, ("no cred for entry %p",
 		    dst_entry));
 		dst_object->cred = dst_entry->cred;



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