863d225455
BugLink: http://bugs.launchpad.net/bugs/2028253 Add fine grained mediation of posix mqueues. Specifically this patch adds support for differentiating mqueues based on the name in the ipc namespace. A follow on patch will add support for implied labels, and a third patch explicit labels. This is done in part because of dependencies on other patches to apparmor core. Signed-off-by: John Johansen <john.johansen@canonical.com> (cherry picked from https://gitlab.com/jjohansen/apparmor-kernel) Signed-off-by: Andrea Righi <andrea.righi@canonical.com> (cherry picked from commit 5de4e990b8c3297eebc2470c0dda6acb6c741a71 https://git.launchpad.net/~apparmor-dev/ubuntu-kernel-next) Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
43 lines
933 B
C
43 lines
933 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* AppArmor security module
|
|
*
|
|
* This file contains AppArmor file mediation function definitions.
|
|
*
|
|
* Copyright 2022 Canonical Ltd.
|
|
*/
|
|
|
|
#ifndef __AA_INODE_H
|
|
#define __AA_INODE_H
|
|
|
|
#include <linux/spinlock.h>
|
|
|
|
#include "lib.h"
|
|
|
|
struct aa_inode_sec {
|
|
struct inode *inode; /* back pointer to inode object */
|
|
struct aa_label *label;
|
|
u16 sclass; /* security class of this object */
|
|
bool initialized; /* initialization flag */
|
|
spinlock_t lock;
|
|
};
|
|
|
|
struct aa_superblock_sec {
|
|
struct aa_label *label;
|
|
};
|
|
|
|
static inline struct aa_inode_sec *apparmor_inode(const struct inode *inode)
|
|
{
|
|
if (unlikely(!inode->i_security))
|
|
return NULL;
|
|
return inode->i_security + apparmor_blob_sizes.lbs_inode;
|
|
}
|
|
|
|
static inline struct aa_superblock_sec *apparmor_superblock(
|
|
const struct super_block *sb)
|
|
{
|
|
return sb->s_security + apparmor_blob_sizes.lbs_superblock;
|
|
}
|
|
|
|
#endif /* __AA_INODE_H */
|