summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/mm/BUILD
blob: b7d782b7f41115b73fa6ca63ef7847551c63a99d (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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
load("//tools:defs.bzl", "go_library", "go_test")
load("//tools/go_generics:defs.bzl", "go_template_instance")

package(licenses = ["notice"])

go_template_instance(
    name = "file_refcount_set",
    out = "file_refcount_set.go",
    imports = {
        "memmap": "gvisor.dev/gvisor/pkg/sentry/memmap",
    },
    package = "mm",
    prefix = "fileRefcount",
    template = "//pkg/segment:generic_set",
    types = {
        "Key": "uint64",
        "Range": "memmap.FileRange",
        "Value": "int32",
        "Functions": "fileRefcountSetFunctions",
    },
)

go_template_instance(
    name = "vma_set",
    out = "vma_set.go",
    consts = {
        "minDegree": "8",
        "trackGaps": "1",
    },
    imports = {
        "hostarch": "gvisor.dev/gvisor/pkg/hostarch",
    },
    package = "mm",
    prefix = "vma",
    template = "//pkg/segment:generic_set",
    types = {
        "Key": "hostarch.Addr",
        "Range": "hostarch.AddrRange",
        "Value": "vma",
        "Functions": "vmaSetFunctions",
    },
)

go_template_instance(
    name = "pma_set",
    out = "pma_set.go",
    consts = {
        "minDegree": "8",
    },
    imports = {
        "hostarch": "gvisor.dev/gvisor/pkg/hostarch",
    },
    package = "mm",
    prefix = "pma",
    template = "//pkg/segment:generic_set",
    types = {
        "Key": "hostarch.Addr",
        "Range": "hostarch.AddrRange",
        "Value": "pma",
        "Functions": "pmaSetFunctions",
    },
)

go_template_instance(
    name = "io_list",
    out = "io_list.go",
    package = "mm",
    prefix = "io",
    template = "//pkg/ilist:generic_list",
    types = {
        "Element": "*ioResult",
        "Linker": "*ioResult",
    },
)

go_template_instance(
    name = "aio_mappable_refs",
    out = "aio_mappable_refs.go",
    package = "mm",
    prefix = "aioMappable",
    template = "//pkg/refsvfs2:refs_template",
    types = {
        "T": "aioMappable",
    },
)

go_template_instance(
    name = "special_mappable_refs",
    out = "special_mappable_refs.go",
    package = "mm",
    prefix = "SpecialMappable",
    template = "//pkg/refsvfs2:refs_template",
    types = {
        "T": "SpecialMappable",
    },
)

go_library(
    name = "mm",
    srcs = [
        "address_space.go",
        "aio_context.go",
        "aio_context_state.go",
        "aio_mappable_refs.go",
        "debug.go",
        "file_refcount_set.go",
        "io.go",
        "io_list.go",
        "lifecycle.go",
        "metadata.go",
        "mm.go",
        "pma.go",
        "pma_set.go",
        "procfs.go",
        "save_restore.go",
        "shm.go",
        "special_mappable.go",
        "special_mappable_refs.go",
        "syscalls.go",
        "vma.go",
        "vma_set.go",
    ],
    visibility = ["//pkg/sentry:internal"],
    deps = [
        "//pkg/abi/linux",
        "//pkg/atomicbitops",
        "//pkg/context",
        "//pkg/errors/linuxerr",
        "//pkg/hostarch",
        "//pkg/log",
        "//pkg/refs",
        "//pkg/refsvfs2",
        "//pkg/safecopy",
        "//pkg/safemem",
        "//pkg/sentry/arch",
        "//pkg/sentry/fs/proc/seqfile",
        "//pkg/sentry/fsbridge",
        "//pkg/sentry/kernel/auth",
        "//pkg/sentry/kernel/futex",
        "//pkg/sentry/kernel/shm",
        "//pkg/sentry/limits",
        "//pkg/sentry/memmap",
        "//pkg/sentry/pgalloc",
        "//pkg/sentry/platform",
        "//pkg/sentry/usage",
        "//pkg/sync",
        "//pkg/tcpip/buffer",
        "//pkg/usermem",
    ],
)

go_test(
    name = "mm_test",
    size = "small",
    srcs = ["mm_test.go"],
    library = ":mm",
    deps = [
        "//pkg/context",
        "//pkg/errors/linuxerr",
        "//pkg/hostarch",
        "//pkg/sentry/arch",
        "//pkg/sentry/contexttest",
        "//pkg/sentry/limits",
        "//pkg/sentry/memmap",
        "//pkg/sentry/pgalloc",
        "//pkg/sentry/platform",
        "//pkg/usermem",
    ],
)