9.5" /spaion /formon a 9.5" href="../linux+v3 v39/security/apparmor/sid.c">9.5" img src="../.static/gfx/right.png" alt=">>">9. /spaion9. spai class="lxr_search">9.5"9.5" input typluehidden" namluenavtarget" n value">9.5" input typluetext" namluesearch" iduesearch">9.5" butttiotypluesubmit">Search9.5" Prefsn /a>9. /spaion5" /divon5" form acopti="ajax+*" method="post" onsubmit="return false;">9. input typluehidden" namlueajax_lookup" idueajax_lookup" n value">95" /formon95" div class="headingbotttm">n div iduefile_contents"o
1 /a> spai class="comment">/* /spaion
2 /a> spai class="comment"> * AppArmor security module /spaion
3 /a> spai class="comment"> * /spaion
4 /a> spai class="comment"> * This file contains AppArmor security identifier (sid) manipulaoptiofns /spaion
5 /a> spai class="comment"> * /spaion
6 /a> spai class="comment"> * Copyright 2009-2010 Canonical Ltd. /spaion
7 /a> spai class="comment"> * /spaion
8 /a> spai class="comment"> * This program is free software; you cai redistribute it and/or /spaion
9 /a> spai class="comment"> * modify it under the terms of the GNU General Public License as /spaion
 8.11a> spai class="comment"> * published by the Free Software Foundaopti, versptio2 of the /spaion
 11 /a> spai class="comment"> * License. /spaion
 12 /a> spai class="comment"> * /spaion
 13 /a> spai class="comment"> * /spaion
 14 /a> spai class="comment"> * AppArmor allocates a unique sid for every profile loaded.  If a profile /spaion
 15 /a> spai class="comment"> * is replaced it receives the sid of the profile it is replacing. /spaion
 16 /a> spai class="comment"> * /spaion
 17 /a> spai class="comment"> * The sid n val of 0 is inn vid. /spaion
 18 /a> spai class="comment"> */ /spaion
 19 /a>n
 2.11a>#include <linux/spinlock.h11a>>n
 2111a>#include <linux/errno.h11a>>n
 2211a>#include <linux/err.h11a>>n
 23 /a>n
 2411a>#include "include/sid.h11a>"n
 25 /a>n
 26 /a> spai class="comment">/* global counter from which sids are allocated */ /spaion
 27 /a>static
 a href="+code=u32" class="sref">u3211a>
 a href="+code=global_sid" class="sref">global_sid11a>;n
 28 /a>static
 a href="+code=DEFINE_SPINLOCK" class="sref">DEFINE_SPINLOCK /a>( a href="+code=sid_lock" class="sref">sid_lock /a>);n
 29 /a>n
 3.11a> spai class="comment">/* TODO FIXME: add sid to profile mapping, and sid recycling */ /spaion
 31 /a>n
 32 /a> spai class="comment">/** /spaion
 33 /a> spai class="comment"> * aa_alloc_sid - allocate a new sid for a profile /spaion
 34 /a> spai class="comment"> */ /spaion
 35 /a> a href="+code=u32" class="sref">u3211a>
 a href="+code=aa_alloc_sid" class="sref">aa_alloc_sid /a>(void)n
 36 /a>{n
 37 /a>         a href="+code=u32" class="sref">u3211a>
 a href="+code=sid" class="sref">sid11a>;n
 38 /a>n
 39 /a>         spai class="comment">/* /spaion
 4.11a> spai class="comment">         * TODO FIXME: sid recycling - part of profile mapping table /spaion
 41 /a> spai class="comment">         */ /spaion
 42 /a>         a href="+code=spin_lock" class="sref">spin_lock /a>(& a href="+code=sid_lock" class="sref">sid_lock /a>);n
 43 /a>         a href="+code=sid" class="sref">sid11a> = (++ a href="+code=global_sid" class="sref">global_sid11a>);n
 44 /a>         a href="+code=spin_unlock" class="sref">spin_unlock /a>(& a href="+code=sid_lock" class="sref">sid_lock /a>);n
 45 /a>        return  a href="+code=sid" class="sref">sid11a>;n
 46 /a>}n
 47 /a>n
 48 /a> spai class="comment">/** /spaion
 49 /a> spai class="comment"> * aa_free_sid - free a sid11spaion
 5.11a> spai class="comment"> * @sid: sid to free11spaion
 51 /a> spai class="comment"> */ /spaion
 52 /a>void
 a href="+code=aa_free_sid" class="sref">aa_free_sid /a>( a href="+code=u32" class="sref">u3211a>
 a href="+code=sid" class="sref">sid11a>)n
 53 /a>{n
 54 /a>        ;                        spai class="comment">/* NOP ATM */ /spaion
 55 /a>}n
 56 /a> /pre>
The original LXR software by the LXR community /a>, this experimental versptioby /a>.
 /divon div class="subfooter"> kindly hosted by Redpill Linpro AS /a>, provider of Linux consulting and operaoptis services since 1995.
 /bodyon /htmlon