OLD | NEW |
| (Empty) |
1 # Copyright (c) 2012 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 { | |
6 'variables': { | |
7 'conditions': [ | |
8 ['OS=="linux"', { | |
9 'compile_suid_client': 1, | |
10 'compile_credentials': 1, | |
11 'use_base_test_suite': 1, | |
12 }, { | |
13 'compile_suid_client': 0, | |
14 'compile_credentials': 0, | |
15 'use_base_test_suite': 0, | |
16 }], | |
17 ['OS=="linux" and (target_arch=="ia32" or target_arch=="x64" or ' | |
18 'target_arch=="mipsel")', { | |
19 'compile_seccomp_bpf_demo': 1, | |
20 }, { | |
21 'compile_seccomp_bpf_demo': 0, | |
22 }], | |
23 ], | |
24 }, | |
25 'target_defaults': { | |
26 'target_conditions': [ | |
27 # All linux/ files will automatically be excluded on Android | |
28 # so make sure we re-include them explicitly. | |
29 ['OS == "android"', { | |
30 'sources/': [ | |
31 ['include', '^linux/'], | |
32 ], | |
33 }], | |
34 ], | |
35 }, | |
36 'targets': [ | |
37 # We have two principal targets: sandbox and sandbox_linux_unittests | |
38 # All other targets are listed as dependencies. | |
39 # There is one notable exception: for historical reasons, chrome_sandbox is | |
40 # the setuid sandbox and is its own target. | |
41 { | |
42 'target_name': 'sandbox', | |
43 'type': 'none', | |
44 'dependencies': [ | |
45 'sandbox_services', | |
46 ], | |
47 'conditions': [ | |
48 [ 'compile_suid_client==1', { | |
49 'dependencies': [ | |
50 'suid_sandbox_client', | |
51 ], | |
52 }], | |
53 # Compile seccomp BPF when we support it. | |
54 [ 'use_seccomp_bpf==1', { | |
55 'dependencies': [ | |
56 'seccomp_bpf', | |
57 ], | |
58 }], | |
59 ], | |
60 }, | |
61 { | |
62 'target_name': 'sandbox_linux_test_utils', | |
63 'type': 'static_library', | |
64 'dependencies': [ | |
65 '../testing/gtest.gyp:gtest', | |
66 ], | |
67 'include_dirs': [ | |
68 '../..', | |
69 ], | |
70 'sources': [ | |
71 'tests/sandbox_test_runner.cc', | |
72 'tests/sandbox_test_runner.h', | |
73 'tests/sandbox_test_runner_function_pointer.cc', | |
74 'tests/sandbox_test_runner_function_pointer.h', | |
75 'tests/test_utils.cc', | |
76 'tests/test_utils.h', | |
77 'tests/unit_tests.cc', | |
78 'tests/unit_tests.h', | |
79 ], | |
80 'conditions': [ | |
81 [ 'use_seccomp_bpf==1', { | |
82 'sources': [ | |
83 'seccomp-bpf/bpf_tester_compatibility_delegate.h', | |
84 'seccomp-bpf/bpf_tests.h', | |
85 'seccomp-bpf/sandbox_bpf_test_runner.cc', | |
86 'seccomp-bpf/sandbox_bpf_test_runner.h', | |
87 ], | |
88 'dependencies': [ | |
89 'seccomp_bpf', | |
90 ] | |
91 }], | |
92 [ 'use_base_test_suite==1', { | |
93 'dependencies': [ | |
94 '../base/base.gyp:test_support_base', | |
95 ], | |
96 'defines': [ | |
97 'SANDBOX_USES_BASE_TEST_SUITE', | |
98 ], | |
99 }], | |
100 ], | |
101 }, | |
102 { | |
103 # The main sandboxing test target. | |
104 'target_name': 'sandbox_linux_unittests', | |
105 'includes': [ | |
106 'sandbox_linux_test_sources.gypi', | |
107 ], | |
108 'type': 'executable', | |
109 'conditions': [ | |
110 [ 'OS == "android"', { | |
111 'variables': { | |
112 'test_type': 'gtest', | |
113 'test_suite_name': '<(_target_name)', | |
114 }, | |
115 'includes': [ | |
116 '../../build/android/test_runner.gypi', | |
117 ], | |
118 }] | |
119 ] | |
120 }, | |
121 { | |
122 'target_name': 'seccomp_bpf', | |
123 'type': '<(component)', | |
124 'sources': [ | |
125 'bpf_dsl/bpf_dsl.cc', | |
126 'bpf_dsl/bpf_dsl.h', | |
127 'bpf_dsl/bpf_dsl_forward.h', | |
128 'bpf_dsl/bpf_dsl_impl.h', | |
129 'bpf_dsl/codegen.cc', | |
130 'bpf_dsl/codegen.h', | |
131 'bpf_dsl/cons.h', | |
132 'bpf_dsl/errorcode.h', | |
133 'bpf_dsl/linux_syscall_ranges.h', | |
134 'bpf_dsl/policy.cc', | |
135 'bpf_dsl/policy.h', | |
136 'bpf_dsl/policy_compiler.cc', | |
137 'bpf_dsl/policy_compiler.h', | |
138 'bpf_dsl/seccomp_macros.h', | |
139 'bpf_dsl/seccomp_macros.h', | |
140 'bpf_dsl/syscall_set.cc', | |
141 'bpf_dsl/syscall_set.h', | |
142 'bpf_dsl/trap_registry.h', | |
143 'seccomp-bpf-helpers/baseline_policy.cc', | |
144 'seccomp-bpf-helpers/baseline_policy.h', | |
145 'seccomp-bpf-helpers/sigsys_handlers.cc', | |
146 'seccomp-bpf-helpers/sigsys_handlers.h', | |
147 'seccomp-bpf-helpers/syscall_parameters_restrictions.cc', | |
148 'seccomp-bpf-helpers/syscall_parameters_restrictions.h', | |
149 'seccomp-bpf-helpers/syscall_sets.cc', | |
150 'seccomp-bpf-helpers/syscall_sets.h', | |
151 'seccomp-bpf/die.cc', | |
152 'seccomp-bpf/die.h', | |
153 'seccomp-bpf/sandbox_bpf.cc', | |
154 'seccomp-bpf/sandbox_bpf.h', | |
155 'seccomp-bpf/syscall.cc', | |
156 'seccomp-bpf/syscall.h', | |
157 'seccomp-bpf/trap.cc', | |
158 'seccomp-bpf/trap.h', | |
159 ], | |
160 'dependencies': [ | |
161 '../base/base.gyp:base', | |
162 'sandbox_services', | |
163 'sandbox_services_headers', | |
164 ], | |
165 'defines': [ | |
166 'SANDBOX_IMPLEMENTATION', | |
167 ], | |
168 'includes': [ | |
169 # Disable LTO due to compiler bug | |
170 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57703 | |
171 '../../build/android/disable_gcc_lto.gypi', | |
172 ], | |
173 'include_dirs': [ | |
174 '../..', | |
175 ], | |
176 }, | |
177 { | |
178 # The setuid sandbox, for Linux | |
179 'target_name': 'chrome_sandbox', | |
180 'type': 'executable', | |
181 'sources': [ | |
182 'suid/common/sandbox.h', | |
183 'suid/common/suid_unsafe_environment_variables.h', | |
184 'suid/process_util.h', | |
185 'suid/process_util_linux.c', | |
186 'suid/sandbox.c', | |
187 ], | |
188 'cflags': [ | |
189 # For ULLONG_MAX | |
190 '-std=gnu99', | |
191 ], | |
192 'include_dirs': [ | |
193 '../..', | |
194 ], | |
195 # Do not use any sanitizer tools with this binary. http://crbug.com/382766 | |
196 'cflags/': [ | |
197 ['exclude', '-fsanitize'], | |
198 ], | |
199 'ldflags/': [ | |
200 ['exclude', '-fsanitize'], | |
201 ], | |
202 }, | |
203 { 'target_name': 'sandbox_services', | |
204 'type': '<(component)', | |
205 'sources': [ | |
206 'services/init_process_reaper.cc', | |
207 'services/init_process_reaper.h', | |
208 'services/proc_util.cc', | |
209 'services/proc_util.h', | |
210 'services/resource_limits.cc', | |
211 'services/resource_limits.h', | |
212 'services/scoped_process.cc', | |
213 'services/scoped_process.h', | |
214 'services/syscall_wrappers.cc', | |
215 'services/syscall_wrappers.h', | |
216 'services/thread_helpers.cc', | |
217 'services/thread_helpers.h', | |
218 'services/yama.cc', | |
219 'services/yama.h', | |
220 'syscall_broker/broker_channel.cc', | |
221 'syscall_broker/broker_channel.h', | |
222 'syscall_broker/broker_client.cc', | |
223 'syscall_broker/broker_client.h', | |
224 'syscall_broker/broker_common.h', | |
225 'syscall_broker/broker_file_permission.cc', | |
226 'syscall_broker/broker_file_permission.h', | |
227 'syscall_broker/broker_host.cc', | |
228 'syscall_broker/broker_host.h', | |
229 'syscall_broker/broker_policy.cc', | |
230 'syscall_broker/broker_policy.h', | |
231 'syscall_broker/broker_process.cc', | |
232 'syscall_broker/broker_process.h', | |
233 ], | |
234 'dependencies': [ | |
235 '../base/base.gyp:base', | |
236 ], | |
237 'defines': [ | |
238 'SANDBOX_IMPLEMENTATION', | |
239 ], | |
240 'conditions': [ | |
241 ['compile_credentials==1', { | |
242 'sources': [ | |
243 'services/credentials.cc', | |
244 'services/credentials.h', | |
245 'services/namespace_sandbox.cc', | |
246 'services/namespace_sandbox.h', | |
247 'services/namespace_utils.cc', | |
248 'services/namespace_utils.h', | |
249 ], | |
250 'dependencies': [ | |
251 # for capability.h. | |
252 'sandbox_services_headers', | |
253 ], | |
254 }], | |
255 ], | |
256 'include_dirs': [ | |
257 '..', | |
258 ], | |
259 }, | |
260 { 'target_name': 'sandbox_services_headers', | |
261 'type': 'none', | |
262 'sources': [ | |
263 'system_headers/arm64_linux_syscalls.h', | |
264 'system_headers/arm64_linux_ucontext.h', | |
265 'system_headers/arm_linux_syscalls.h', | |
266 'system_headers/arm_linux_ucontext.h', | |
267 'system_headers/capability.h', | |
268 'system_headers/i386_linux_ucontext.h', | |
269 'system_headers/linux_futex.h', | |
270 'system_headers/linux_seccomp.h', | |
271 'system_headers/linux_syscalls.h', | |
272 'system_headers/linux_time.h', | |
273 'system_headers/linux_ucontext.h', | |
274 'system_headers/mips_linux_syscalls.h', | |
275 'system_headers/mips_linux_ucontext.h', | |
276 'system_headers/x86_32_linux_syscalls.h', | |
277 'system_headers/x86_64_linux_syscalls.h', | |
278 ], | |
279 'include_dirs': [ | |
280 '..', | |
281 ], | |
282 }, | |
283 { | |
284 'target_name': 'suid_sandbox_client', | |
285 'type': '<(component)', | |
286 'sources': [ | |
287 'suid/common/sandbox.h', | |
288 'suid/common/suid_unsafe_environment_variables.h', | |
289 'suid/client/setuid_sandbox_client.cc', | |
290 'suid/client/setuid_sandbox_client.h', | |
291 'suid/client/setuid_sandbox_host.cc', | |
292 'suid/client/setuid_sandbox_host.h', | |
293 ], | |
294 'defines': [ | |
295 'SANDBOX_IMPLEMENTATION', | |
296 ], | |
297 'dependencies': [ | |
298 '../base/base.gyp:base', | |
299 'sandbox_services', | |
300 ], | |
301 'include_dirs': [ | |
302 '..', | |
303 ], | |
304 }, | |
305 { | |
306 'target_name': 'bpf_dsl_golden', | |
307 'type': 'none', | |
308 'actions': [ | |
309 { | |
310 'action_name': 'generate', | |
311 'inputs': [ | |
312 'bpf_dsl/golden/generate.py', | |
313 'bpf_dsl/golden/i386/ArgSizePolicy.txt', | |
314 'bpf_dsl/golden/i386/BasicPolicy.txt', | |
315 'bpf_dsl/golden/i386/ElseIfPolicy.txt', | |
316 'bpf_dsl/golden/i386/MaskingPolicy.txt', | |
317 'bpf_dsl/golden/i386/MoreBooleanLogicPolicy.txt', | |
318 'bpf_dsl/golden/i386/NegativeConstantsPolicy.txt', | |
319 'bpf_dsl/golden/i386/SwitchPolicy.txt', | |
320 'bpf_dsl/golden/x86-64/ArgSizePolicy.txt', | |
321 'bpf_dsl/golden/x86-64/BasicPolicy.txt', | |
322 'bpf_dsl/golden/x86-64/BooleanLogicPolicy.txt', | |
323 'bpf_dsl/golden/x86-64/ElseIfPolicy.txt', | |
324 'bpf_dsl/golden/x86-64/MaskingPolicy.txt', | |
325 'bpf_dsl/golden/x86-64/MoreBooleanLogicPolicy.txt', | |
326 'bpf_dsl/golden/x86-64/NegativeConstantsPolicy.txt', | |
327 'bpf_dsl/golden/x86-64/SwitchPolicy.txt', | |
328 ], | |
329 'outputs': [ | |
330 '<(SHARED_INTERMEDIATE_DIR)/sandbox/linux/bpf_dsl/golden/golden_file
s.h', | |
331 ], | |
332 'action': [ | |
333 'python', | |
334 'linux/bpf_dsl/golden/generate.py', | |
335 '<(SHARED_INTERMEDIATE_DIR)/sandbox/linux/bpf_dsl/golden/golden_file
s.h', | |
336 'linux/bpf_dsl/golden/i386/ArgSizePolicy.txt', | |
337 'linux/bpf_dsl/golden/i386/BasicPolicy.txt', | |
338 'linux/bpf_dsl/golden/i386/ElseIfPolicy.txt', | |
339 'linux/bpf_dsl/golden/i386/MaskingPolicy.txt', | |
340 'linux/bpf_dsl/golden/i386/MoreBooleanLogicPolicy.txt', | |
341 'linux/bpf_dsl/golden/i386/NegativeConstantsPolicy.txt', | |
342 'linux/bpf_dsl/golden/i386/SwitchPolicy.txt', | |
343 'linux/bpf_dsl/golden/x86-64/ArgSizePolicy.txt', | |
344 'linux/bpf_dsl/golden/x86-64/BasicPolicy.txt', | |
345 'linux/bpf_dsl/golden/x86-64/BooleanLogicPolicy.txt', | |
346 'linux/bpf_dsl/golden/x86-64/ElseIfPolicy.txt', | |
347 'linux/bpf_dsl/golden/x86-64/MaskingPolicy.txt', | |
348 'linux/bpf_dsl/golden/x86-64/MoreBooleanLogicPolicy.txt', | |
349 'linux/bpf_dsl/golden/x86-64/NegativeConstantsPolicy.txt', | |
350 'linux/bpf_dsl/golden/x86-64/SwitchPolicy.txt', | |
351 ], | |
352 'message': 'Generating header from golden files ...', | |
353 }, | |
354 ], | |
355 }, | |
356 ], | |
357 'conditions': [ | |
358 [ 'OS=="android"', { | |
359 'targets': [ | |
360 { | |
361 'target_name': 'sandbox_linux_unittests_deps', | |
362 'type': 'none', | |
363 'dependencies': [ | |
364 'sandbox_linux_unittests', | |
365 ], | |
366 'variables': { | |
367 'output_dir': '<(PRODUCT_DIR)/sandbox_linux_unittests__dist/', | |
368 'native_binary': '<(PRODUCT_DIR)/sandbox_linux_unittests', | |
369 'include_main_binary': 1, | |
370 }, | |
371 'includes': [ | |
372 '../../build/android/native_app_dependencies.gypi' | |
373 ], | |
374 }], | |
375 }], | |
376 [ 'OS=="android"', { | |
377 'conditions': [ | |
378 ['test_isolation_mode != "noop"', { | |
379 'targets': [ | |
380 { | |
381 'target_name': 'sandbox_linux_unittests_apk_run', | |
382 'type': 'none', | |
383 'dependencies': [ | |
384 'sandbox_linux_unittests', | |
385 ], | |
386 'includes': [ | |
387 '../../build/isolate.gypi', | |
388 ], | |
389 'sources': [ | |
390 '../sandbox_linux_unittests_apk.isolate', | |
391 ], | |
392 }, | |
393 ], | |
394 }, | |
395 ], | |
396 ], | |
397 }], | |
398 ['test_isolation_mode != "noop"', { | |
399 'targets': [ | |
400 { | |
401 'target_name': 'sandbox_linux_unittests_run', | |
402 'type': 'none', | |
403 'dependencies': [ | |
404 'sandbox_linux_unittests', | |
405 ], | |
406 'includes': [ | |
407 '../../build/isolate.gypi', | |
408 ], | |
409 'sources': [ | |
410 '../sandbox_linux_unittests.isolate', | |
411 ], | |
412 }, | |
413 ], | |
414 }], | |
415 ], | |
416 } | |
OLD | NEW |