| OLD | NEW |
| 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_SYSCALL_H__ | 5 #ifndef SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_H__ |
| 6 #define SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_H__ | 6 #define SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_H__ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "sandbox/linux/sandbox_export.h" | 10 #include "sandbox/sandbox_export.h" |
| 11 | 11 |
| 12 namespace sandbox { | 12 namespace sandbox { |
| 13 | 13 |
| 14 // We have to make sure that we have a single "magic" return address for | 14 // We have to make sure that we have a single "magic" return address for |
| 15 // our system calls, which we can check from within a BPF filter. This | 15 // our system calls, which we can check from within a BPF filter. This |
| 16 // works by writing a little bit of asm() code that a) enters the kernel, and | 16 // works by writing a little bit of asm() code that a) enters the kernel, and |
| 17 // that also b) can be invoked in a way that computes this return address. | 17 // that also b) can be invoked in a way that computes this return address. |
| 18 // Passing "nr" as "-1" computes the "magic" return address. Passing any | 18 // Passing "nr" as "-1" computes the "magic" return address. Passing any |
| 19 // other value invokes the appropriate system call. | 19 // other value invokes the appropriate system call. |
| 20 SANDBOX_EXPORT intptr_t SandboxSyscall(int nr, | 20 SANDBOX_EXPORT intptr_t SandboxSyscall(int nr, |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 __attribute__((always_inline)); | 139 __attribute__((always_inline)); |
| 140 SANDBOX_EXPORT inline intptr_t SandboxSyscall(int nr) { | 140 SANDBOX_EXPORT inline intptr_t SandboxSyscall(int nr) { |
| 141 return SandboxSyscall(nr, 0, 0, 0, 0, 0, 0); | 141 return SandboxSyscall(nr, 0, 0, 0, 0, 0, 0); |
| 142 } | 142 } |
| 143 | 143 |
| 144 #endif // Pre-C++11 | 144 #endif // Pre-C++11 |
| 145 | 145 |
| 146 } // namespace sandbox | 146 } // namespace sandbox |
| 147 | 147 |
| 148 #endif // SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_H__ | 148 #endif // SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_H__ |
| OLD | NEW |