security/sandbox/win/src/process_mitigations.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
michael@0 2 // Use of this source code is governed by a BSD-style license that can be
michael@0 3 // found in the LICENSE file.
michael@0 4
michael@0 5 #ifndef SANDBOX_SRC_WIN_PROCESS_MITIGATIONS_H_
michael@0 6 #define SANDBOX_SRC_WIN_PROCESS_MITIGATIONS_H_
michael@0 7
michael@0 8 #include <windows.h>
michael@0 9
michael@0 10 #include "base/basictypes.h"
michael@0 11 #include "sandbox/win/src/security_level.h"
michael@0 12
michael@0 13 namespace sandbox {
michael@0 14
michael@0 15 // Sets the mitigation policy for the current process, ignoring any settings
michael@0 16 // that are invalid for the current version of Windows.
michael@0 17 bool ApplyProcessMitigationsToCurrentProcess(MitigationFlags flags);
michael@0 18
michael@0 19 // Returns the flags that must be enforced after startup for the current OS
michael@0 20 // version.
michael@0 21 MitigationFlags FilterPostStartupProcessMitigations(MitigationFlags flags);
michael@0 22
michael@0 23 // Converts sandbox flags to the PROC_THREAD_ATTRIBUTE_SECURITY_CAPABILITIES
michael@0 24 // policy flags used by UpdateProcThreadAttribute(). The size field varies
michael@0 25 // between a 32-bit and a 64-bit type based on the exact build and version of
michael@0 26 // Windows, so the returned size must be passed to UpdateProcThreadAttribute().
michael@0 27 void ConvertProcessMitigationsToPolicy(MitigationFlags flags,
michael@0 28 DWORD64* policy_flags, size_t* size);
michael@0 29
michael@0 30 // Adds mitigations that need to be performed on the suspended target process
michael@0 31 // before execution begins.
michael@0 32 bool ApplyProcessMitigationsToSuspendedProcess(HANDLE process,
michael@0 33 MitigationFlags flags);
michael@0 34
michael@0 35 // Returns true if all the supplied flags can be set after a process starts.
michael@0 36 bool CanSetProcessMitigationsPostStartup(MitigationFlags flags);
michael@0 37
michael@0 38 // Returns true if all the supplied flags can be set before a process starts.
michael@0 39 bool CanSetProcessMitigationsPreStartup(MitigationFlags flags);
michael@0 40
michael@0 41 } // namespace sandbox
michael@0 42
michael@0 43 #endif // SANDBOX_SRC_WIN_PROCESS_MITIGATIONS_H_
michael@0 44

mercurial