select: call seltdfini on process and thread exit

Since thread_zone is marked NOFREE the thread_fini callback is never
executed, meaning memory allocated by seltdinit is never released.

Adding the call to thread_dtor is not sufficient as exiting processes
cache the main thread.
This commit is contained in:
Mateusz Guzik 2020-11-16 03:12:21 +00:00
parent 31b2ac4b5a
commit 19d3e47dca
2 changed files with 4 additions and 1 deletions

View File

@ -355,6 +355,7 @@ exit1(struct thread *td, int rval, int signo)
PROC_UNLOCK(p);
umtx_thread_exit(td);
seltdfini(td);
/*
* Reset any sigio structures pointing to us as a result of

View File

@ -329,6 +329,7 @@ thread_ctor(void *mem, int size, void *arg, int flags)
audit_thread_alloc(td);
#endif
umtx_thread_alloc(td);
MPASS(td->td_sel == NULL);
return (0);
}
@ -369,6 +370,7 @@ thread_dtor(void *mem, int size, void *arg)
osd_thread_exit(td);
td_softdep_cleanup(td);
MPASS(td->td_su == NULL);
seltdfini(td);
}
/*
@ -405,7 +407,7 @@ thread_fini(void *mem, int size)
turnstile_free(td->td_turnstile);
sleepq_free(td->td_sleepqueue);
umtx_thread_fini(td);
seltdfini(td);
MPASS(td->td_sel == NULL);
}
/*