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

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

Issue 524603002: sandbox: Fix RedirectToUserSpacePolicyWrapper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use uname Created 6 years, 3 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
« no previous file with comments | « no previous file | sandbox/linux/seccomp-bpf/sandbox_bpf.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // This feature is available only if explicitly enabled by the user having 123 // This feature is available only if explicitly enabled by the user having
124 // set the CHROME_SANDBOX_DEBUGGING environment variable. 124 // set the CHROME_SANDBOX_DEBUGGING environment variable.
125 // Returns an ET_INVALID ErrorCode, if called when not enabled. 125 // Returns an ET_INVALID ErrorCode, if called when not enabled.
126 // NOTE: This feature, by definition, disables all security features of 126 // NOTE: This feature, by definition, disables all security features of
127 // the sandbox. It should never be used in production, but it can be 127 // the sandbox. It should never be used in production, but it can be
128 // very useful to diagnose code that is incompatible with the sandbox. 128 // very useful to diagnose code that is incompatible with the sandbox.
129 // If even a single system call returns "UnsafeTrap", the security of 129 // If even a single system call returns "UnsafeTrap", the security of
130 // entire sandbox should be considered compromised. 130 // entire sandbox should be considered compromised.
131 ErrorCode UnsafeTrap(Trap::TrapFnc fnc, const void* aux); 131 ErrorCode UnsafeTrap(Trap::TrapFnc fnc, const void* aux);
132 132
133 // UnsafeTraps require some syscalls to always be allowed.
134 // This helper function returns true for these calls.
135 static bool IsRequiredForUnsafeTrap(int sysno);
136
133 // From within an UnsafeTrap() it is often useful to be able to execute 137 // From within an UnsafeTrap() it is often useful to be able to execute
134 // the system call that triggered the trap. The ForwardSyscall() method 138 // the system call that triggered the trap. The ForwardSyscall() method
135 // makes this easy. It is more efficient than calling glibc's syscall() 139 // makes this easy. It is more efficient than calling glibc's syscall()
136 // function, as it avoid the extra round-trip to the signal handler. And 140 // function, as it avoid the extra round-trip to the signal handler. And
137 // it automatically does the correct thing to report kernel-style error 141 // it automatically does the correct thing to report kernel-style error
138 // conditions, rather than setting errno. See the comments for TrapFnc for 142 // conditions, rather than setting errno. See the comments for TrapFnc for
139 // details. In other words, the return value from ForwardSyscall() is 143 // details. In other words, the return value from ForwardSyscall() is
140 // directly suitable as a return value for a trap handler. 144 // directly suitable as a return value for a trap handler.
141 static intptr_t ForwardSyscall(const struct arch_seccomp_data& args); 145 static intptr_t ForwardSyscall(const struct arch_seccomp_data& args);
142 146
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 scoped_ptr<const SandboxBPFPolicy> policy_; 268 scoped_ptr<const SandboxBPFPolicy> policy_;
265 Conds* conds_; 269 Conds* conds_;
266 bool sandbox_has_started_; 270 bool sandbox_has_started_;
267 271
268 DISALLOW_COPY_AND_ASSIGN(SandboxBPF); 272 DISALLOW_COPY_AND_ASSIGN(SandboxBPF);
269 }; 273 };
270 274
271 } // namespace sandbox 275 } // namespace sandbox
272 276
273 #endif // SANDBOX_LINUX_SECCOMP_BPF_SANDBOX_BPF_H__ 277 #endif // SANDBOX_LINUX_SECCOMP_BPF_SANDBOX_BPF_H__
OLDNEW
« no previous file with comments | « no previous file | sandbox/linux/seccomp-bpf/sandbox_bpf.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698