Skip to content
  • Nick Mathewson's avatar
    Get Libevent's PRNG functioning under the linux sandbox · e6785ee1
    Nick Mathewson authored
    Libevent uses an arc4random implementation (I know, I know) to
    generate DNS transaction IDs and capitalization.  But it liked to
    initialize it either with opening /dev/urandom (which won't work
    under the sandbox if it doesn't use the right pointer), or with
    sysctl({CTL_KERN,KERN_RANDOM,RANDOM_UUIC}).  To make _that_ work, we
    were permitting sysctl unconditionally.  That's not such a great
    idea.
    
    Instead, we try to initialize the libevent PRNG _before_ installing
    the sandbox, and make sysctl always fail with EPERM under the
    sandbox.
    e6785ee1