hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/security/apparmor/include/task.h
....@@ -1,20 +1,19 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * AppArmor security module
34 *
45 * This file contains AppArmor task related definitions and mediation
56 *
67 * Copyright 2017 Canonical Ltd.
7
- *
8
- * This program is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU General Public License as
10
- * published by the Free Software Foundation, version 2 of the
11
- * License.
128 */
139
1410 #ifndef __AA_TASK_H
1511 #define __AA_TASK_H
1612
17
-#define task_ctx(X) ((X)->security)
13
+static inline struct aa_task_ctx *task_ctx(struct task_struct *task)
14
+{
15
+ return task->security + apparmor_blob_sizes.lbs_task;
16
+}
1817
1918 /*
2019 * struct aa_task_ctx - information for current task label change
....@@ -37,17 +36,6 @@
3736 struct aa_label *aa_get_task_label(struct task_struct *task);
3837
3938 /**
40
- * aa_alloc_task_ctx - allocate a new task_ctx
41
- * @flags: gfp flags for allocation
42
- *
43
- * Returns: allocated buffer or NULL on failure
44
- */
45
-static inline struct aa_task_ctx *aa_alloc_task_ctx(gfp_t flags)
46
-{
47
- return kzalloc(sizeof(struct aa_task_ctx), flags);
48
-}
49
-
50
-/**
5139 * aa_free_task_ctx - free a task_ctx
5240 * @ctx: task_ctx to free (MAYBE NULL)
5341 */
....@@ -57,8 +45,6 @@
5745 aa_put_label(ctx->nnp);
5846 aa_put_label(ctx->previous);
5947 aa_put_label(ctx->onexec);
60
-
61
- kzfree(ctx);
6248 }
6349 }
6450