summaryrefslogtreecommitdiffstats
path: root/sandbox/sandbox_linux.gypi
blob: 865c22da959d7c5e570bb0e16e1e3dd437d091e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

{
  'targets': [
    # We have two principal targets: sandbox and sandbox_linux_unittests
    # All other targets are listed as dependencies.
    # FIXME(jln): for historial reasons, sandbox_linux is the setuid sandbox
    # and is its own target.
    {
      'target_name': 'sandbox',
      'type': 'none',
      'conditions': [
        # Only compile in the seccomp mode 1 code for the flag combination
        # where we support it.
        [ 'OS=="linux" and (target_arch=="ia32" or target_arch=="x64") '
          'and toolkit_views==0 and selinux==0', {
          'dependencies': [
            'linux/seccomp-legacy/seccomp.gyp:seccomp_sandbox',
          ],
        }],
        # Similarly, compile seccomp BPF when we support it
        [ 'OS=="linux" and (target_arch=="ia32" or target_arch=="x64")', {
          'type': 'static_library',
          'dependencies': [
            'seccomp_bpf',
          ],
        }],
      ],
    },
    {
      'target_name': 'sandbox_linux_unittests',
      'type': 'executable',
      'dependencies': [
        'sandbox',
        '../testing/gtest.gyp:gtest',
      ],
      'sources': [
        'linux/tests/unit_tests.cc',
      ],
      'include_dirs': [
        '..',
      ],
      'conditions': [
        [ 'OS=="linux" and (target_arch=="ia32" or target_arch=="x64")', {
          'sources': [
            'linux/seccomp-bpf/sandbox_bpf_unittest.cc',
          ],
        }],
      ],
    },
    {
      'target_name': 'seccomp_bpf',
      'type': 'static_library',
      'sources': [
        'linux/seccomp-bpf/sandbox_bpf.cc',
        'linux/seccomp-bpf/sandbox_bpf.h',
        'linux/seccomp-bpf/verifier.cc',
        'linux/seccomp-bpf/verifier.h',
      ],
      'dependencies': [
        '../base/base.gyp:base',
      ],
      'include_dirs': [
        '..',
      ],
    },
    {
      # The setuid sandbox, for Linux
      'target_name': 'chrome_sandbox',
      'type': 'executable',
      'sources': [
        'linux/suid/linux_util.c',
        'linux/suid/linux_util.h',
        'linux/suid/process_util.h',
        'linux/suid/process_util_linux.c',
        'linux/suid/sandbox.h',
        'linux/suid/sandbox.c',
      ],
      'cflags': [
        # For ULLONG_MAX
        '-std=gnu99',
      ],
      'include_dirs': [
        '..',
      ],
    },
    {
      'target_name': 'libc_urandom_override',
      'type': 'static_library',
      'sources': [
        'linux/services/libc_urandom_override.cc',
        'linux/services/libc_urandom_override.h',
      ],
      'dependencies': [
        '../base/base.gyp:base',
      ],
      'include_dirs': [
        '..',
      ],
    },
  ],
}