| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "sandbox/linux/bpf_dsl/bpf_dsl.h" | 5 #include "sandbox/linux/bpf_dsl/bpf_dsl.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <netinet/in.h> | 9 #include <netinet/in.h> |
| 10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
| 11 #include <sys/syscall.h> | 11 #include <sys/syscall.h> |
| 12 #include <sys/utsname.h> | 12 #include <sys/utsname.h> |
| 13 #include <unistd.h> | 13 #include <unistd.h> |
| 14 | 14 |
| 15 #include <map> | 15 #include <map> |
| 16 #include <utility> | 16 #include <utility> |
| 17 | 17 |
| 18 #include "base/files/scoped_file.h" | 18 #include "base/files/scoped_file.h" |
| 19 #include "base/macros.h" | 19 #include "base/macros.h" |
| 20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 21 #include "sandbox/linux/bpf_dsl/bpf_dsl_impl.h" | 21 #include "sandbox/linux/bpf_dsl/bpf_dsl_impl.h" |
| 22 #include "sandbox/linux/bpf_dsl/codegen.h" | 22 #include "sandbox/linux/bpf_dsl/codegen.h" |
| 23 #include "sandbox/linux/bpf_dsl/policy.h" | 23 #include "sandbox/linux/bpf_dsl/policy.h" |
| 24 #include "sandbox/linux/bpf_dsl/policy_compiler.h" | 24 #include "sandbox/linux/bpf_dsl/policy_compiler.h" |
| 25 #include "sandbox/linux/bpf_dsl/seccomp_macros.h" | 25 #include "sandbox/linux/bpf_dsl/seccomp_macros.h" |
| 26 #include "sandbox/linux/bpf_dsl/trap_registry.h" | 26 #include "sandbox/linux/bpf_dsl/trap_registry.h" |
| 27 #include "sandbox/linux/bpf_dsl/verifier.h" | 27 #include "sandbox/linux/bpf_dsl/verifier.h" |
| 28 #include "sandbox/linux/seccomp-bpf/errorcode.h" | 28 #include "sandbox/linux/seccomp-bpf/errorcode.h" |
| 29 #include "sandbox/linux/system_headers/linux_filter.h" |
| 29 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
| 30 | 31 |
| 31 #define CASES SANDBOX_BPF_DSL_CASES | 32 #define CASES SANDBOX_BPF_DSL_CASES |
| 32 | 33 |
| 33 namespace sandbox { | 34 namespace sandbox { |
| 34 namespace bpf_dsl { | 35 namespace bpf_dsl { |
| 35 namespace { | 36 namespace { |
| 36 | 37 |
| 37 // Helper function to construct fake arch_seccomp_data objects. | 38 // Helper function to construct fake arch_seccomp_data objects. |
| 38 struct arch_seccomp_data FakeSyscall(int nr, | 39 struct arch_seccomp_data FakeSyscall(int nr, |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 EXPECT_TRUE(unsafe->HasUnsafeTraps()); | 477 EXPECT_TRUE(unsafe->HasUnsafeTraps()); |
| 477 | 478 |
| 478 const Arg<int> arg(0); | 479 const Arg<int> arg(0); |
| 479 ResultExpr maybe = If(arg == 0, allow).Else(unsafe); | 480 ResultExpr maybe = If(arg == 0, allow).Else(unsafe); |
| 480 EXPECT_TRUE(maybe->HasUnsafeTraps()); | 481 EXPECT_TRUE(maybe->HasUnsafeTraps()); |
| 481 } | 482 } |
| 482 | 483 |
| 483 } // namespace | 484 } // namespace |
| 484 } // namespace bpf_dsl | 485 } // namespace bpf_dsl |
| 485 } // namespace sandbox | 486 } // namespace sandbox |
| OLD | NEW |