[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-bugs] #32103 [Core Tor/Tor]: Subsystem "thread_cleanup" is never called



#32103: Subsystem "thread_cleanup" is never called
--------------------+------------------------------
 Reporter:  opara   |          Owner:  (none)
     Type:  defect  |         Status:  new
 Priority:  Medium  |      Component:  Core Tor/Tor
  Version:          |       Severity:  Normal
 Keywords:          |  Actual Points:
Parent ID:          |         Points:
 Reviewer:          |        Sponsor:
--------------------+------------------------------
 Subsystems implement the interface of `struct subsys_fns_t`, with one of
 the optional function pointers being `void (*thread_cleanup)(void)`. This
 `thread_cleanup` function is called for all subsystems by the subsystem
 manager function `void subsystems_thread_cleanup(void)`, but the
 `subsystems_thread_cleanup` function is never called anywhere in the code.

 At the moment, the only subsystem to implement the `thread_cleanup`
 interface is the crypto subsystem, which uses `thread_cleanup` for freeing
 the threadlocal `crypto_fast_rng_t`, as well as freeing the threadlocal
 error queue on old versions of OpenSSL. As far as I can tell, this is
 never run.

 I think that the `subsystems_thread_cleanup` function should be run
 somewhere in the code, but it's not clear to me how this
 `subsystems_thread_cleanup` is expected to be used. It seems like there
 should also be `subsystems_thread_init` and `thread_init` functions as
 well for initializing threadlocal variables. Right now the crypto
 subsystem does an
 [https://github.com/torproject/tor/blob/dfe7f004df46edaab0b23e260218d3c6d422d5fe/src/lib/crypt_ops/crypto_rand_fast.c#L382
 "initialize on first use" singleton pattern], but it might be useful to
 add this initialization interface function so that subsystems have the
 option of initializing all of their threadlocals in one place.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/32103>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs