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