Index: sandbox/win/src/sandbox_policy_base.cc |
diff --git a/sandbox/win/src/sandbox_policy_base.cc b/sandbox/win/src/sandbox_policy_base.cc |
index 758a8bea58c59a226a0463f724bcc32e770422fb..89a605077de851b509cda54ecde11e53ccb0a623 100644 |
--- a/sandbox/win/src/sandbox_policy_base.cc |
+++ b/sandbox/win/src/sandbox_policy_base.cc |
@@ -80,6 +80,8 @@ PolicyBase::PolicyBase() |
initial_level_(USER_LOCKDOWN), |
job_level_(JOB_LOCKDOWN), |
ui_exceptions_(0), |
+ process_memory_limit_(0), |
cpu_(ooo_6.6-7.5)
2014/06/06 19:44:05
maybe rename to memory_limit_ ?
jschuh
2014/06/06 20:13:14
Sure.
|
+ terminate_on_memory_limit_(false), |
use_alternate_desktop_(false), |
use_alternate_winstation_(false), |
file_system_init_(false), |
@@ -167,6 +169,19 @@ ResultCode PolicyBase::SetJobLevel(JobLevel job_level, uint32 ui_exceptions) { |
return SBOX_ALL_OK; |
} |
+ResultCode PolicyBase::SetJobMemoryLimit(size_t limit, bool terminate) { |
+ if (limit && job_level_ == JOB_NONE) { |
+ return SBOX_ERROR_BAD_PARAMS; |
+ } |
+ process_memory_limit_ = limit; |
+ terminate_on_memory_limit_ = terminate; |
+ return SBOX_ALL_OK; |
+} |
+ |
+bool PolicyBase::WillTerminateOnJobMemoryLimit() const { |
+ return terminate_on_memory_limit_; |
+} |
+ |
ResultCode PolicyBase::SetAlternateDesktop(bool alternate_winstation) { |
use_alternate_desktop_ = true; |
use_alternate_winstation_ = alternate_winstation; |
@@ -459,6 +474,7 @@ ResultCode PolicyBase::MakeJobObject(HANDLE* job) { |
if (job_level_ != JOB_NONE) { |
// Create the windows job object. |
Job job_obj; |
+ job_obj.SetProcessMemoryLimit(process_memory_limit_); |
DWORD result = job_obj.Init(job_level_, NULL, ui_exceptions_); |
cpu_(ooo_6.6-7.5)
2014/06/06 19:44:05
seems best to move to job_obj.Init(..., memory_lim
jschuh
2014/06/06 20:13:14
Sure.
|
if (ERROR_SUCCESS != result) { |
return SBOX_ERROR_GENERIC; |