hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/security/apparmor/include/cred.h
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * AppArmor security module
34 *
....@@ -5,11 +6,6 @@
56 *
67 * Copyright (C) 1998-2008 Novell/SUSE
78 * Copyright 2009-2010 Canonical Ltd.
8
- *
9
- * This program is free software; you can redistribute it and/or
10
- * modify it under the terms of the GNU General Public License as
11
- * published by the Free Software Foundation, version 2 of the
12
- * License.
139 */
1410
1511 #ifndef __AA_CONTEXT_H
....@@ -23,8 +19,22 @@
2319 #include "policy_ns.h"
2420 #include "task.h"
2521
26
-#define cred_label(X) ((X)->security)
22
+static inline struct aa_label *cred_label(const struct cred *cred)
23
+{
24
+ struct aa_label **blob = cred->security + apparmor_blob_sizes.lbs_cred;
2725
26
+ AA_BUG(!blob);
27
+ return *blob;
28
+}
29
+
30
+static inline void set_cred_label(const struct cred *cred,
31
+ struct aa_label *label)
32
+{
33
+ struct aa_label **blob = cred->security + apparmor_blob_sizes.lbs_cred;
34
+
35
+ AA_BUG(!blob);
36
+ *blob = label;
37
+}
2838
2939 /**
3040 * aa_cred_raw_label - obtain cred's label