summaryrefslogtreecommitdiff
path: root/security/smack/smack.h
diff options
context:
space:
mode:
authorPaul Moore <paul@paul-moore.com>2021-02-19 15:04:58 -0500
committerPaul Moore <paul@paul-moore.com>2021-03-22 15:24:14 -0400
commit1fb057dcde11b355fc9acde95cee3b2caa5dafb0 (patch)
tree3c821b21ccfe51a95353a5f9c0f11f15c897d29c /security/smack/smack.h
parenteb1231f73c4d7dc26db55e08c070e6526eaf7ee5 (diff)
smack: differentiate between subjective and objective task credentials
With the split of the security_task_getsecid() into subjective and objective variants it's time to update Smack to ensure it is using the correct task creds. Acked-by: Casey Schaufler <casey@schaufler-ca.com> Reviewed-by: Richard Guy Briggs <rgb@redhat.com> Reviewed-by: John Johansen <john.johansen@canonical.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security/smack/smack.h')
-rw-r--r--security/smack/smack.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/security/smack/smack.h b/security/smack/smack.h
index a9768b12716b..08f9cb80655c 100644
--- a/security/smack/smack.h
+++ b/security/smack/smack.h
@@ -383,7 +383,23 @@ static inline struct smack_known *smk_of_task(const struct task_smack *tsp)
return tsp->smk_task;
}
-static inline struct smack_known *smk_of_task_struct(
+static inline struct smack_known *smk_of_task_struct_subj(
+ const struct task_struct *t)
+{
+ struct smack_known *skp;
+ const struct cred *cred;
+
+ rcu_read_lock();
+
+ cred = rcu_dereference(t->cred);
+ skp = smk_of_task(smack_cred(cred));
+
+ rcu_read_unlock();
+
+ return skp;
+}
+
+static inline struct smack_known *smk_of_task_struct_obj(
const struct task_struct *t)
{
struct smack_known *skp;