| Index: sandbox/win/src/sandbox_policy_base.cc | 
| =================================================================== | 
| --- sandbox/win/src/sandbox_policy_base.cc	(revision 154997) | 
| +++ sandbox/win/src/sandbox_policy_base.cc	(working copy) | 
| @@ -15,6 +15,7 @@ | 
| #include "sandbox/win/src/handle_policy.h" | 
| #include "sandbox/win/src/job.h" | 
| #include "sandbox/win/src/interception.h" | 
| +#include "sandbox/win/src/process_mitigations.h" | 
| #include "sandbox/win/src/named_pipe_dispatcher.h" | 
| #include "sandbox/win/src/named_pipe_policy.h" | 
| #include "sandbox/win/src/policy_broker.h" | 
| @@ -54,6 +55,8 @@ | 
|  | 
| SANDBOX_INTERCEPT IntegrityLevel g_shared_delayed_integrity_level; | 
|  | 
| +SANDBOX_INTERCEPT uint64 g_shared_delayed_mitigations; | 
| + | 
| // Initializes static members. | 
| HWINSTA PolicyBase::alternate_winstation_handle_ = NULL; | 
| HDESK PolicyBase::alternate_desktop_handle_ = NULL; | 
| @@ -70,6 +73,8 @@ | 
| relaxed_interceptions_(true), | 
| integrity_level_(INTEGRITY_LEVEL_LAST), | 
| delayed_integrity_level_(INTEGRITY_LEVEL_LAST), | 
| +      mitigations_(0), | 
| +      delayed_mitigations_(0), | 
| policy_maker_(NULL), | 
| policy_(NULL) { | 
| ::InitializeCriticalSection(&lock_); | 
| @@ -276,6 +281,28 @@ | 
| return SBOX_ALL_OK; | 
| } | 
|  | 
| +ResultCode PolicyBase::SetProcessMitigations(uint64 flags) { | 
| +  if (!CanSetProcessMitigationsPreStartup(flags)) | 
| +    return SBOX_ERROR_BAD_PARAMS; | 
| +  mitigations_ = flags; | 
| +  return SBOX_ALL_OK; | 
| +} | 
| + | 
| +uint64 PolicyBase::GetProcessMitigations() { | 
| +  return mitigations_; | 
| +} | 
| + | 
| +ResultCode PolicyBase::SetDelayedProcessMitigations(uint64 flags) { | 
| +  if (!CanSetProcessMitigationsPostStartup(flags)) | 
| +    return SBOX_ERROR_BAD_PARAMS; | 
| +  delayed_mitigations_ = flags; | 
| +  return SBOX_ALL_OK; | 
| +} | 
| + | 
| +uint64 PolicyBase::GetDelayedProcessMitigations() { | 
| +  return delayed_mitigations_; | 
| +} | 
| + | 
| void PolicyBase::SetStrictInterceptions() { | 
| relaxed_interceptions_ = false; | 
| } | 
| @@ -450,6 +477,11 @@ | 
| if (NULL != policy_) | 
| policy_maker_->Done(); | 
|  | 
| +  if (!SetProcessMitigationsForSuspendedProcess(target->Process(), | 
| +                                                mitigations_)) { | 
| +    return false; | 
| +  } | 
| + | 
| if (!SetupAllInterceptions(target)) | 
| return false; | 
|  | 
| @@ -469,6 +501,19 @@ | 
| if (SBOX_ALL_OK != ret) | 
| return false; | 
|  | 
| +  // Add in delayed mitigations and pseudo-mitigations enforced at startup. | 
| +  g_shared_delayed_mitigations = delayed_mitigations_ | | 
| +      GetPostStartupProcessMitigations(mitigations_); | 
| +  if (!CanSetProcessMitigationsPostStartup(g_shared_delayed_mitigations)) | 
| +    return false; | 
| + | 
| +  ret = target->TransferVariable("g_shared_delayed_mitigations", | 
| +                                 &g_shared_delayed_mitigations, | 
| +                                 sizeof(g_shared_delayed_mitigations)); | 
| +  g_shared_delayed_mitigations = 0; | 
| +  if (SBOX_ALL_OK != ret) | 
| +    return false; | 
| + | 
| AutoLock lock(&lock_); | 
| targets_.push_back(target); | 
| return true; | 
|  |