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

Side by Side Diff: sandbox/linux/seccomp-bpf/sandbox_bpf.h

Issue 494743003: sandbox: Add support for the new seccomp() system call in kernel 3.17. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_SECCOMP_BPF_SANDBOX_BPF_H__ 5 #ifndef SANDBOX_LINUX_SECCOMP_BPF_SANDBOX_BPF_H__
6 #define SANDBOX_LINUX_SECCOMP_BPF_SANDBOX_BPF_H__ 6 #define SANDBOX_LINUX_SECCOMP_BPF_SANDBOX_BPF_H__
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #include <sys/wait.h> 10 #include <sys/wait.h>
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // system calls. 88 // system calls.
89 static bool IsValidSyscallNumber(int sysnum); 89 static bool IsValidSyscallNumber(int sysnum);
90 90
91 // There are a lot of reasons why the Seccomp sandbox might not be available. 91 // There are a lot of reasons why the Seccomp sandbox might not be available.
92 // This could be because the kernel does not support Seccomp mode, or it 92 // This could be because the kernel does not support Seccomp mode, or it
93 // could be because another sandbox is already active. 93 // could be because another sandbox is already active.
94 // "proc_fd" should be a file descriptor for "/proc", or -1 if not 94 // "proc_fd" should be a file descriptor for "/proc", or -1 if not
95 // provided by the caller. 95 // provided by the caller.
96 static SandboxStatus SupportsSeccompSandbox(int proc_fd); 96 static SandboxStatus SupportsSeccompSandbox(int proc_fd);
97 97
98 // Determines if the kernel has support for the seccomp() system call to
99 // synchronize BPF filters across a thread group.
100 static SandboxStatus SupportsSeccompThreadFilterSynchronization();
jln (very slow on Chromium) 2014/08/20 21:34:20 I think I would rather have this and SupportsSecco
Robert Sesek 2014/08/21 16:50:18 I agree that SupportsSeccompSandbox should do this
101
98 // The sandbox needs to be able to access files in "/proc/self". If this 102 // The sandbox needs to be able to access files in "/proc/self". If this
99 // directory is not accessible when "startSandbox()" gets called, the caller 103 // directory is not accessible when "startSandbox()" gets called, the caller
100 // can provide an already opened file descriptor by calling "set_proc_fd()". 104 // can provide an already opened file descriptor by calling "set_proc_fd()".
101 // The sandbox becomes the new owner of this file descriptor and will 105 // The sandbox becomes the new owner of this file descriptor and will
102 // eventually close it when "StartSandbox()" executes. 106 // eventually close it when "StartSandbox()" executes.
103 void set_proc_fd(int proc_fd); 107 void set_proc_fd(int proc_fd);
104 108
105 // Set the BPF policy as |policy|. Ownership of |policy| is transfered here 109 // Set the BPF policy as |policy|. Ownership of |policy| is transfered here
106 // to the sandbox object. 110 // to the sandbox object.
107 void SetSandboxPolicy(SandboxBPFPolicy* policy); 111 void SetSandboxPolicy(SandboxBPFPolicy* policy);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 scoped_ptr<const SandboxBPFPolicy> policy_; 264 scoped_ptr<const SandboxBPFPolicy> policy_;
261 Conds* conds_; 265 Conds* conds_;
262 bool sandbox_has_started_; 266 bool sandbox_has_started_;
263 267
264 DISALLOW_COPY_AND_ASSIGN(SandboxBPF); 268 DISALLOW_COPY_AND_ASSIGN(SandboxBPF);
265 }; 269 };
266 270
267 } // namespace sandbox 271 } // namespace sandbox
268 272
269 #endif // SANDBOX_LINUX_SECCOMP_BPF_SANDBOX_BPF_H__ 273 #endif // SANDBOX_LINUX_SECCOMP_BPF_SANDBOX_BPF_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698