[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 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 |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | import("//build/config/features.gni") |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 6 | import("//build/config/nacl/config.gni") |
qsr | fb5251d1 | 2015-01-21 15:57:22 | [diff] [blame] | 7 | import("//testing/test.gni") |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 8 | |
pkotwicz | bbe8d90 | 2015-10-29 17:10:07 | [diff] [blame] | 9 | if (is_android) { |
| 10 | import("//build/config/android/rules.gni") |
| 11 | } |
| 12 | |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 13 | declare_args() { |
| 14 | compile_suid_client = is_linux |
| 15 | |
| 16 | compile_credentials = is_linux |
| 17 | |
jln | 01954fd | 2015-05-15 06:19:33 | [diff] [blame] | 18 | # On Android, use plain GTest. |
| 19 | use_base_test_suite = is_linux |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 20 | } |
| 21 | |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 22 | if (is_nacl_nonsfi) { |
| 23 | config("nacl_nonsfi_warnings") { |
| 24 | # There are number of platform specific functions in |
| 25 | # seccomp-bpf syscall helpers, which are not being used. |
| 26 | cflags = [ "-Wno-unused-function" ] |
| 27 | } |
| 28 | } |
| 29 | |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 30 | # We have two principal targets: sandbox and sandbox_linux_unittests |
| 31 | # All other targets are listed as dependencies. |
| 32 | # There is one notable exception: for historical reasons, chrome_sandbox is |
| 33 | # the setuid sandbox and is its own target. |
| 34 | |
| 35 | group("sandbox") { |
brettw | 00709df | 2015-12-02 01:40:50 | [diff] [blame^] | 36 | public_deps = [ |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 37 | ":sandbox_services", |
| 38 | ] |
| 39 | |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 40 | if (compile_suid_client || is_nacl_nonsfi) { |
brettw | 00709df | 2015-12-02 01:40:50 | [diff] [blame^] | 41 | public_deps += [ ":suid_sandbox_client" ] |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 42 | } |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 43 | if (use_seccomp_bpf || is_nacl_nonsfi) { |
brettw | 00709df | 2015-12-02 01:40:50 | [diff] [blame^] | 44 | public_deps += [ |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 45 | ":seccomp_bpf", |
| 46 | ":seccomp_bpf_helpers", |
| 47 | ] |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | source_set("sandbox_linux_test_utils") { |
Brett Wilson | 0c8745a | 2014-09-08 22:59:49 | [diff] [blame] | 52 | testonly = true |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 53 | sources = [ |
| 54 | "tests/sandbox_test_runner.cc", |
| 55 | "tests/sandbox_test_runner.h", |
| 56 | "tests/sandbox_test_runner_function_pointer.cc", |
| 57 | "tests/sandbox_test_runner_function_pointer.h", |
| 58 | "tests/test_utils.cc", |
| 59 | "tests/test_utils.h", |
| 60 | "tests/unit_tests.cc", |
| 61 | "tests/unit_tests.h", |
| 62 | ] |
| 63 | |
| 64 | deps = [ |
| 65 | "//testing/gtest", |
| 66 | ] |
| 67 | |
| 68 | if (use_seccomp_bpf) { |
| 69 | sources += [ |
| 70 | "seccomp-bpf/bpf_tester_compatibility_delegate.h", |
| 71 | "seccomp-bpf/bpf_tests.h", |
| 72 | "seccomp-bpf/sandbox_bpf_test_runner.cc", |
| 73 | "seccomp-bpf/sandbox_bpf_test_runner.h", |
| 74 | ] |
scottmg | 34fb7e5 | 2014-12-03 23:27:24 | [diff] [blame] | 75 | deps += [ ":seccomp_bpf" ] |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 76 | } |
jln | 01954fd | 2015-05-15 06:19:33 | [diff] [blame] | 77 | |
| 78 | if (use_base_test_suite) { |
| 79 | deps += [ "//base/test:test_support" ] |
| 80 | defines = [ "SANDBOX_USES_BASE_TEST_SUITE" ] |
| 81 | } |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 82 | } |
| 83 | |
pkotwicz | 41889e3 | 2015-10-28 22:17:48 | [diff] [blame] | 84 | # Sources for sandbox_linux_unittests. |
rockot | 86da06c7f | 2015-02-21 00:40:58 | [diff] [blame] | 85 | source_set("sandbox_linux_unittests_sources") { |
| 86 | testonly = true |
| 87 | |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 88 | sources = [ |
jln | b14fc80 | 2015-02-12 05:32:11 | [diff] [blame] | 89 | "services/proc_util_unittest.cc", |
jln | 97718598 | 2015-02-13 20:58:41 | [diff] [blame] | 90 | "services/resource_limits_unittests.cc", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 91 | "services/scoped_process_unittest.cc", |
jln | c420f0d | 2014-11-22 01:12:09 | [diff] [blame] | 92 | "services/syscall_wrappers_unittest.cc", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 93 | "services/thread_helpers_unittests.cc", |
| 94 | "services/yama_unittests.cc", |
leecam | ad78f42 | 2014-11-26 22:08:45 | [diff] [blame] | 95 | "syscall_broker/broker_file_permission_unittest.cc", |
jln | 70c42c20 | 2014-11-01 00:59:57 | [diff] [blame] | 96 | "syscall_broker/broker_process_unittest.cc", |
[email protected] | 232f6e11 | 2014-06-27 07:51:38 | [diff] [blame] | 97 | "tests/main.cc", |
| 98 | "tests/scoped_temporary_file.cc", |
| 99 | "tests/scoped_temporary_file.h", |
| 100 | "tests/scoped_temporary_file_unittest.cc", |
jln | c420f0d | 2014-11-22 01:12:09 | [diff] [blame] | 101 | "tests/test_utils_unittest.cc", |
[email protected] | 232f6e11 | 2014-06-27 07:51:38 | [diff] [blame] | 102 | "tests/unit_tests_unittest.cc", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 103 | ] |
| 104 | |
| 105 | deps = [ |
| 106 | ":sandbox", |
| 107 | ":sandbox_linux_test_utils", |
| 108 | "//base", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 109 | "//testing/gtest", |
| 110 | ] |
| 111 | |
jln | 01954fd | 2015-05-15 06:19:33 | [diff] [blame] | 112 | if (use_base_test_suite) { |
| 113 | deps += [ "//base/test:test_support" ] |
| 114 | defines = [ "SANDBOX_USES_BASE_TEST_SUITE" ] |
| 115 | } |
| 116 | |
Brett Wilson | 7306753 | 2014-09-12 22:24:14 | [diff] [blame] | 117 | if (is_linux) { |
| 118 | # Don't use this on Android. |
| 119 | libs = [ "rt" ] |
| 120 | } |
Brett Wilson | e3934435 | 2014-09-12 21:07:26 | [diff] [blame] | 121 | |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 122 | if (compile_suid_client) { |
mdempsky | 3cc942a | 2015-02-05 03:29:25 | [diff] [blame] | 123 | sources += [ |
| 124 | "suid/client/setuid_sandbox_client_unittest.cc", |
| 125 | "suid/client/setuid_sandbox_host_unittest.cc", |
| 126 | ] |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 127 | } |
| 128 | if (use_seccomp_bpf) { |
| 129 | sources += [ |
[email protected] | fb75e2a | 2014-07-17 07:24:58 | [diff] [blame] | 130 | "bpf_dsl/bpf_dsl_unittest.cc", |
mdempsky | b80b1f5 | 2015-02-05 00:54:35 | [diff] [blame] | 131 | "bpf_dsl/codegen_unittest.cc", |
[email protected] | fb75e2a | 2014-07-17 07:24:58 | [diff] [blame] | 132 | "bpf_dsl/cons_unittest.cc", |
mdempsky | 937389d | 2015-08-31 22:27:23 | [diff] [blame] | 133 | "bpf_dsl/dump_bpf.cc", |
| 134 | "bpf_dsl/dump_bpf.h", |
mdempsky | ce4c9f1 | 2015-02-05 06:23:05 | [diff] [blame] | 135 | "bpf_dsl/syscall_set_unittest.cc", |
mdempsky | 3909ebf | 2015-08-20 23:18:18 | [diff] [blame] | 136 | "bpf_dsl/test_trap_registry.cc", |
| 137 | "bpf_dsl/test_trap_registry.h", |
| 138 | "bpf_dsl/test_trap_registry_unittest.cc", |
mdempsky | 937389d | 2015-08-31 22:27:23 | [diff] [blame] | 139 | "bpf_dsl/verifier.cc", |
| 140 | "bpf_dsl/verifier.h", |
jln | aedcc3e | 2015-02-12 03:18:10 | [diff] [blame] | 141 | "integration_tests/bpf_dsl_seccomp_unittest.cc", |
| 142 | "integration_tests/seccomp_broker_process_unittest.cc", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 143 | "seccomp-bpf-helpers/baseline_policy_unittest.cc", |
jln | fcdfb10 | 2014-09-12 02:47:44 | [diff] [blame] | 144 | "seccomp-bpf-helpers/syscall_parameters_restrictions_unittests.cc", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 145 | "seccomp-bpf/bpf_tests_unittest.cc", |
jln | a29d0a3 | 2014-11-26 22:38:35 | [diff] [blame] | 146 | "seccomp-bpf/sandbox_bpf_unittest.cc", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 147 | "seccomp-bpf/syscall_unittest.cc", |
hidehiko | a926d0b | 2015-04-24 21:55:21 | [diff] [blame] | 148 | "seccomp-bpf/trap_unittest.cc", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 149 | ] |
mdempsky | a3fd0ec | 2015-08-26 00:45:52 | [diff] [blame] | 150 | deps += [ ":bpf_dsl_golden" ] |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 151 | } |
| 152 | if (compile_credentials) { |
| 153 | sources += [ |
jln | aedcc3e | 2015-02-12 03:18:10 | [diff] [blame] | 154 | "integration_tests/namespace_unix_domain_socket_unittest.cc", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 155 | "services/credentials_unittest.cc", |
rickyz | 41fb145 | 2015-01-27 03:57:58 | [diff] [blame] | 156 | "services/namespace_utils_unittest.cc", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 157 | ] |
rickyz | 966f039d | 2015-03-17 07:23:43 | [diff] [blame] | 158 | |
jln | 01954fd | 2015-05-15 06:19:33 | [diff] [blame] | 159 | if (use_base_test_suite) { |
| 160 | # Tests that use advanced features not available in stock GTest. |
| 161 | sources += [ "services/namespace_sandbox_unittest.cc" ] |
| 162 | } |
| 163 | |
rickyz | 966f039d | 2015-03-17 07:23:43 | [diff] [blame] | 164 | # For credentials_unittest.cc |
| 165 | configs += [ "//build/config/linux:libcap" ] |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 166 | } |
| 167 | } |
| 168 | |
mdempsky | a3fd0ec | 2015-08-26 00:45:52 | [diff] [blame] | 169 | action("bpf_dsl_golden") { |
| 170 | script = "bpf_dsl/golden/generate.py" |
| 171 | inputs = [ |
| 172 | "bpf_dsl/golden/i386/ArgSizePolicy.txt", |
| 173 | "bpf_dsl/golden/i386/BasicPolicy.txt", |
| 174 | "bpf_dsl/golden/i386/ElseIfPolicy.txt", |
| 175 | "bpf_dsl/golden/i386/MaskingPolicy.txt", |
| 176 | "bpf_dsl/golden/i386/MoreBooleanLogicPolicy.txt", |
| 177 | "bpf_dsl/golden/i386/NegativeConstantsPolicy.txt", |
| 178 | "bpf_dsl/golden/i386/SwitchPolicy.txt", |
| 179 | "bpf_dsl/golden/x86-64/ArgSizePolicy.txt", |
| 180 | "bpf_dsl/golden/x86-64/BasicPolicy.txt", |
| 181 | "bpf_dsl/golden/x86-64/BooleanLogicPolicy.txt", |
| 182 | "bpf_dsl/golden/x86-64/ElseIfPolicy.txt", |
| 183 | "bpf_dsl/golden/x86-64/MaskingPolicy.txt", |
| 184 | "bpf_dsl/golden/x86-64/MoreBooleanLogicPolicy.txt", |
| 185 | "bpf_dsl/golden/x86-64/NegativeConstantsPolicy.txt", |
| 186 | "bpf_dsl/golden/x86-64/SwitchPolicy.txt", |
| 187 | ] |
| 188 | outputs = [ |
| 189 | "$target_gen_dir/bpf_dsl/golden/golden_files.h", |
| 190 | ] |
| 191 | args = |
| 192 | rebase_path(outputs, root_build_dir) + rebase_path(inputs, root_build_dir) |
| 193 | } |
| 194 | |
dpranke | 177c1e2 | 2015-07-22 23:07:43 | [diff] [blame] | 195 | # TODO(GYP): Delete this after we've converted everything to GN. |
| 196 | # The _run targets exist only for compatibility w/ GYP. |
| 197 | group("sandbox_linux_unittests_run") { |
| 198 | testonly = true |
| 199 | deps = [ |
| 200 | ":sandbox_linux_unittests", |
| 201 | ] |
| 202 | } |
| 203 | |
pkotwicz | bbe8d90 | 2015-10-29 17:10:07 | [diff] [blame] | 204 | # The main sandboxing test target. "sandbox_linux_unittests" cannot use the |
| 205 | # test() template because the test is run as an executable not as an APK on |
| 206 | # Android. |
| 207 | executable("sandbox_linux_unittests") { |
| 208 | testonly = true |
rockot | 86da06c7f | 2015-02-21 00:40:58 | [diff] [blame] | 209 | deps = [ |
| 210 | ":sandbox_linux_unittests_sources", |
pkotwicz | bbe8d90 | 2015-10-29 17:10:07 | [diff] [blame] | 211 | "//build/config/sanitizers:deps", |
rockot | 86da06c7f | 2015-02-21 00:40:58 | [diff] [blame] | 212 | ] |
| 213 | } |
| 214 | |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 215 | component("seccomp_bpf") { |
| 216 | sources = [ |
[email protected] | fb75e2a | 2014-07-17 07:24:58 | [diff] [blame] | 217 | "bpf_dsl/bpf_dsl.cc", |
| 218 | "bpf_dsl/bpf_dsl.h", |
mdempsky | c60a1c5 | 2014-10-24 23:07:10 | [diff] [blame] | 219 | "bpf_dsl/bpf_dsl_forward.h", |
mdempsky | fb10cce | 2014-10-14 17:56:44 | [diff] [blame] | 220 | "bpf_dsl/bpf_dsl_impl.h", |
mdempsky | b80b1f5 | 2015-02-05 00:54:35 | [diff] [blame] | 221 | "bpf_dsl/codegen.cc", |
| 222 | "bpf_dsl/codegen.h", |
[email protected] | fb75e2a | 2014-07-17 07:24:58 | [diff] [blame] | 223 | "bpf_dsl/cons.h", |
mdempsky | 3909ebf | 2015-08-20 23:18:18 | [diff] [blame] | 224 | "bpf_dsl/errorcode.h", |
jln | a65ffca | 2015-02-13 04:12:43 | [diff] [blame] | 225 | "bpf_dsl/linux_syscall_ranges.h", |
mdempsky | c60a1c5 | 2014-10-24 23:07:10 | [diff] [blame] | 226 | "bpf_dsl/policy.cc", |
| 227 | "bpf_dsl/policy.h", |
mdempsky | 27e78ad7 | 2014-10-16 16:49:54 | [diff] [blame] | 228 | "bpf_dsl/policy_compiler.cc", |
| 229 | "bpf_dsl/policy_compiler.h", |
jln | a65ffca | 2015-02-13 04:12:43 | [diff] [blame] | 230 | "bpf_dsl/seccomp_macros.h", |
mdempsky | ce4c9f1 | 2015-02-05 06:23:05 | [diff] [blame] | 231 | "bpf_dsl/syscall_set.cc", |
| 232 | "bpf_dsl/syscall_set.h", |
mdempsky | 27e78ad7 | 2014-10-16 16:49:54 | [diff] [blame] | 233 | "bpf_dsl/trap_registry.h", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 234 | "seccomp-bpf/die.cc", |
| 235 | "seccomp-bpf/die.h", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 236 | "seccomp-bpf/sandbox_bpf.cc", |
| 237 | "seccomp-bpf/sandbox_bpf.h", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 238 | "seccomp-bpf/syscall.cc", |
| 239 | "seccomp-bpf/syscall.h", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 240 | "seccomp-bpf/trap.cc", |
| 241 | "seccomp-bpf/trap.h", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 242 | ] |
| 243 | defines = [ "SANDBOX_IMPLEMENTATION" ] |
| 244 | |
| 245 | deps = [ |
jln | bd4df41c | 2014-11-25 02:32:30 | [diff] [blame] | 246 | ":sandbox_services", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 247 | ":sandbox_services_headers", |
| 248 | "//base", |
| 249 | ] |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 250 | |
| 251 | if (is_nacl_nonsfi) { |
| 252 | cflags = [ "-fgnu-inline-asm" ] |
| 253 | sources -= [ |
| 254 | "bpf_dsl/bpf_dsl_forward.h", |
| 255 | "bpf_dsl/bpf_dsl_impl.h", |
| 256 | "bpf_dsl/cons.h", |
| 257 | "bpf_dsl/errorcode.h", |
| 258 | "bpf_dsl/linux_syscall_ranges.h", |
| 259 | "bpf_dsl/seccomp_macros.h", |
| 260 | "bpf_dsl/trap_registry.h", |
| 261 | ] |
| 262 | } |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 263 | } |
| 264 | |
| 265 | component("seccomp_bpf_helpers") { |
| 266 | sources = [ |
| 267 | "seccomp-bpf-helpers/baseline_policy.cc", |
| 268 | "seccomp-bpf-helpers/baseline_policy.h", |
| 269 | "seccomp-bpf-helpers/sigsys_handlers.cc", |
| 270 | "seccomp-bpf-helpers/sigsys_handlers.h", |
| 271 | "seccomp-bpf-helpers/syscall_parameters_restrictions.cc", |
| 272 | "seccomp-bpf-helpers/syscall_parameters_restrictions.h", |
| 273 | "seccomp-bpf-helpers/syscall_sets.cc", |
| 274 | "seccomp-bpf-helpers/syscall_sets.h", |
| 275 | ] |
| 276 | defines = [ "SANDBOX_IMPLEMENTATION" ] |
| 277 | |
| 278 | deps = [ |
jamesr | 4359db7 | 2015-01-21 12:40:00 | [diff] [blame] | 279 | ":sandbox_services", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 280 | ":seccomp_bpf", |
agrieve | d7a71c88 | 2015-11-20 19:53:28 | [diff] [blame] | 281 | "//base", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 282 | ] |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 283 | |
| 284 | if (is_nacl_nonsfi) { |
| 285 | sources -= [ |
| 286 | "seccomp-bpf-helpers/baseline_policy.cc", |
| 287 | "seccomp-bpf-helpers/baseline_policy.h", |
| 288 | "seccomp-bpf-helpers/syscall_sets.cc", |
| 289 | "seccomp-bpf-helpers/syscall_sets.h", |
| 290 | ] |
| 291 | configs += [ ":nacl_nonsfi_warnings" ] |
| 292 | } |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 293 | } |
| 294 | |
James Robinson | 060f2e3 | 2014-09-10 22:31:37 | [diff] [blame] | 295 | if (is_linux) { |
scottmg | 34fb7e5 | 2014-12-03 23:27:24 | [diff] [blame] | 296 | # The setuid sandbox for Linux. |
James Robinson | 060f2e3 | 2014-09-10 22:31:37 | [diff] [blame] | 297 | executable("chrome_sandbox") { |
| 298 | sources = [ |
| 299 | "suid/common/sandbox.h", |
| 300 | "suid/common/suid_unsafe_environment_variables.h", |
James Robinson | 060f2e3 | 2014-09-10 22:31:37 | [diff] [blame] | 301 | "suid/process_util.h", |
| 302 | "suid/process_util_linux.c", |
| 303 | "suid/sandbox.c", |
| 304 | ] |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 305 | |
James Robinson | 060f2e3 | 2014-09-10 22:31:37 | [diff] [blame] | 306 | cflags = [ |
| 307 | # For ULLONG_MAX |
| 308 | "-std=gnu99", |
scottmg | 34fb7e5 | 2014-12-03 23:27:24 | [diff] [blame] | 309 | |
James Robinson | 060f2e3 | 2014-09-10 22:31:37 | [diff] [blame] | 310 | # These files have a suspicious comparison. |
| 311 | # TODO fix this and re-enable this warning. |
| 312 | "-Wno-sign-compare", |
| 313 | ] |
brettw | ba7a73d | 2015-08-31 22:17:39 | [diff] [blame] | 314 | |
| 315 | deps = [ |
| 316 | "//build/config/sanitizers:deps", |
| 317 | ] |
James Robinson | 060f2e3 | 2014-09-10 22:31:37 | [diff] [blame] | 318 | } |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 319 | } |
| 320 | |
| 321 | component("sandbox_services") { |
| 322 | sources = [ |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 323 | "services/init_process_reaper.cc", |
| 324 | "services/init_process_reaper.h", |
jln | b14fc80 | 2015-02-12 05:32:11 | [diff] [blame] | 325 | "services/proc_util.cc", |
| 326 | "services/proc_util.h", |
jln | 97718598 | 2015-02-13 20:58:41 | [diff] [blame] | 327 | "services/resource_limits.cc", |
| 328 | "services/resource_limits.h", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 329 | "services/scoped_process.cc", |
| 330 | "services/scoped_process.h", |
jln | 610a4a61 | 2014-11-20 18:58:21 | [diff] [blame] | 331 | "services/syscall_wrappers.cc", |
| 332 | "services/syscall_wrappers.h", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 333 | "services/thread_helpers.cc", |
| 334 | "services/thread_helpers.h", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 335 | "services/yama.cc", |
jln | b14fc80 | 2015-02-12 05:32:11 | [diff] [blame] | 336 | "services/yama.h", |
jln | 878dca3 | 2014-11-11 07:43:57 | [diff] [blame] | 337 | "syscall_broker/broker_channel.cc", |
| 338 | "syscall_broker/broker_channel.h", |
jln | 70c42c20 | 2014-11-01 00:59:57 | [diff] [blame] | 339 | "syscall_broker/broker_client.cc", |
| 340 | "syscall_broker/broker_client.h", |
| 341 | "syscall_broker/broker_common.h", |
leecam | ad78f42 | 2014-11-26 22:08:45 | [diff] [blame] | 342 | "syscall_broker/broker_file_permission.cc", |
| 343 | "syscall_broker/broker_file_permission.h", |
jln | 70c42c20 | 2014-11-01 00:59:57 | [diff] [blame] | 344 | "syscall_broker/broker_host.cc", |
| 345 | "syscall_broker/broker_host.h", |
| 346 | "syscall_broker/broker_policy.cc", |
| 347 | "syscall_broker/broker_policy.h", |
| 348 | "syscall_broker/broker_process.cc", |
| 349 | "syscall_broker/broker_process.h", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 350 | ] |
| 351 | |
| 352 | defines = [ "SANDBOX_IMPLEMENTATION" ] |
| 353 | |
rickyz | 966f039d | 2015-03-17 07:23:43 | [diff] [blame] | 354 | deps = [ |
| 355 | "//base", |
| 356 | ] |
| 357 | |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 358 | if (compile_credentials || is_nacl_nonsfi) { |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 359 | sources += [ |
| 360 | "services/credentials.cc", |
| 361 | "services/credentials.h", |
rickyz | 8f235da | 2015-02-03 07:26:19 | [diff] [blame] | 362 | "services/namespace_sandbox.cc", |
| 363 | "services/namespace_sandbox.h", |
rickyz | 41fb145 | 2015-01-27 03:57:58 | [diff] [blame] | 364 | "services/namespace_utils.cc", |
| 365 | "services/namespace_utils.h", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 366 | ] |
scottmg | 34fb7e5 | 2014-12-03 23:27:24 | [diff] [blame] | 367 | |
rickyz | 966f039d | 2015-03-17 07:23:43 | [diff] [blame] | 368 | deps += [ ":sandbox_services_headers" ] |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 369 | } |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 370 | |
| 371 | if (is_nacl_nonsfi) { |
mcgrathr | 87cb1c07 | 2015-11-20 21:47:40 | [diff] [blame] | 372 | cflags = [ "-fgnu-inline-asm" ] |
| 373 | |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 374 | sources -= [ |
| 375 | "services/init_process_reaper.cc", |
| 376 | "services/init_process_reaper.h", |
| 377 | "services/scoped_process.cc", |
| 378 | "services/scoped_process.h", |
| 379 | "services/yama.cc", |
| 380 | "services/yama.h", |
| 381 | "syscall_broker/broker_channel.cc", |
| 382 | "syscall_broker/broker_channel.h", |
| 383 | "syscall_broker/broker_client.cc", |
| 384 | "syscall_broker/broker_client.h", |
| 385 | "syscall_broker/broker_common.h", |
| 386 | "syscall_broker/broker_file_permission.cc", |
| 387 | "syscall_broker/broker_file_permission.h", |
| 388 | "syscall_broker/broker_host.cc", |
| 389 | "syscall_broker/broker_host.h", |
| 390 | "syscall_broker/broker_policy.cc", |
| 391 | "syscall_broker/broker_policy.h", |
| 392 | "syscall_broker/broker_process.cc", |
| 393 | "syscall_broker/broker_process.h", |
| 394 | ] |
| 395 | } |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 396 | } |
| 397 | |
| 398 | source_set("sandbox_services_headers") { |
| 399 | sources = [ |
jln | aedcc3e | 2015-02-12 03:18:10 | [diff] [blame] | 400 | "system_headers/arm64_linux_syscalls.h", |
hidehiko | a926d0b | 2015-04-24 21:55:21 | [diff] [blame] | 401 | "system_headers/arm64_linux_ucontext.h", |
jln | a65ffca | 2015-02-13 04:12:43 | [diff] [blame] | 402 | "system_headers/arm_linux_syscalls.h", |
hidehiko | a926d0b | 2015-04-24 21:55:21 | [diff] [blame] | 403 | "system_headers/arm_linux_ucontext.h", |
| 404 | "system_headers/i386_linux_ucontext.h", |
dnicoara | 9717805 | 2015-04-15 17:44:04 | [diff] [blame] | 405 | "system_headers/linux_futex.h", |
jln | a65ffca | 2015-02-13 04:12:43 | [diff] [blame] | 406 | "system_headers/linux_seccomp.h", |
hidehiko | a926d0b | 2015-04-24 21:55:21 | [diff] [blame] | 407 | "system_headers/linux_signal.h", |
jln | aedcc3e | 2015-02-12 03:18:10 | [diff] [blame] | 408 | "system_headers/linux_syscalls.h", |
ben | 7598f46 | 2015-05-22 23:19:51 | [diff] [blame] | 409 | "system_headers/linux_time.h", |
hidehiko | a926d0b | 2015-04-24 21:55:21 | [diff] [blame] | 410 | "system_headers/linux_ucontext.h", |
jln | aedcc3e | 2015-02-12 03:18:10 | [diff] [blame] | 411 | "system_headers/x86_32_linux_syscalls.h", |
| 412 | "system_headers/x86_64_linux_syscalls.h", |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 413 | ] |
| 414 | } |
| 415 | |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 416 | if (compile_suid_client || is_nacl_nonsfi) { |
James Robinson | 060f2e3 | 2014-09-10 22:31:37 | [diff] [blame] | 417 | component("suid_sandbox_client") { |
| 418 | sources = [ |
James Robinson | 060f2e3 | 2014-09-10 22:31:37 | [diff] [blame] | 419 | "suid/client/setuid_sandbox_client.cc", |
| 420 | "suid/client/setuid_sandbox_client.h", |
mdempsky | 3cc942a | 2015-02-05 03:29:25 | [diff] [blame] | 421 | "suid/client/setuid_sandbox_host.cc", |
| 422 | "suid/client/setuid_sandbox_host.h", |
scottmg | 7c7296f4 | 2015-02-28 02:23:09 | [diff] [blame] | 423 | "suid/common/sandbox.h", |
| 424 | "suid/common/suid_unsafe_environment_variables.h", |
James Robinson | 060f2e3 | 2014-09-10 22:31:37 | [diff] [blame] | 425 | ] |
| 426 | defines = [ "SANDBOX_IMPLEMENTATION" ] |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 427 | |
James Robinson | 060f2e3 | 2014-09-10 22:31:37 | [diff] [blame] | 428 | deps = [ |
| 429 | ":sandbox_services", |
| 430 | "//base", |
| 431 | ] |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 432 | |
| 433 | if (is_nacl_nonsfi) { |
| 434 | sources -= [ |
| 435 | "suid/client/setuid_sandbox_host.cc", |
| 436 | "suid/client/setuid_sandbox_host.h", |
| 437 | "suid/common/sandbox.h", |
| 438 | "suid/common/suid_unsafe_environment_variables.h", |
| 439 | ] |
| 440 | } |
James Robinson | 060f2e3 | 2014-09-10 22:31:37 | [diff] [blame] | 441 | } |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 442 | } |
| 443 | |
| 444 | if (is_android) { |
pkotwicz | bbe8d90 | 2015-10-29 17:10:07 | [diff] [blame] | 445 | create_native_executable_dist("sandbox_linux_unittests_deps") { |
| 446 | testonly = true |
| 447 | dist_dir = "$root_out_dir/sandbox_linux_unittests_deps" |
| 448 | binary = "$root_out_dir/sandbox_linux_unittests" |
| 449 | deps = [ |
| 450 | ":sandbox_linux_unittests", |
| 451 | ] |
| 452 | |
| 453 | if (is_component_build) { |
| 454 | deps += [ "//build/android:cpplib_stripped" ] |
| 455 | } |
| 456 | } |
| 457 | |
| 458 | test_runner_script("sandbox_linux_unittests__test_runner_script") { |
| 459 | test_name = "sandbox_linux_unittests" |
| 460 | test_type = "gtest" |
| 461 | test_suite = "sandbox_linux_unittests" |
| 462 | isolate_file = "//sandbox/sandbox_linux_unittests_android.isolate" |
| 463 | } |
[email protected] | 75cd8f0 | 2014-05-29 20:56:02 | [diff] [blame] | 464 | } |