diff --git a/sys/kern/kern_cheri_revoke.c b/sys/kern/kern_cheri_revoke.c index aab79611925f..9ff1eacdd910 100644 --- a/sys/kern/kern_cheri_revoke.c +++ b/sys/kern/kern_cheri_revoke.c @@ -427,9 +427,7 @@ kern_cheri_revoke(struct thread *td, int flags, return ERESTART; } } - KASSERT(td->td_proc == curproc, - ("stop_vmspace_proc only works with curproc")); - stop_vmspace_proc(); + stop_vmspace_proc(td->td_proc); /* * Drop the process lock *then* iterate the threads in this @@ -537,7 +535,7 @@ kern_cheri_revoke(struct thread *td, int flags, PROC_LOCK(td->td_proc); _PRELE(td->td_proc); - resume_vmspace_proc(); + resume_vmspace_proc(td->td_proc); if ((td->td_proc->p_flag & P_HADTHREADS) != 0) { thread_single_end(td->td_proc, SINGLE_BOUNDARY); } diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index ad830b0f2f87..134bfe980e5c 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -3859,9 +3859,9 @@ resume_all_proc(void) * curproc. It should be run after curproc has entered thread_single. */ void -stop_vmspace_proc(void) +stop_vmspace_proc(struct proc* cp) { - struct proc *cp, *p; + struct proc *p; struct vmspace *vm; int r, gen; bool restart, seen_stopped, seen_exiting, stopped_some; @@ -3871,7 +3871,6 @@ stop_vmspace_proc(void) * Maybe atomic CAS on a field in vmspace? */ - cp = curproc; vm = cp->p_vmspace; vmspace_loop: VMSPACE_LOCK(vm); @@ -3932,12 +3931,11 @@ stop_vmspace_proc(void) } void -resume_vmspace_proc(void) +resume_vmspace_proc(struct proc *cp) { - struct proc *cp, *p; + struct proc *p; struct vmspace *vm; - cp = curproc; vm = cp->p_vmspace; VMSPACE_LOCK(vm); diff --git a/sys/sys/proc.h b/sys/sys/proc.h index ac968463904b..6d61ce2e970d 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1300,8 +1300,8 @@ void stop_all_proc_unblock(void); void stop_all_proc(void); void resume_all_proc(void); -void stop_vmspace_proc(void); -void resume_vmspace_proc(void); +void stop_vmspace_proc(struct proc *cp); +void resume_vmspace_proc(struct proc *cp); static __inline int curthread_pflags_set(int flags)