// SPDX-License-Identifier: GPL-2.0-only /* * AppArmor security module * * This file contains AppArmor security identifier (secid) manipulation fns * * Copyright 2009-2017 Canonical Ltd. * * AppArmor allocates a unique secid for every label used. If a label * is replaced it receives the secid of the label it is replacing.
*/
/* * TODO: allow policy to reserve a secid range? * TODO: add secid pinning * TODO: use secid_update in label replace
*/
/* * see label for inverse aa_label_to_secid
*/ struct aa_label *aa_secid_to_label(u32 secid)
{ return xa_load(&aa_secids, secid);
}
staticint apparmor_label_to_secctx(struct aa_label *label, struct lsm_context *cp)
{ /* TODO: cache secctx and ref count so we don't have to recreate */ int flags = FLAG_VIEW_SUBNS | FLAG_HIDDEN_UNCONFINED | FLAG_ABS_ROOT; int len;
if (!label) return -EINVAL;
if (apparmor_display_secid_mode)
flags |= FLAG_SHOW_MODE;
if (cp)
len = aa_label_asxprint(&cp->context, root_ns, label,
flags, GFP_ATOMIC); else
len = aa_label_snxprint(NULL, 0, root_ns, label, flags);
if (len < 0) return -ENOMEM;
if (cp) {
cp->len = len;
cp->id = LSM_ID_APPARMOR;
}
/** * aa_alloc_secid - allocate a new secid for a profile * @label: the label to allocate a secid for * @gfp: memory allocation flags * * Returns: 0 with @label->secid initialized * <0 returns error with @label->secid set to AA_SECID_INVALID
*/ int aa_alloc_secid(struct aa_label *label, gfp_t gfp)
{ unsignedlong flags; int ret;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.