linux/security/selinux/ss/avtab.c

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Implementation of the access vector table type.
 *
 * Author : Stephen Smalley, <[email protected]>
 */

/* Updated: Frank Mayer <[email protected]> and
 *          Karl MacMillan <[email protected]>
 *          Added conditional policy language extensions
 *          Copyright (C) 2003 Tresys Technology, LLC
 *
 * Updated: Yuichi Nakamura <[email protected]>
 *          Tuned number of hash slots for avtab to reduce memory usage
 */

#include <linux/bitops.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include "avtab.h"
#include "policydb.h"

static struct kmem_cache *avtab_node_cachep __ro_after_init;
static struct kmem_cache *avtab_xperms_cachep __ro_after_init;

/* Based on MurmurHash3, written by Austin Appleby and placed in the
 * public domain.
 */
static inline u32 avtab_hash(const struct avtab_key *keyp, u32 mask)
{}

static struct avtab_node *avtab_insert_node(struct avtab *h,
					    struct avtab_node **dst,
					    const struct avtab_key *key,
					    const struct avtab_datum *datum)
{}

static int avtab_node_cmp(const struct avtab_key *key1,
			  const struct avtab_key *key2)
{}

static int avtab_insert(struct avtab *h, const struct avtab_key *key,
			const struct avtab_datum *datum)
{}

/* Unlike avtab_insert(), this function allow multiple insertions of the same
 * key/specified mask into the table, as needed by the conditional avtab.
 * It also returns a pointer to the node inserted.
 */
struct avtab_node *avtab_insert_nonunique(struct avtab *h,
					  const struct avtab_key *key,
					  const struct avtab_datum *datum)
{}

/* This search function returns a node pointer, and can be used in
 * conjunction with avtab_search_next_node()
 */
struct avtab_node *avtab_search_node(struct avtab *h,
				     const struct avtab_key *key)
{}

struct avtab_node *avtab_search_node_next(struct avtab_node *node,
					  u16 specified)
{}

void avtab_destroy(struct avtab *h)
{}

void avtab_init(struct avtab *h)
{}

static int avtab_alloc_common(struct avtab *h, u32 nslot)
{}

int avtab_alloc(struct avtab *h, u32 nrules)
{}

int avtab_alloc_dup(struct avtab *new, const struct avtab *orig)
{}

#ifdef CONFIG_SECURITY_SELINUX_DEBUG
void avtab_hash_eval(struct avtab *h, const char *tag)
{}
#endif /* CONFIG_SECURITY_SELINUX_DEBUG */

/* clang-format off */
static const uint16_t spec_order[] =;
/* clang-format on */

int avtab_read_item(struct avtab *a, void *fp, struct policydb *pol,
		    int (*insertf)(struct avtab *a, const struct avtab_key *k,
				   const struct avtab_datum *d, void *p),
		    void *p)
{}

static int avtab_insertf(struct avtab *a, const struct avtab_key *k,
			 const struct avtab_datum *d, void *p)
{}

int avtab_read(struct avtab *a, void *fp, struct policydb *pol)
{}

int avtab_write_item(struct policydb *p, const struct avtab_node *cur, void *fp)
{}

int avtab_write(struct policydb *p, struct avtab *a, void *fp)
{}

void __init avtab_cache_init(void)
{}