about summary refs log tree commit homepage
path: root/lib/unicorn/configurator.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2017-03-23 00:06:08 +0000
committerEric Wong <e@80x24.org>2017-03-23 00:06:08 +0000
commit3acb0d5d2592415e8f415aea37c929a4392142fc (patch)
treedf201e152873f9fb6e4435a3aca590de593ccde6 /lib/unicorn/configurator.rb
parent079da35629a507719a7c15324cfba4e9c5a7be4d (diff)
parentd0afe48696a643a5d7400b3db1d68cfd81e8cd38 (diff)
downloadunicorn-3acb0d5d2592415e8f415aea37c929a4392142fc.tar.gz
* origin/worker_exec:
  Don't pass a block for fork when forking workers
  Add worker_exec configuration option
Diffstat (limited to 'lib/unicorn/configurator.rb')
-rw-r--r--lib/unicorn/configurator.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb
index 9f7f56f..f404aea 100644
--- a/lib/unicorn/configurator.rb
+++ b/lib/unicorn/configurator.rb
@@ -53,6 +53,7 @@ class Unicorn::Configurator
         server.logger.info("worker=#{worker.nr} ready")
       },
     :pid => nil,
+    :worker_exec => false,
     :preload_app => false,
     :check_client_connection => false,
     :rewindable_input => true,
@@ -239,6 +240,15 @@ class Unicorn::Configurator
     set[:timeout] = seconds > max ? max : seconds
   end
 
+  # Whether to exec in each worker process after forking.  This changes the
+  # memory layout of each worker process, which is a security feature designed
+  # to defeat possible address space discovery attacks.  Note that using
+  # worker_exec only makes sense if you are not preloading the application,
+  # and will result in higher memory usage.
+  def worker_exec(bool)
+    set_bool(:worker_exec, bool)
+  end
+
   # sets the current number of worker_processes to +nr+.  Each worker
   # process will serve exactly one client at a time.  You can
   # increment or decrement this value at runtime by sending SIGTTIN