This source file includes following definitions.
- aa_free_task_ctx
- aa_dup_task_ctx
- aa_clear_task_ctx_trans
1
2
3
4
5
6
7
8
9
10 #ifndef __AA_TASK_H
11 #define __AA_TASK_H
12
13 static inline struct aa_task_ctx *task_ctx(struct task_struct *task)
14 {
15 return task->security + apparmor_blob_sizes.lbs_task;
16 }
17
18
19
20
21
22
23
24
25 struct aa_task_ctx {
26 struct aa_label *nnp;
27 struct aa_label *onexec;
28 struct aa_label *previous;
29 u64 token;
30 };
31
32 int aa_replace_current_label(struct aa_label *label);
33 int aa_set_current_onexec(struct aa_label *label, bool stack);
34 int aa_set_current_hat(struct aa_label *label, u64 token);
35 int aa_restore_previous_label(u64 cookie);
36 struct aa_label *aa_get_task_label(struct task_struct *task);
37
38
39
40
41
42 static inline void aa_free_task_ctx(struct aa_task_ctx *ctx)
43 {
44 if (ctx) {
45 aa_put_label(ctx->nnp);
46 aa_put_label(ctx->previous);
47 aa_put_label(ctx->onexec);
48 }
49 }
50
51
52
53
54
55
56 static inline void aa_dup_task_ctx(struct aa_task_ctx *new,
57 const struct aa_task_ctx *old)
58 {
59 *new = *old;
60 aa_get_label(new->nnp);
61 aa_get_label(new->previous);
62 aa_get_label(new->onexec);
63 }
64
65
66
67
68
69 static inline void aa_clear_task_ctx_trans(struct aa_task_ctx *ctx)
70 {
71 AA_BUG(!ctx);
72
73 aa_put_label(ctx->previous);
74 aa_put_label(ctx->onexec);
75 ctx->previous = NULL;
76 ctx->onexec = NULL;
77 ctx->token = 0;
78 }
79
80 #endif