Skip to content
  • Jacob Appelbaum's avatar
    Implement DisableAllSwap to avoid putting secret info in page files. · 2aac39a7
    Jacob Appelbaum authored and Roger Dingledine's avatar Roger Dingledine committed
    This commit implements a new config option: 'DisableAllSwap'
    This option probably only works properly when Tor is started as root.
    We added two new functions: tor_mlockall() and tor_set_max_memlock().
    tor_mlockall() attempts to mlock() all current and all future memory pages.
    For tor_mlockall() to work properly we set the process rlimits for memory to
    RLIM_INFINITY (and beyond) inside of tor_set_max_memlock().
    We behave differently from mlockall() by only allowing tor_mlockall() to be
    called one single time. All other calls will result in a return code of 1.
    It is not possible to change DisableAllSwap while running.
    A sample configuration item was added to the torrc.complete.in config file.
    A new item in the man page for DisableAllSwap was added.
    Thanks to Moxie Marlinspike and Chris Palmer for their feedback on this patch.
    
    Please note that we make no guarantees about the quality of your OS and its
    mlock/mlockall implementation. It is possible that this will do nothing at all.
    It is also possible that you can ulimit the mlock properties of a given user
    such that root is not required. This has not been extensively tested and is
    unsupported. I have included some comments for possible ways we can handle
    this on win32.
    2aac39a7