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

Unified Diff: sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc

Issue 260793003: [MIPS] Add seccomp bpf support (Closed) Base URL: https://git.chromium.org/git/chromium/src.git@master
Patch Set: Update per code review Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc
diff --git a/sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc b/sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc
index 0341d2f95db055f0eba10bb68de5e172d5f92b54..6d028fdec9a691afb25d5a22404c802670a0a04b 100644
--- a/sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc
+++ b/sandbox/linux/seccomp-bpf/sandbox_bpf_unittest.cc
@@ -11,6 +11,7 @@
#include <sys/types.h>
#include <sys/utsname.h>
#include <unistd.h>
+#include <sys/socket.h>
#if defined(ANDROID)
// Work-around for buggy headers in Android's NDK
@@ -26,6 +27,7 @@
#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
#include "sandbox/linux/seccomp-bpf/bpf_tests.h"
+#include "sandbox/linux/seccomp-bpf/kernel_return_value_helpers.h"
#include "sandbox/linux/seccomp-bpf/syscall.h"
#include "sandbox/linux/seccomp-bpf/trap.h"
#include "sandbox/linux/seccomp-bpf/verifier.h"
@@ -650,7 +652,7 @@ BPF_TEST_C(SandboxBPF, SigBus, RedirectAllSyscallsPolicy) {
// more complex uses of signals where our use of the SIGBUS mask is not
// 100% transparent. This is expected behavior.
int fds[2];
- BPF_ASSERT(pipe(fds) == 0);
+ BPF_ASSERT(socketpair(AF_UNIX, SOCK_STREAM, 0, fds) == 0);
bus_handler_fd_ = fds[1];
struct sigaction sa = {};
sa.sa_sigaction = SigBusHandler;
@@ -1757,7 +1759,7 @@ intptr_t PthreadTrapHandler(const struct arch_seccomp_data& args, void* aux) {
(long long)args.args[5],
msg);
}
- return -EPERM;
+ return ErrnoToKernelRet(EPERM);
}
class PthreadPolicyEquality : public SandboxBPFPolicy {
@@ -1897,7 +1899,7 @@ static void PthreadTest() {
CLONE_CHILD_CLEARTID | CLONE_CHILD_SETTID | SIGCHLD,
0,
0,
- &pid) == -EPERM);
+ &pid) == ErrnoToKernelRet(EPERM));
jln (very slow on Chromium) 2014/06/03 01:00:33 This should be -EPERM, no? SandboxSyscall() alway
nedeljko 2014/06/03 15:32:18 You are correct.
}
BPF_TEST_C(SandboxBPF, PthreadEquality, PthreadPolicyEquality) {

Powered by Google App Engine
This is Rietveld 408576698