AppArmor: Abstract use of cred security blob

Don't use the cred->security pointer directly.
Provide a helper function that provides the security blob pointer.

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-09-21 17:17:59 -07:00
committed by Kees Cook
parent 3d25252948
commit 69b5a44a95
4 changed files with 24 additions and 10 deletions
+15 -1
View File
@@ -23,8 +23,22 @@
#include "policy_ns.h"
#include "task.h"
#define cred_label(X) ((X)->security)
static inline struct aa_label *cred_label(const struct cred *cred)
{
struct aa_label **blob = cred->security;
AA_BUG(!blob);
return *blob;
}
static inline void set_cred_label(const struct cred *cred,
struct aa_label *label)
{
struct aa_label **blob = cred->security;
AA_BUG(!blob);
*blob = label;
}
/**
* aa_cred_raw_label - obtain cred's label