Chromium Code Reviews| Index: sandbox/linux/seccomp-bpf/syscall.h |
| diff --git a/sandbox/linux/seccomp-bpf/syscall.h b/sandbox/linux/seccomp-bpf/syscall.h |
| index 10a1253e8c2be65a265665dfc0e7fa2a86208f0f..91a743af8a99a007d927b5ba46d9d859ace354bb 100644 |
| --- a/sandbox/linux/seccomp-bpf/syscall.h |
| +++ b/sandbox/linux/seccomp-bpf/syscall.h |
| @@ -5,6 +5,7 @@ |
| #ifndef SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_H__ |
| #define SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_H__ |
| +#include <signal.h> |
| #include <stdint.h> |
| #include "base/macros.h" |
| @@ -112,6 +113,11 @@ class SANDBOX_EXPORT Syscall { |
| return Call(nr, 0, 0, 0, 0, 0, 0, 0, 0); |
| } |
| + // Set the registers in |ctx| to match what they would be after a system call |
| + // returning |ret_val|. |ret_val| must follow the Syscall::Call() convention |
| + // of being -errno on errors. |
| + static void PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx); |
| + |
| private: |
| // This performs system call |nr| with the arguments p0 to p7 from a constant |
| // userland address, which is for instance observable by seccomp-bpf filters. |
| @@ -129,6 +135,21 @@ class SANDBOX_EXPORT Syscall { |
| intptr_t p6, |
| intptr_t p7); |
| +#if defined(__mips__) |
| + // This function basically does on MIPS what SandboxSyscall() is doing on |
| + // other architectures. However, because of specificity of MIPS regarding |
| + // handelling syscall errors, SandboxSyscall() is made as a wrapper for this |
|
mdempsky
2014/07/14 18:10:51
typo: handling
nedeljko
2014/07/15 15:22:16
Done.
|
| + // function in order for SandboxSyscall() to behave more like on othere |
|
mdempsky
2014/07/14 18:10:51
typo: other
nedeljko
2014/07/15 15:22:16
Done.
|
| + // architectures on places where return value from SandboxSyscall() is used |
| + // directly (like in most tests). |
| + // The syscall "nr" is called with arguments that are set in an array on which |
| + // pointer "args" points to and an information weather there is an error or no |
| + // is returned to SandboxSyscall() by err_stat. |
| + static intptr_t SandboxSyscallRaw(int nr, |
| + const intptr_t* args, |
| + intptr_t* err_stat); |
| +#endif // defined(__mips__) |
| + |
| DISALLOW_IMPLICIT_CONSTRUCTORS(Syscall); |
| }; |