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>
这个提交包含在:
Casey Schaufler
2018-09-21 17:17:59 -07:00
提交者 Kees Cook
父节点 3d25252948
当前提交 69b5a44a95
修改 4 个文件,包含 24 行新增10 行删除

查看文件

@@ -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