diff options
author | John Johansen <john.johansen@canonical.com> | 2017-01-16 00:42:55 -0800 |
---|---|---|
committer | John Johansen <john.johansen@canonical.com> | 2017-01-16 01:18:42 -0800 |
commit | 5ac8c355ae0013d82b3a07b49aebeadfce9b6e52 (patch) | |
tree | 41f24f5f9198ef4ba7a34624938e51b2305e21f0 /security/apparmor/include/policy_unpack.h | |
parent | fc1c9fd10a53a17abb3348adb2ec5d29813a0397 (diff) | |
download | op-kernel-dev-5ac8c355ae0013d82b3a07b49aebeadfce9b6e52.zip op-kernel-dev-5ac8c355ae0013d82b3a07b49aebeadfce9b6e52.tar.gz |
apparmor: allow introspecting the loaded policy pre internal transform
Store loaded policy and allow introspecting it through apparmorfs. This
has several uses from debugging, policy validation, and policy checkpoint
and restore for containers.
Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security/apparmor/include/policy_unpack.h')
-rw-r--r-- | security/apparmor/include/policy_unpack.h | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/security/apparmor/include/policy_unpack.h b/security/apparmor/include/policy_unpack.h index c214fb8..7b675b6 100644 --- a/security/apparmor/include/policy_unpack.h +++ b/security/apparmor/include/policy_unpack.h @@ -16,6 +16,7 @@ #define __POLICY_INTERFACE_H #include <linux/list.h> +#include <linux/kref.h> struct aa_load_ent { struct list_head list; @@ -34,6 +35,30 @@ struct aa_load_ent *aa_load_ent_alloc(void); #define PACKED_MODE_KILL 2 #define PACKED_MODE_UNCONFINED 3 -int aa_unpack(void *udata, size_t size, struct list_head *lh, const char **ns); +/* struct aa_loaddata - buffer of policy load data set */ +struct aa_loaddata { + struct kref count; + size_t size; + int abi; + unsigned char *hash; + char data[]; +}; + +int aa_unpack(struct aa_loaddata *udata, struct list_head *lh, const char **ns); + +static inline struct aa_loaddata * +aa_get_loaddata(struct aa_loaddata *data) +{ + if (data) + kref_get(&(data->count)); + return data; +} + +void aa_loaddata_kref(struct kref *kref); +static inline void aa_put_loaddata(struct aa_loaddata *data) +{ + if (data) + kref_put(&data->count, aa_loaddata_kref); +} #endif /* __POLICY_INTERFACE_H */ |