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
This commit is contained in:
Konstantin Belousov 2016-07-15 23:26:33 +00:00
parent 01f8ac1bec
commit f470cca578

View File

@ -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);