Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: sandbox/linux/services/proc_util.h

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sandbox/linux/services/credentials_unittest.cc ('k') | sandbox/linux/services/proc_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SANDBOX_LINUX_SERVICES_PROC_UTIL_H_
6 #define SANDBOX_LINUX_SERVICES_PROC_UTIL_H_
7
8 #include "base/macros.h"
9 #include "sandbox/sandbox_export.h"
10
11 namespace sandbox {
12
13 class SANDBOX_EXPORT ProcUtil {
14 public:
15 // Returns the number of file descriptors in the current process's FD
16 // table, excluding |proc_fd|, which should be a file descriptor for
17 // /proc.
18 static int CountOpenFds(int proc_fd);
19
20 // Checks whether the current process has any directory file descriptor open.
21 // Directory file descriptors are "capabilities" that would let a process use
22 // system calls such as openat() to bypass restrictions such as
23 // DropFileSystemAccess().
24 // Sometimes it's useful to call HasOpenDirectory() after file system access
25 // has been dropped. In this case, |proc_fd| should be a file descriptor to
26 // /proc. The file descriptor in |proc_fd| will be ignored by
27 // HasOpenDirectory() and remains owned by the caller. It is very important
28 // for the caller to close it.
29 // If /proc is available, |proc_fd| can be passed as -1.
30 // If |proc_fd| is -1 and /proc is not available, this function will return
31 // false.
32 static bool HasOpenDirectory(int proc_fd);
33
34 private:
35 DISALLOW_IMPLICIT_CONSTRUCTORS(ProcUtil);
36 };
37
38 } // namespace sandbox
39
40 #endif // SANDBOX_LINUX_SERVICES_PROC_UTIL_H_
OLDNEW
« no previous file with comments | « sandbox/linux/services/credentials_unittest.cc ('k') | sandbox/linux/services/proc_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698