gvisor.dev/gvisor@v0.0.0-20240520182842-f9d4d51c7e0f/pkg/sentry/kernel/auth/BUILD (about)

     1  load("//pkg/sync/locking:locking.bzl", "declare_mutex", "declare_rwmutex")
     2  load("//tools:defs.bzl", "go_library", "go_test")
     3  load("//tools/go_generics:defs.bzl", "go_template_instance")
     4  
     5  package(
     6      default_applicable_licenses = ["//:license"],
     7      licenses = ["notice"],
     8  )
     9  
    10  go_template_instance(
    11      name = "atomicptr_credentials",
    12      out = "atomicptr_credentials_unsafe.go",
    13      package = "auth",
    14      suffix = "Credentials",
    15      template = "//pkg/sync/atomicptr:generic_atomicptr",
    16      types = {
    17          "Value": "Credentials",
    18      },
    19  )
    20  
    21  go_template_instance(
    22      name = "id_map_range",
    23      out = "id_map_range.go",
    24      package = "auth",
    25      prefix = "idMap",
    26      template = "//pkg/segment:generic_range",
    27      types = {
    28          "T": "uint32",
    29      },
    30  )
    31  
    32  go_template_instance(
    33      name = "id_map_set",
    34      out = "id_map_set.go",
    35      consts = {
    36          "minDegree": "3",
    37      },
    38      package = "auth",
    39      prefix = "idMap",
    40      template = "//pkg/segment:generic_set",
    41      types = {
    42          "Key": "uint32",
    43          "Range": "idMapRange",
    44          "Value": "uint32",
    45          "Functions": "idMapFunctions",
    46      },
    47  )
    48  
    49  declare_mutex(
    50      name = "user_namespace_mutex",
    51      out = "user_namespace_mutex.go",
    52      nested_lock_names = ["ns"],
    53      package = "auth",
    54      prefix = "userNamespace",
    55  )
    56  
    57  declare_rwmutex(
    58      name = "keyset_mutex",
    59      out = "keyset_mutex.go",
    60      package = "auth",
    61      prefix = "keyset",
    62  )
    63  
    64  declare_mutex(
    65      name = "keyset_transaction_mutex",
    66      out = "keyset_transaction_mutex.go",
    67      package = "auth",
    68      prefix = "keysetTransaction",
    69  )
    70  
    71  go_library(
    72      name = "auth",
    73      srcs = [
    74          "atomicptr_credentials_unsafe.go",
    75          "auth.go",
    76          "capability_set.go",
    77          "context.go",
    78          "credentials.go",
    79          "id.go",
    80          "id_map.go",
    81          "id_map_functions.go",
    82          "id_map_range.go",
    83          "id_map_set.go",
    84          "key.go",
    85          "keyset_mutex.go",
    86          "keyset_transaction_mutex.go",
    87          "user_namespace.go",
    88          "user_namespace_mutex.go",
    89      ],
    90      marshal = True,
    91      visibility = ["//pkg/sentry:internal"],
    92      deps = [
    93          "//pkg/abi/linux",
    94          "//pkg/bits",
    95          "//pkg/context",
    96          "//pkg/errors/linuxerr",
    97          "//pkg/log",
    98          "//pkg/rand",
    99          "//pkg/sentry/seccheck",
   100          "//pkg/sentry/seccheck/points:points_go_proto",
   101          "//pkg/sync",
   102          "//pkg/sync/locking",
   103      ],
   104  )
   105  
   106  go_test(
   107      name = "auth_test",
   108      srcs = ["capability_set_test.go"],
   109      library = ":auth",
   110      deps = [
   111          "//pkg/abi/linux",
   112          "//pkg/errors/linuxerr",
   113      ],
   114  )