]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - security/apparmor/secid.c
2 * AppArmor security module
4 * This file contains AppArmor security identifier (secid) manipulation fns
6 * Copyright 2009-2010 Canonical Ltd.
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation, version 2 of the
14 * AppArmor allocates a unique secid for every profile loaded. If a profile
15 * is replaced it receives the secid of the profile it is replacing.
17 * The secid value of 0 is invalid.
20 #include <linux/spinlock.h>
21 #include <linux/errno.h>
22 #include <linux/err.h>
24 #include "include/secid.h"
26 /* global counter from which secids are allocated */
27 static u32 global_secid
;
28 static DEFINE_SPINLOCK(secid_lock
);
30 /* TODO FIXME: add secid to profile mapping, and secid recycling */
33 * aa_alloc_secid - allocate a new secid for a profile
35 u32
aa_alloc_secid(void)
40 * TODO FIXME: secid recycling - part of profile mapping table
42 spin_lock(&secid_lock
);
43 secid
= (++global_secid
);
44 spin_unlock(&secid_lock
);
49 * aa_free_secid - free a secid
50 * @secid: secid to free
52 void aa_free_secid(u32 secid
)