| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SANDBOX_LINUX_SERVICES_YAMA_H_ | 5 #ifndef SANDBOX_LINUX_SERVICES_YAMA_H_ |
| 6 #define SANDBOX_LINUX_SERVICES_YAMA_H_ | 6 #define SANDBOX_LINUX_SERVICES_YAMA_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/process/process_handle.h" | 9 #include "base/process/process_handle.h" |
| 10 #include "sandbox/linux/sandbox_export.h" |
| 10 | 11 |
| 11 namespace sandbox { | 12 namespace sandbox { |
| 12 | 13 |
| 13 // Yama is a LSM kernel module which can restrict ptrace(). | 14 // Yama is a LSM kernel module which can restrict ptrace(). |
| 14 // This class provides ways to detect if Yama is present and enabled | 15 // This class provides ways to detect if Yama is present and enabled |
| 15 // and to restrict which processes can ptrace the current process. | 16 // and to restrict which processes can ptrace the current process. |
| 16 class Yama { | 17 class SANDBOX_EXPORT Yama { |
| 17 public: | 18 public: |
| 18 // This enum should be used to set or check a bitmask. | 19 // This enum should be used to set or check a bitmask. |
| 19 // A value of 0 would indicate that the status is not known. | 20 // A value of 0 would indicate that the status is not known. |
| 20 enum GlobalStatus { | 21 enum GlobalStatus { |
| 21 STATUS_KNOWN = 1 << 0, | 22 STATUS_KNOWN = 1 << 0, |
| 22 STATUS_PRESENT = 1 << 1, | 23 STATUS_PRESENT = 1 << 1, |
| 23 STATUS_ENFORCING = 1 << 2, | 24 STATUS_ENFORCING = 1 << 2, |
| 24 // STATUS_STRICT_ENFORCING corresponds to either mode 2 or mode 3 of Yama. | 25 // STATUS_STRICT_ENFORCING corresponds to either mode 2 or mode 3 of Yama. |
| 25 // Ptrace could be entirely denied, or restricted to CAP_SYS_PTRACE | 26 // Ptrace could be entirely denied, or restricted to CAP_SYS_PTRACE |
| 26 // and PTRACE_TRACEME. | 27 // and PTRACE_TRACEME. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 48 // Helper for checkking for STATUS_ENFORCING in GetStatus(). | 49 // Helper for checkking for STATUS_ENFORCING in GetStatus(). |
| 49 static bool IsEnforcing(); | 50 static bool IsEnforcing(); |
| 50 | 51 |
| 51 private: | 52 private: |
| 52 DISALLOW_IMPLICIT_CONSTRUCTORS(Yama); | 53 DISALLOW_IMPLICIT_CONSTRUCTORS(Yama); |
| 53 }; | 54 }; |
| 54 | 55 |
| 55 } // namespace sandbox | 56 } // namespace sandbox |
| 56 | 57 |
| 57 #endif // SANDBOX_LINUX_SERVICES_YAMA_H_ | 58 #endif // SANDBOX_LINUX_SERVICES_YAMA_H_ |
| OLD | NEW |