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

« back to all changes in this revision

Viewing changes to kernel-patches/for-mainline/apparmor-ditch-revalidation.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
 
Get rid of revalidation
2
 
 
3
 
Index: b/security/apparmor/lsm.c
4
 
===================================================================
5
 
--- a/security/apparmor/lsm.c
6
 
+++ b/security/apparmor/lsm.c
7
 
@@ -451,50 +451,6 @@ static int apparmor_inode_removexattr(st
8
 
                                   AA_MAY_WRITE);
9
 
 }
10
 
 
11
 
-static int apparmor_file_permission(struct file *file, int mask)
12
 
-{
13
 
-       struct aa_profile *active;
14
 
-       struct aa_profile *file_profile = (struct aa_profile*)file->f_security;
15
 
-       int error = 0;
16
 
-
17
 
-       /* FIXME: get rid of revalidation. */
18
 
-       if (!file_profile)
19
 
-               goto out;
20
 
-
21
 
-       active = get_active_aa_profile();
22
 
-       if (active && file_profile != active) {
23
 
-               struct dentry *dentry = file->f_dentry;
24
 
-
25
 
-               error = aa_permission(dentry->d_inode, dentry, file->f_vfsmnt,
26
 
-                                     mask & (MAY_READ | MAY_WRITE | MAY_EXEC));
27
 
-       }
28
 
-       put_aa_profile(active);
29
 
-
30
 
-out:
31
 
-       return error;
32
 
-}
33
 
-
34
 
-static int apparmor_file_alloc_security(struct file *file)
35
 
-{
36
 
-       struct aa_profile *active;
37
 
-
38
 
-       active = get_active_aa_profile();
39
 
-       if (active) {
40
 
-               /* FIXME: get rid of revalidation. */
41
 
-               file->f_security = active;
42
 
-       }
43
 
-
44
 
-       return 0;
45
 
-}
46
 
-
47
 
-static void apparmor_file_free_security(struct file *file)
48
 
-{
49
 
-       struct aa_profile *file_profile = (struct aa_profile*)file->f_security;
50
 
-
51
 
-       /* FIXME: get rid of revalidation. */
52
 
-       put_aa_profile(file_profile);
53
 
-}
54
 
-
55
 
 static inline int aa_mmap(struct file *file, unsigned long prot,
56
 
                          unsigned long flags)
57
 
 {
58
 
@@ -717,9 +673,6 @@ struct security_operations apparmor_ops 
59
 
        .inode_getxattr =               apparmor_inode_getxattr,
60
 
        .inode_listxattr =              apparmor_inode_listxattr,
61
 
        .inode_removexattr =            apparmor_inode_removexattr,
62
 
-       .file_permission =              apparmor_file_permission,
63
 
-       .file_alloc_security =          apparmor_file_alloc_security,
64
 
-       .file_free_security =           apparmor_file_free_security,
65
 
        .file_mmap =                    apparmor_file_mmap,
66
 
        .file_mprotect =                apparmor_file_mprotect,
67