| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_CREDENTIALS_H_ | 5 #ifndef SANDBOX_LINUX_SERVICES_CREDENTIALS_H_ |
| 6 #define SANDBOX_LINUX_SERVICES_CREDENTIALS_H_ | 6 #define SANDBOX_LINUX_SERVICES_CREDENTIALS_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 // Link errors are tedious to track, raise a compile-time error instead. | 9 // Link errors are tedious to track, raise a compile-time error instead. |
| 10 #if defined(OS_ANDROID) | 10 #if defined(OS_ANDROID) |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // CAP_SYS_CHROOT can be acquired by using the MoveToNewUserNS() API. | 87 // CAP_SYS_CHROOT can be acquired by using the MoveToNewUserNS() API. |
| 88 // |proc_fd| must be a file descriptor to /proc/ and must be the only open | 88 // |proc_fd| must be a file descriptor to /proc/ and must be the only open |
| 89 // directory file descriptor of the process. | 89 // directory file descriptor of the process. |
| 90 // | 90 // |
| 91 // CRITICAL: | 91 // CRITICAL: |
| 92 // - the caller must close |proc_fd| eventually or access to the file | 92 // - the caller must close |proc_fd| eventually or access to the file |
| 93 // system can be recovered. | 93 // system can be recovered. |
| 94 // - DropAllCapabilities() must be called to prevent escapes. | 94 // - DropAllCapabilities() must be called to prevent escapes. |
| 95 static bool DropFileSystemAccess(int proc_fd) WARN_UNUSED_RESULT; | 95 static bool DropFileSystemAccess(int proc_fd) WARN_UNUSED_RESULT; |
| 96 | 96 |
| 97 // This function returns true if the process can still access the filesystem. |
| 98 static bool HasFileSystemAccess(); |
| 99 |
| 97 // Forks and drops capabilities in the child. | 100 // Forks and drops capabilities in the child. |
| 98 static pid_t ForkAndDropCapabilitiesInChild(); | 101 static pid_t ForkAndDropCapabilitiesInChild(); |
| 99 | 102 |
| 100 private: | 103 private: |
| 101 DISALLOW_IMPLICIT_CONSTRUCTORS(Credentials); | 104 DISALLOW_IMPLICIT_CONSTRUCTORS(Credentials); |
| 102 }; | 105 }; |
| 103 | 106 |
| 104 } // namespace sandbox. | 107 } // namespace sandbox. |
| 105 | 108 |
| 106 #endif // SANDBOX_LINUX_SERVICES_CREDENTIALS_H_ | 109 #endif // SANDBOX_LINUX_SERVICES_CREDENTIALS_H_ |
| OLD | NEW |