secid.c (30aa69e7bd9f7af3574120249eecb3726dcaf737) | secid.c (617a629c08bfffb05249131079d9a38322902e5b) |
---|---|
1/* 2 * AppArmor security module 3 * 4 * This file contains AppArmor security identifier (secid) manipulation fns 5 * 6 * Copyright 2009-2017 Canonical Ltd. 7 * 8 * This program is free software; you can redistribute it and/or --- 18 unchanged lines hidden (view full) --- 27#include "include/secid.h" 28#include "include/label.h" 29#include "include/policy_ns.h" 30 31/* 32 * secids - do not pin labels with a refcount. They rely on the label 33 * properly updating/freeing them 34 */ | 1/* 2 * AppArmor security module 3 * 4 * This file contains AppArmor security identifier (secid) manipulation fns 5 * 6 * Copyright 2009-2017 Canonical Ltd. 7 * 8 * This program is free software; you can redistribute it and/or --- 18 unchanged lines hidden (view full) --- 27#include "include/secid.h" 28#include "include/label.h" 29#include "include/policy_ns.h" 30 31/* 32 * secids - do not pin labels with a refcount. They rely on the label 33 * properly updating/freeing them 34 */ |
35#define AA_FIRST_SECID 2 |
|
35 | 36 |
36#define AA_FIRST_SECID 1 37 | |
38static DEFINE_IDR(aa_secids); 39static DEFINE_SPINLOCK(secid_lock); 40 41/* 42 * TODO: allow policy to reserve a secid range? 43 * TODO: add secid pinning 44 * TODO: use secid_update in label replace 45 */ --- 28 unchanged lines hidden (view full) --- 74} 75 76int apparmor_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) 77{ 78 /* TODO: cache secctx and ref count so we don't have to recreate */ 79 struct aa_label *label = aa_secid_to_label(secid); 80 int len; 81 | 37static DEFINE_IDR(aa_secids); 38static DEFINE_SPINLOCK(secid_lock); 39 40/* 41 * TODO: allow policy to reserve a secid range? 42 * TODO: add secid pinning 43 * TODO: use secid_update in label replace 44 */ --- 28 unchanged lines hidden (view full) --- 73} 74 75int apparmor_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) 76{ 77 /* TODO: cache secctx and ref count so we don't have to recreate */ 78 struct aa_label *label = aa_secid_to_label(secid); 79 int len; 80 |
81 AA_BUG(!secdata); |
|
82 AA_BUG(!seclen); 83 84 if (!label) 85 return -EINVAL; 86 87 if (secdata) 88 len = aa_label_asxprint(secdata, root_ns, label, 89 FLAG_SHOW_MODE | FLAG_VIEW_SUBNS | --- 78 unchanged lines hidden --- | 82 AA_BUG(!seclen); 83 84 if (!label) 85 return -EINVAL; 86 87 if (secdata) 88 len = aa_label_asxprint(secdata, root_ns, label, 89 FLAG_SHOW_MODE | FLAG_VIEW_SUBNS | --- 78 unchanged lines hidden --- |