Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jul 2016 23:26:33 +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: r302919 - head/sys/kern
Message-ID:  <201607152326.u6FNQX1o078405@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Jul 15 23:26:33 2016
New Revision: 302919
URL: https://svnweb.freebsd.org/changeset/base/302919

Log:
  In ptrace_vm_entry(), do not call vmspace_free() while owning a vm
  object lock.
  
  The vmspace_free() operations might need to lock map, object etc on
  last dereference.  Postpone the free until object's inspection is
  done.
  
  Reported and tested by:	will
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/kern/sys_process.c

Modified: head/sys/kern/sys_process.c
==============================================================================
--- head/sys/kern/sys_process.c	Fri Jul 15 23:24:00 2016	(r302918)
+++ head/sys/kern/sys_process.c	Fri Jul 15 23:26:33 2016	(r302919)
@@ -433,7 +433,6 @@ ptrace_vm_entry(struct thread *td, struc
 	} while (0);
 
 	vm_map_unlock_read(map);
-	vmspace_free(vm);
 
 	pve->pve_fsid = VNOVAL;
 	pve->pve_fileid = VNOVAL;
@@ -478,6 +477,7 @@ ptrace_vm_entry(struct thread *td, struc
 				free(freepath, M_TEMP);
 		}
 	}
+	vmspace_free(vm);
 	if (error == 0)
 		CTR3(KTR_PTRACE, "PT_VM_ENTRY: pid %d, entry %d, start %p",
 		    p->p_pid, pve->pve_entry, pve->pve_start);



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