diff options
author | Kees Cook <kees@ubuntu.com> | 2012-01-26 19:29:22 -0500 |
---|---|---|
committer | John Johansen <john.johansen@canonical.com> | 2012-02-27 14:38:18 -0500 |
commit | a9bf8e9fd561ba9ff1f0f2a1d96e439fcedaaaa4 (patch) | |
tree | fb477507408c30384d6725a3418eef92b09148e9 /security/apparmor | |
parent | e74abcf3359d0130e99a6511ac484a3ea9e6e988 (diff) |
AppArmor: add "file" details to securityfs
Create the "file" directory in the securityfs for tracking features
related to files.
Signed-off-by: Kees Cook <kees@ubuntu.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security/apparmor')
-rw-r--r-- | security/apparmor/apparmorfs.c | 10 | ||||
-rw-r--r-- | security/apparmor/include/apparmorfs.h | 6 |
2 files changed, 16 insertions, 0 deletions
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c index f30dada0dca2..f9d0b5087bea 100644 --- a/security/apparmor/apparmorfs.c +++ b/security/apparmor/apparmorfs.c | |||
@@ -154,6 +154,9 @@ static int aa_fs_seq_show(struct seq_file *seq, void *v) | |||
154 | case AA_FS_TYPE_BOOLEAN: | 154 | case AA_FS_TYPE_BOOLEAN: |
155 | seq_printf(seq, "%s\n", fs_file->v.boolean ? "yes" : "no"); | 155 | seq_printf(seq, "%s\n", fs_file->v.boolean ? "yes" : "no"); |
156 | break; | 156 | break; |
157 | case AA_FS_TYPE_STRING: | ||
158 | seq_printf(seq, "%s\n", fs_file->v.string); | ||
159 | break; | ||
157 | case AA_FS_TYPE_U64: | 160 | case AA_FS_TYPE_U64: |
158 | seq_printf(seq, "%#08lx\n", fs_file->v.u64); | 161 | seq_printf(seq, "%#08lx\n", fs_file->v.u64); |
159 | break; | 162 | break; |
@@ -180,6 +183,12 @@ const struct file_operations aa_fs_seq_file_ops = { | |||
180 | 183 | ||
181 | /** Base file system setup **/ | 184 | /** Base file system setup **/ |
182 | 185 | ||
186 | static struct aa_fs_entry aa_fs_entry_file[] = { | ||
187 | AA_FS_FILE_STRING("mask", "create read write exec append mmap_exec " \ | ||
188 | "link lock"), | ||
189 | { } | ||
190 | }; | ||
191 | |||
183 | static struct aa_fs_entry aa_fs_entry_domain[] = { | 192 | static struct aa_fs_entry aa_fs_entry_domain[] = { |
184 | AA_FS_FILE_BOOLEAN("change_hat", 1), | 193 | AA_FS_FILE_BOOLEAN("change_hat", 1), |
185 | AA_FS_FILE_BOOLEAN("change_hatv", 1), | 194 | AA_FS_FILE_BOOLEAN("change_hatv", 1), |
@@ -190,6 +199,7 @@ static struct aa_fs_entry aa_fs_entry_domain[] = { | |||
190 | 199 | ||
191 | static struct aa_fs_entry aa_fs_entry_features[] = { | 200 | static struct aa_fs_entry aa_fs_entry_features[] = { |
192 | AA_FS_DIR("domain", aa_fs_entry_domain), | 201 | AA_FS_DIR("domain", aa_fs_entry_domain), |
202 | AA_FS_DIR("file", aa_fs_entry_file), | ||
193 | AA_FS_FILE_U64("capability", VFS_CAP_FLAGS_MASK), | 203 | AA_FS_FILE_U64("capability", VFS_CAP_FLAGS_MASK), |
194 | { } | 204 | { } |
195 | }; | 205 | }; |
diff --git a/security/apparmor/include/apparmorfs.h b/security/apparmor/include/apparmorfs.h index 16e654530f30..7ea4769fab3f 100644 --- a/security/apparmor/include/apparmorfs.h +++ b/security/apparmor/include/apparmorfs.h | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | enum aa_fs_type { | 18 | enum aa_fs_type { |
19 | AA_FS_TYPE_BOOLEAN, | 19 | AA_FS_TYPE_BOOLEAN, |
20 | AA_FS_TYPE_STRING, | ||
20 | AA_FS_TYPE_U64, | 21 | AA_FS_TYPE_U64, |
21 | AA_FS_TYPE_FOPS, | 22 | AA_FS_TYPE_FOPS, |
22 | AA_FS_TYPE_DIR, | 23 | AA_FS_TYPE_DIR, |
@@ -31,6 +32,7 @@ struct aa_fs_entry { | |||
31 | enum aa_fs_type v_type; | 32 | enum aa_fs_type v_type; |
32 | union { | 33 | union { |
33 | bool boolean; | 34 | bool boolean; |
35 | char *string; | ||
34 | unsigned long u64; | 36 | unsigned long u64; |
35 | struct aa_fs_entry *files; | 37 | struct aa_fs_entry *files; |
36 | } v; | 38 | } v; |
@@ -43,6 +45,10 @@ extern const struct file_operations aa_fs_seq_file_ops; | |||
43 | { .name = (_name), .mode = 0444, \ | 45 | { .name = (_name), .mode = 0444, \ |
44 | .v_type = AA_FS_TYPE_BOOLEAN, .v.boolean = (_value), \ | 46 | .v_type = AA_FS_TYPE_BOOLEAN, .v.boolean = (_value), \ |
45 | .file_ops = &aa_fs_seq_file_ops } | 47 | .file_ops = &aa_fs_seq_file_ops } |
48 | #define AA_FS_FILE_STRING(_name, _value) \ | ||
49 | { .name = (_name), .mode = 0444, \ | ||
50 | .v_type = AA_FS_TYPE_STRING, .v.string = (_value), \ | ||
51 | .file_ops = &aa_fs_seq_file_ops } | ||
46 | #define AA_FS_FILE_U64(_name, _value) \ | 52 | #define AA_FS_FILE_U64(_name, _value) \ |
47 | { .name = (_name), .mode = 0444, \ | 53 | { .name = (_name), .mode = 0444, \ |
48 | .v_type = AA_FS_TYPE_U64, .v.u64 = (_value), \ | 54 | .v_type = AA_FS_TYPE_U64, .v.u64 = (_value), \ |