[tor-bugs] #30614 [Core Tor/Tor]: Use MAP_INHERIT_NONE/ZERO if available instead of crashing on assertion failure

Tor Bug Tracker & Wiki blackhole at torproject.org
Sat May 25 04:12:51 UTC 2019


#30614: Use MAP_INHERIT_NONE/ZERO if available instead of crashing on assertion
failure
--------------------------------+------------------------------
 Reporter:  riastradh           |          Owner:  (none)
     Type:  defect              |         Status:  new
 Priority:  Medium              |      Component:  Core Tor/Tor
  Version:  Tor: 0.4.1.1-alpha  |       Severity:  Normal
 Keywords:                      |  Actual Points:
Parent ID:                      |         Points:
 Reviewer:                      |        Sponsor:
--------------------------------+------------------------------
 On NetBSD, the way to ask a page range be zero'd or unmapped on fork is
 `minherit(addr, nbytes, MAP_INHERIT_ZERO)` or `minherit(addr, nbytes,
 MAP_INHERIT_NONE)`.  However,

 - map_anon.c does not actually check for or use `MAP_INHERIT_ZERO` or
 `MAP_INHERIT_NONE`, so
 - `FLAG_NOINHERIT` is undefined, so
 - `tor_mmap_anonymous` fails to disinherit the mapping, so
 - `crypto_fast_rng_new_from_seed` throws a fit.

 {{{
 slow/prob_distr/stochastic_log_logistic: [forking] May 25 03:56:58.091
 [err] tor_assertion_failed_(): Bug:
 src/lib/crypt_ops/crypto_rand_fast.c:184: crypto_fast_rng_new_from_seed:
 Assertion inherit != INHERIT_RES_KEEP failed; aborting. (on Tor 0.4.1.1
 -alpha-dev 29955f13e5bc8e61)
 May 25 03:56:58.091 [err] Bug: Assertion inherit != INHERIT_RES_KEEP
 failed in crypto_fast_rng_new_from_seed at
 src/lib/crypt_ops/crypto_rand_fast.c:184: . (Stack trace not available)
 (on Tor 0.4.1.1-alpha-dev 29955f13e5bc8e61)
 [Lost connection!]
 }}}

 The attached patch checks for and uses `MAP_INHERIT_ZERO` and
 `MAP_INHERIT_NONE`.  '''However, it does not adjust the code path that
 gets confused if `tor_mmap_anonymous` fails to disinherit the mapping,'''
 which might be worth doing too, perhaps earlier on by detecting and
 noisily reporting a lack of support for cutting off the hereditary
 concentration of wealth, or at least secrets, in society before it's too
 late.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/30614>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list