diff options
author | Eric Paris <eparis@redhat.com> | 2009-11-23 16:47:23 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-11-23 22:30:49 -0500 |
commit | 0bce95279909aa4cc401a2e3140b4295ca22e72a (patch) | |
tree | 5b98e4ebe7ef30fa1edf627c79501c531b346a8b /security/selinux/ss/services.c | |
parent | c4a5af54c8ef277a59189fc9358e190f3c1b8206 (diff) |
SELinux: print denials for buggy kernel with unknown perms
Historically we've seen cases where permissions are requested for classes
where they do not exist. In particular we have seen CIFS forget to set
i_mode to indicate it is a directory so when we later check something like
remove_name we have problems since it wasn't defined in tclass file. This
used to result in a avc which included the permission 0x2000 or something.
Currently the kernel will deny the operations (good thing) but will not
print ANY information (bad thing). First the auditdeny field is no
extended to include unknown permissions. After that is fixed the logic in
avc_dump_query to output this information isn't right since it will remove
the permission from the av and print the phrase "<NULL>". This takes us
back to the behavior before the classmap rewrite.
Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/selinux/ss/services.c')
-rw-r--r-- | security/selinux/ss/services.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index 77f6e54bb43f..d6bb20cbad62 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c | |||
@@ -239,6 +239,13 @@ static void map_decision(u16 tclass, struct av_decision *avd, | |||
239 | if (!allow_unknown && !current_mapping[tclass].perms[i]) | 239 | if (!allow_unknown && !current_mapping[tclass].perms[i]) |
240 | result |= 1<<i; | 240 | result |= 1<<i; |
241 | } | 241 | } |
242 | /* | ||
243 | * In case the kernel has a bug and requests a permission | ||
244 | * between num_perms and the maximum permission number, we | ||
245 | * should audit that denial | ||
246 | */ | ||
247 | for (; i < (sizeof(u32)*8); i++) | ||
248 | result |= 1<<i; | ||
242 | avd->auditdeny = result; | 249 | avd->auditdeny = result; |
243 | } | 250 | } |
244 | } | 251 | } |