diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 3100bf830333..5f4f43c23526 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -244,6 +244,10 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) /* Copy the LDT, if necessary. */ mdp1 = &td1->td_proc->p_md; mdp2 = &p2->p_md; + if (mdp1->md_ldt == NULL) { + mdp2->md_ldt = NULL; + return; + } mtx_lock(&dt_lock); if (mdp1->md_ldt != NULL) { if (flags & RFMEM) {