[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-bugs] #17800 [Tor]: Tor Unit Tests should TT_FORK before initialising global PRNG state
#17800: Tor Unit Tests should TT_FORK before initialising global PRNG state
------------------------+---------------------------------
Reporter: teor | Owner:
Type: defect | Status: new
Priority: Low | Milestone: Tor: very long term
Component: Tor | Version:
Severity: Minor | Keywords: easy
Actual Points: | Parent ID:
Points: | Sponsor:
------------------------+---------------------------------
Tor unit tests are meant to TT_FORK before changing any global process
state that can't be reverted.
In #17789, we discovered that one or more tests initialise the OpenSSL
CSPRNG without forking first. (This can't be undone.)
While this isn't likely to cause any issues, (#17789 was marked as wontfix
for other reasons), it would be nice to fix it eventually for correctness.
One way to do this is:
* initialise a static variable to 0.
* set it to 1 just after fork()ing via TT_FORK.
* tor_assert() that it's 1 in functions that irreversibly modify global
test process state, if TOR_UNIT_TESTS is defined:
* crypto_early_init(), which seeds the OpenSSL CSPRNG,
* (I'm sure many other init functions do similar things)
* mark the tests that assert as TT_FORK
Marked as Low/Minor because this doesn't currently cause any issues, but
if tests start failing due to interactions with previous global state, we
should look at it again.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/17800>
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