diff options
author | mcgrathr@chromium.org <mcgrathr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-15 18:49:10 +0000 |
---|---|---|
committer | mcgrathr@chromium.org <mcgrathr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-15 18:49:10 +0000 |
commit | 77540fdf1711d53e8a0b8fbee31fef2fe7612144 (patch) | |
tree | f51f3cec4d85b5921d230664e315cbf9e6bdcc2d /base/process_util.h | |
parent | f4e173359ac13f91efdb3bc60c99204b9e72ee11 (diff) | |
download | chromium_src-77540fdf1711d53e8a0b8fbee31fef2fe7612144.zip chromium_src-77540fdf1711d53e8a0b8fbee31fef2fe7612144.tar.gz chromium_src-77540fdf1711d53e8a0b8fbee31fef2fe7612144.tar.bz2 |
Maximize RLIMIT_AS resource limit in nacl_helper child before exec
NaCl processes need an unusually large amount of address space, because
they do huge PROT_NONE mappings to reserve contiguous regions much larger
than the memory that will actually be used. An ambient RLIMIT_AS setting
can break this, so we need to raise the soft limit to the hard limit (which
is usually unlimited).
We cannot rely on doing this inside the nacl_helper child itself, so we
must do it in the zygote before it exec's nacl_helper_bootstrap. That exec
itself could fail if the limit is too small, because nacl_helper_bootstrap
uses ELF program headers to reserve a large region of address space.
BUG= http://code.google.com/p/nativeclient/issues/detail?id=2438
TEST= nacl apps work when "ulimit -S -v 5376320" was run before starting chrome
R=mark@chromium.org,bsy@google.com,bradchen@google.com
Review URL: http://codereview.chromium.org/8528041
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110123 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util.h')
-rw-r--r-- | base/process_util.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/base/process_util.h b/base/process_util.h index fe2ad81..fb2eb44 100644 --- a/base/process_util.h +++ b/base/process_util.h @@ -31,6 +31,7 @@ typedef struct _malloc_zone_t malloc_zone_t; #endif #include <list> +#include <set> #include <string> #include <utility> #include <vector> @@ -219,7 +220,8 @@ struct LaunchOptions { start_hidden(false), inherit_handles(false), as_user(NULL), empty_desktop_name(false), job_handle(NULL) #else - environ(NULL), fds_to_remap(NULL), new_process_group(false) + environ(NULL), fds_to_remap(NULL), maximize_rlimits(NULL), + new_process_group(false) #if defined(OS_LINUX) , clone_flags(0) #endif // OS_LINUX @@ -265,6 +267,11 @@ struct LaunchOptions { // call to LaunchProcess(). const file_handle_mapping_vector* fds_to_remap; + // Each element is an RLIMIT_* constant that should be raised to its + // rlim_max. This pointer is owned by the caller and must live through + // the call to LaunchProcess(). + const std::set<int>* maximize_rlimits; + // If true, start the process in a new process group, instead of // inheriting the parent's process group. The pgid of the child process // will be the same as its pid. |