github.com/SagerNet/gvisor@v0.0.0-20210707092255-7731c139d75c/pkg/sentry/kernel/BUILD (about) 1 load("//tools:defs.bzl", "go_library", "go_test", "proto_library") 2 load("//tools/go_generics:defs.bzl", "go_template_instance") 3 4 package(licenses = ["notice"]) 5 6 go_template_instance( 7 name = "pending_signals_list", 8 out = "pending_signals_list.go", 9 package = "kernel", 10 prefix = "pendingSignal", 11 template = "//pkg/ilist:generic_list", 12 types = { 13 "Element": "*pendingSignal", 14 "Linker": "*pendingSignal", 15 }, 16 ) 17 18 go_template_instance( 19 name = "process_group_list", 20 out = "process_group_list.go", 21 package = "kernel", 22 prefix = "processGroup", 23 template = "//pkg/ilist:generic_list", 24 types = { 25 "Element": "*ProcessGroup", 26 "Linker": "*ProcessGroup", 27 }, 28 ) 29 30 go_template_instance( 31 name = "seqatomic_taskgoroutineschedinfo", 32 out = "seqatomic_taskgoroutineschedinfo_unsafe.go", 33 package = "kernel", 34 suffix = "TaskGoroutineSchedInfo", 35 template = "//pkg/sync/seqatomic:generic_seqatomic", 36 types = { 37 "Value": "TaskGoroutineSchedInfo", 38 }, 39 ) 40 41 go_template_instance( 42 name = "session_list", 43 out = "session_list.go", 44 package = "kernel", 45 prefix = "session", 46 template = "//pkg/ilist:generic_list", 47 types = { 48 "Element": "*Session", 49 "Linker": "*Session", 50 }, 51 ) 52 53 go_template_instance( 54 name = "task_list", 55 out = "task_list.go", 56 package = "kernel", 57 prefix = "task", 58 template = "//pkg/ilist:generic_list", 59 types = { 60 "Element": "*Task", 61 "Linker": "*Task", 62 }, 63 ) 64 65 go_template_instance( 66 name = "socket_list", 67 out = "socket_list.go", 68 package = "kernel", 69 prefix = "socket", 70 template = "//pkg/ilist:generic_list", 71 types = { 72 "Element": "*SocketRecordVFS1", 73 "Linker": "*SocketRecordVFS1", 74 }, 75 ) 76 77 go_template_instance( 78 name = "fd_table_refs", 79 out = "fd_table_refs.go", 80 package = "kernel", 81 prefix = "FDTable", 82 template = "//pkg/refsvfs2:refs_template", 83 types = { 84 "T": "FDTable", 85 }, 86 ) 87 88 go_template_instance( 89 name = "fs_context_refs", 90 out = "fs_context_refs.go", 91 package = "kernel", 92 prefix = "FSContext", 93 template = "//pkg/refsvfs2:refs_template", 94 types = { 95 "T": "FSContext", 96 }, 97 ) 98 99 go_template_instance( 100 name = "ipc_namespace_refs", 101 out = "ipc_namespace_refs.go", 102 package = "kernel", 103 prefix = "IPCNamespace", 104 template = "//pkg/refsvfs2:refs_template", 105 types = { 106 "T": "IPCNamespace", 107 }, 108 ) 109 110 go_template_instance( 111 name = "process_group_refs", 112 out = "process_group_refs.go", 113 package = "kernel", 114 prefix = "ProcessGroup", 115 template = "//pkg/refsvfs2:refs_template", 116 types = { 117 "T": "ProcessGroup", 118 }, 119 ) 120 121 go_template_instance( 122 name = "session_refs", 123 out = "session_refs.go", 124 package = "kernel", 125 prefix = "Session", 126 template = "//pkg/refsvfs2:refs_template", 127 types = { 128 "T": "Session", 129 }, 130 ) 131 132 proto_library( 133 name = "uncaught_signal", 134 srcs = ["uncaught_signal.proto"], 135 visibility = ["//visibility:public"], 136 deps = ["//pkg/sentry/arch:registers_proto"], 137 ) 138 139 go_library( 140 name = "kernel", 141 srcs = [ 142 "abstract_socket_namespace.go", 143 "aio.go", 144 "cgroup.go", 145 "context.go", 146 "fd_table.go", 147 "fd_table_refs.go", 148 "fd_table_unsafe.go", 149 "fs_context.go", 150 "fs_context_refs.go", 151 "ipc_namespace.go", 152 "ipc_namespace_refs.go", 153 "kcov.go", 154 "kcov_unsafe.go", 155 "kernel.go", 156 "kernel_opts.go", 157 "kernel_state.go", 158 "pending_signals.go", 159 "pending_signals_list.go", 160 "pending_signals_state.go", 161 "posixtimer.go", 162 "process_group_list.go", 163 "process_group_refs.go", 164 "ptrace.go", 165 "ptrace_amd64.go", 166 "ptrace_arm64.go", 167 "rseq.go", 168 "seccomp.go", 169 "seqatomic_taskgoroutineschedinfo_unsafe.go", 170 "session_list.go", 171 "session_refs.go", 172 "sessions.go", 173 "signal.go", 174 "signal_handlers.go", 175 "socket_list.go", 176 "syscalls.go", 177 "syscalls_state.go", 178 "syslog.go", 179 "task.go", 180 "task_acct.go", 181 "task_block.go", 182 "task_cgroup.go", 183 "task_clone.go", 184 "task_context.go", 185 "task_exec.go", 186 "task_exit.go", 187 "task_futex.go", 188 "task_identity.go", 189 "task_image.go", 190 "task_list.go", 191 "task_log.go", 192 "task_net.go", 193 "task_run.go", 194 "task_sched.go", 195 "task_signals.go", 196 "task_start.go", 197 "task_stop.go", 198 "task_syscall.go", 199 "task_usermem.go", 200 "task_work.go", 201 "thread_group.go", 202 "threads.go", 203 "timekeeper.go", 204 "timekeeper_state.go", 205 "tty.go", 206 "uts_namespace.go", 207 "vdso.go", 208 "version.go", 209 ], 210 imports = [ 211 "gvisor.dev/gvisor/pkg/bpf", 212 "gvisor.dev/gvisor/pkg/sentry/device", 213 "gvisor.dev/gvisor/pkg/tcpip", 214 ], 215 marshal = True, 216 visibility = ["//:sandbox"], 217 deps = [ 218 ":uncaught_signal_go_proto", 219 "//pkg/abi", 220 "//pkg/abi/linux", 221 "//pkg/abi/linux/errno", 222 "//pkg/amutex", 223 "//pkg/bits", 224 "//pkg/bpf", 225 "//pkg/cleanup", 226 "//pkg/context", 227 "//pkg/coverage", 228 "//pkg/cpuid", 229 "//pkg/errors", 230 "//pkg/errors/linuxerr", 231 "//pkg/eventchannel", 232 "//pkg/fspath", 233 "//pkg/goid", 234 "//pkg/hostarch", 235 "//pkg/log", 236 "//pkg/marshal", 237 "//pkg/marshal/primitive", 238 "//pkg/metric", 239 "//pkg/refs", 240 "//pkg/refsvfs2", 241 "//pkg/safemem", 242 "//pkg/secio", 243 "//pkg/sentry/arch", 244 "//pkg/sentry/device", 245 "//pkg/sentry/fs", 246 "//pkg/sentry/fs/lock", 247 "//pkg/sentry/fs/timerfd", 248 "//pkg/sentry/fsbridge", 249 "//pkg/sentry/fsimpl/kernfs", 250 "//pkg/sentry/fsimpl/pipefs", 251 "//pkg/sentry/fsimpl/sockfs", 252 "//pkg/sentry/fsimpl/timerfd", 253 "//pkg/sentry/fsimpl/tmpfs", 254 "//pkg/sentry/hostcpu", 255 "//pkg/sentry/inet", 256 "//pkg/sentry/kernel/auth", 257 "//pkg/sentry/kernel/epoll", 258 "//pkg/sentry/kernel/futex", 259 "//pkg/sentry/kernel/sched", 260 "//pkg/sentry/kernel/semaphore", 261 "//pkg/sentry/kernel/shm", 262 "//pkg/sentry/kernel/time", 263 "//pkg/sentry/limits", 264 "//pkg/sentry/loader", 265 "//pkg/sentry/memmap", 266 "//pkg/sentry/mm", 267 "//pkg/sentry/pgalloc", 268 "//pkg/sentry/platform", 269 "//pkg/sentry/socket/netlink/port", 270 "//pkg/sentry/socket/unix/transport", 271 "//pkg/sentry/time", 272 "//pkg/sentry/unimpl", 273 "//pkg/sentry/unimpl:unimplemented_syscall_go_proto", 274 "//pkg/sentry/uniqueid", 275 "//pkg/sentry/usage", 276 "//pkg/sentry/vfs", 277 "//pkg/state", 278 "//pkg/state/statefile", 279 "//pkg/state/wire", 280 "//pkg/sync", 281 "//pkg/syserr", 282 "//pkg/syserror", 283 "//pkg/tcpip", 284 "//pkg/tcpip/stack", 285 "//pkg/usermem", 286 "//pkg/waiter", 287 "@org_golang_x_sys//unix:go_default_library", 288 ], 289 ) 290 291 go_test( 292 name = "kernel_test", 293 size = "small", 294 srcs = [ 295 "fd_table_test.go", 296 "table_test.go", 297 "task_test.go", 298 "timekeeper_test.go", 299 ], 300 library = ":kernel", 301 deps = [ 302 "//pkg/abi", 303 "//pkg/context", 304 "//pkg/errors/linuxerr", 305 "//pkg/hostarch", 306 "//pkg/sentry/arch", 307 "//pkg/sentry/contexttest", 308 "//pkg/sentry/fs", 309 "//pkg/sentry/fs/filetest", 310 "//pkg/sentry/kernel/sched", 311 "//pkg/sentry/limits", 312 "//pkg/sentry/pgalloc", 313 "//pkg/sentry/time", 314 "//pkg/sentry/usage", 315 "//pkg/sync", 316 ], 317 )