| 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..6904c04d1154bea8f3f6546590bfe1af24fef797 100644
|
| --- a/sandbox/linux/seccomp-bpf/syscall.h
|
| +++ b/sandbox/linux/seccomp-bpf/syscall.h
|
| @@ -5,11 +5,17 @@
|
| #ifndef SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_H__
|
| #define SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_H__
|
|
|
| +#include <signal.h>
|
| #include <stdint.h>
|
|
|
| #include "base/macros.h"
|
| #include "sandbox/sandbox_export.h"
|
|
|
| +// Android's signal.h doesn't define ucontext etc.
|
| +#if defined(OS_ANDROID)
|
| +#include "sandbox/linux/services/android_ucontext.h"
|
| +#endif
|
| +
|
| namespace sandbox {
|
|
|
| // This purely static class can be used to perform system calls with some
|
| @@ -112,6 +118,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 +140,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
|
| + // handling syscall errors, SandboxSyscall() is made as a wrapper for this
|
| + // function in order for SandboxSyscall() to behave more like on other
|
| + // 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);
|
| };
|
|
|
|
|