LSM: Infrastructure management of the file security

Move management of the file->f_security blob out of the
individual security modules and into the infrastructure.
The modules no longer allocate or free the data, instead
they tell the infrastructure how much space they require.

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
[kees: adjusted for ordered init series]
Signed-off-by: Kees Cook <keescook@chromium.org>
This commit is contained in:
Casey Schaufler
2018-11-12 12:02:49 -08:00
committed by Kees Cook
parent f28952ac90
commit 33bf60cabc
8 changed files with 72 additions and 51 deletions
+4 -1
View File
@@ -32,7 +32,10 @@ struct path;
AA_MAY_CHMOD | AA_MAY_CHOWN | AA_MAY_LOCK | \
AA_EXEC_MMAP | AA_MAY_LINK)
#define file_ctx(X) ((struct aa_file_ctx *)(X)->f_security)
static inline struct aa_file_ctx *file_ctx(struct file *file)
{
return file->f_security + apparmor_blob_sizes.lbs_file;
}
/* struct aa_file_ctx - the AppArmor context the file was opened in
* @lock: lock to update the ctx