Index: sys/amd64/amd64/sys_machdep.c =================================================================== --- sys/amd64/amd64/sys_machdep.c +++ sys/amd64/amd64/sys_machdep.c @@ -492,15 +492,19 @@ } static void -set_user_ldt_rv(struct vmspace *vmsp) +set_user_ldt_rv(void *arg) { - struct thread *td; + struct proc *orig, *target; + struct proc_ldt *ldt; + + orig = arg; + target = curthread->td_proc; - td = curthread; - if (vmsp != td->td_proc->p_vmspace) + ldt = (void *)atomic_load_acq_ptr((uintptr_t *)&orig->p_md.md_ldt); + if (target->p_md.md_ldt != ldt) return; - set_user_ldt(&td->td_proc->p_md); + set_user_ldt(&target->p_md); } struct proc_ldt * @@ -550,8 +554,7 @@ atomic_thread_fence_rel(); mdp->md_ldt = new_ldt; critical_exit(); - smp_rendezvous(NULL, (void (*)(void *))set_user_ldt_rv, NULL, - p->p_vmspace); + smp_rendezvous(NULL, set_user_ldt_rv, NULL, p); return (mdp->md_ldt); }