~ubuntu-branches/ubuntu/wily/apparmor/wily

« back to all changes in this revision

Viewing changes to kernel-patches/for-mainline/no-inline-aa_change_task_context.diff

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2011-04-27 10:38:07 UTC
  • mfrom: (5.1.118 natty)
  • Revision ID: james.westby@ubuntu.com-20110427103807-ym3rhwys6o84ith0
Tags: 2.6.1-2
debian/copyright: clarify for some full organization names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
6
 
                                             u32 hat_magic);
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);
12
 
 
13
 
 /* list.c */
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
20
 
        return profile;
21
 
 }
22
 
 
23
 
-/**
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)
29
 
- */
30
 
-static inline void
31
 
-aa_change_task_context(struct task_struct *task,
32
 
-                      struct aa_task_context *new_cxt,
33
 
-                      struct aa_profile *profile, u64 hat_magic)
34
 
-{
35
 
-       struct aa_task_context *old_cxt = aa_task_context(task);
36
 
-
37
 
-       if (old_cxt) {
38
 
-               list_del_init(&old_cxt->list);
39
 
-               call_rcu(&old_cxt->rcu, free_aa_task_context_rcu_callback);
40
 
-       }
41
 
-       if (new_cxt) {
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);
47
 
-       }
48
 
-       rcu_assign_pointer(task->security, new_cxt);
49
 
-}
50
 
-
51
 
 static inline struct aa_task_context *aa_alloc_task_context(void)
52
 
 {
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:
59
 
        rcu_read_unlock();
60
 
        return cxt;
61
 
 }
62
 
+
63
 
+/**
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)
69
 
+ */
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)
73
 
+{
74
 
+       struct aa_task_context *old_cxt = aa_task_context(task);
75
 
+
76
 
+       if (old_cxt) {
77
 
+               list_del_init(&old_cxt->list);
78
 
+               call_rcu(&old_cxt->rcu, free_aa_task_context_rcu_callback);
79
 
+       }
80
 
+       if (new_cxt) {
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);
86
 
+       }
87
 
+       rcu_assign_pointer(task->security, new_cxt);
88
 
+}
89
 
+