From f470cca578ae7df002027623c0ee9142eef77e07 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Fri, 15 Jul 2016 23:26:33 +0000 Subject: [PATCH] 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 --- sys/kern/sys_process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index ff6386b68f15..f1477ce33516 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -433,7 +433,6 @@ ptrace_vm_entry(struct thread *td, struct proc *p, struct ptrace_vm_entry *pve) } 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, struct proc *p, struct ptrace_vm_entry *pve) 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);