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.
9 'compile_suid_client': 1,
10 'compile_credentials': 1,
12 'compile_suid_client': 0,
13 'compile_credentials': 0,
15 ['((OS=="linux" or OS=="android") and '
16 '(target_arch=="ia32" or target_arch=="x64" or '
17 'target_arch=="arm"))', {
18 'compile_seccomp_bpf': 1,
20 'compile_seccomp_bpf': 0,
22 ['OS=="linux" and (target_arch=="ia32" or target_arch=="x64")', {
23 'compile_seccomp_bpf_demo': 1,
25 'compile_seccomp_bpf_demo': 0,
30 'target_conditions': [
31 # All linux/ files will automatically be excluded on Android
32 # so make sure we re-include them explicitly.
35 ['include', '^linux/'],
41 # We have two principal targets: sandbox and sandbox_linux_unittests
42 # All other targets are listed as dependencies.
43 # FIXME(jln): for historial reasons, sandbox_linux is the setuid sandbox
44 # and is its own target.
46 'target_name': 'sandbox',
52 [ 'compile_suid_client==1', {
54 'suid_sandbox_client',
57 # Compile seccomp BPF when we support it.
58 [ 'compile_seccomp_bpf==1', {
61 'seccomp_bpf_helpers',
67 # The main sandboxing test target.
68 'target_name': 'sandbox_linux_unittests',
70 'sandbox_linux_test_sources.gypi',
75 # This target is the shared library used by Android APK (i.e.
76 # JNI-friendly) tests.
77 'target_name': 'sandbox_linux_jni_unittests',
79 'sandbox_linux_test_sources.gypi',
81 'type': 'shared_library',
83 [ 'OS == "android" and gtest_target_type == "shared_library"', {
85 '../testing/android/native_test.gyp:native_test_native_code',
88 # Remove warnings about text relocations, to prevent build
90 '-Wl,--warn-shared-textrel'
96 'target_name': 'seccomp_bpf',
97 'type': 'static_library',
99 'seccomp-bpf/basicblock.cc',
100 'seccomp-bpf/basicblock.h',
101 'seccomp-bpf/codegen.cc',
102 'seccomp-bpf/codegen.h',
103 'seccomp-bpf/die.cc',
105 'seccomp-bpf/errorcode.cc',
106 'seccomp-bpf/errorcode.h',
107 'seccomp-bpf/instruction.h',
108 'seccomp-bpf/linux_seccomp.h',
109 'seccomp-bpf/sandbox_bpf.cc',
110 'seccomp-bpf/sandbox_bpf.h',
111 'seccomp-bpf/sandbox_bpf_policy.h',
112 'seccomp-bpf/syscall.cc',
113 'seccomp-bpf/syscall.h',
114 'seccomp-bpf/syscall_iterator.cc',
115 'seccomp-bpf/syscall_iterator.h',
116 'seccomp-bpf/trap.cc',
117 'seccomp-bpf/trap.h',
118 'seccomp-bpf/verifier.cc',
119 'seccomp-bpf/verifier.h',
122 '../base/base.gyp:base',
123 'sandbox_services_headers',
130 'target_name': 'seccomp_bpf_helpers',
131 'type': 'static_library',
133 'seccomp-bpf-helpers/baseline_policy.cc',
134 'seccomp-bpf-helpers/baseline_policy.h',
135 'seccomp-bpf-helpers/sigsys_handlers.cc',
136 'seccomp-bpf-helpers/sigsys_handlers.h',
137 'seccomp-bpf-helpers/syscall_parameters_restrictions.cc',
138 'seccomp-bpf-helpers/syscall_parameters_restrictions.h',
139 'seccomp-bpf-helpers/syscall_sets.cc',
140 'seccomp-bpf-helpers/syscall_sets.h',
149 # A demonstration program for the seccomp-bpf sandbox.
150 'target_name': 'seccomp_bpf_demo',
152 ['compile_seccomp_bpf_demo==1', {
153 'type': 'executable',
155 'seccomp-bpf/demo.cc',
169 # The setuid sandbox, for Linux
170 'target_name': 'chrome_sandbox',
171 'type': 'executable',
173 'suid/common/sandbox.h',
174 'suid/common/suid_unsafe_environment_variables.h',
177 'suid/process_util.h',
178 'suid/process_util_linux.c',
189 { 'target_name': 'sandbox_services',
190 'type': 'static_library',
192 'services/broker_process.cc',
193 'services/broker_process.h',
194 'services/init_process_reaper.cc',
195 'services/init_process_reaper.h',
198 '../base/base.gyp:base',
201 ['compile_credentials==1', {
203 'services/credentials.cc',
204 'services/credentials.h',
207 # for capabilities.cc.
208 '../build/linux/system.gyp:libcap',
216 { 'target_name': 'sandbox_services_headers',
219 'services/android_arm_ucontext.h',
220 'services/android_ucontext.h',
221 'services/android_i386_ucontext.h',
222 'services/arm_linux_syscalls.h',
223 'services/linux_syscalls.h',
224 'services/x86_32_linux_syscalls.h',
225 'services/x86_64_linux_syscalls.h',
232 # We make this its own target so that it does not interfere
234 'target_name': 'libc_urandom_override',
235 'type': 'static_library',
237 'services/libc_urandom_override.cc',
238 'services/libc_urandom_override.h',
241 '../base/base.gyp:base',
248 'target_name': 'suid_sandbox_client',
249 'type': 'static_library',
251 'suid/common/sandbox.h',
252 'suid/common/suid_unsafe_environment_variables.h',
253 'suid/client/setuid_sandbox_client.cc',
254 'suid/client/setuid_sandbox_client.h',
257 '../base/base.gyp:base',
266 # Strategy copied from base_unittests_apk in base/base.gyp.
267 [ 'OS=="android" and gtest_target_type == "shared_library"', {
270 'target_name': 'sandbox_linux_jni_unittests_apk',
273 'test_suite_name': 'sandbox_linux_jni_unittests',
275 '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)'
276 'sandbox_linux_jni_unittests'
277 '<(SHARED_LIB_SUFFIX)',
280 'sandbox_linux_jni_unittests',
282 'includes': [ '../../build/apk_test.gypi' ],