1
Index: b/security/apparmor/apparmor.h
2
===================================================================
3
--- a/security/apparmor/apparmor.h
4
+++ b/security/apparmor/apparmor.h
5
@@ -244,6 +244,9 @@ extern struct aa_profile *aa_replace_pro
7
extern struct aa_task_context *lock_task_and_profiles(struct task_struct *task,
8
struct aa_profile *profile);
9
+extern void aa_change_task_context(struct task_struct *task,
10
+ struct aa_task_context *new_cxt,
11
+ struct aa_profile *profile, u64 hat_magic);
14
extern void aa_profilelist_release(void);
15
Index: b/security/apparmor/inline.h
16
===================================================================
17
--- a/security/apparmor/inline.h
18
+++ b/security/apparmor/inline.h
19
@@ -61,34 +61,6 @@ static inline struct aa_profile *aa_find
24
- * aa_change_task_context - switch a tasks to use a new context and profile
25
- * @task: task that is having its aa_task_context changed
26
- * @new_cxt: new aa_task_context to use after the switch
27
- * @profile: new profile to use after the switch
28
- * @hat_magic: hat value to switch to (0 for no hat)
31
-aa_change_task_context(struct task_struct *task,
32
- struct aa_task_context *new_cxt,
33
- struct aa_profile *profile, u64 hat_magic)
35
- struct aa_task_context *old_cxt = aa_task_context(task);
38
- list_del_init(&old_cxt->list);
39
- call_rcu(&old_cxt->rcu, free_aa_task_context_rcu_callback);
42
- new_cxt->caps_logged = CAP_EMPTY_SET;
43
- new_cxt->hat_magic = hat_magic;
44
- new_cxt->task = task;
45
- new_cxt->profile = aa_dup_profile(profile);
46
- list_move(&new_cxt->list, &profile->parent->task_contexts);
48
- rcu_assign_pointer(task->security, new_cxt);
51
static inline struct aa_task_context *aa_alloc_task_context(void)
53
struct aa_task_context *cxt;
54
Index: b/security/apparmor/main.c
55
===================================================================
56
--- a/security/apparmor/main.c
57
+++ b/security/apparmor/main.c
58
@@ -1270,3 +1270,31 @@ repeat:
64
+ * aa_change_task_context - switch a tasks to use a new context and profile
65
+ * @task: task that is having its aa_task_context changed
66
+ * @new_cxt: new aa_task_context to use after the switch
67
+ * @profile: new profile to use after the switch
68
+ * @hat_magic: hat value to switch to (0 for no hat)
70
+void aa_change_task_context(struct task_struct *task,
71
+ struct aa_task_context *new_cxt,
72
+ struct aa_profile *profile, u64 hat_magic)
74
+ struct aa_task_context *old_cxt = aa_task_context(task);
77
+ list_del_init(&old_cxt->list);
78
+ call_rcu(&old_cxt->rcu, free_aa_task_context_rcu_callback);
81
+ new_cxt->caps_logged = CAP_EMPTY_SET;
82
+ new_cxt->hat_magic = hat_magic;
83
+ new_cxt->task = task;
84
+ new_cxt->profile = aa_dup_profile(profile);
85
+ list_move(&new_cxt->list, &profile->parent->task_contexts);
87
+ rcu_assign_pointer(task->security, new_cxt);