aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Johansen <john.johansen@canonical.com>2017-08-16 08:48:06 -0400
committerJohn Johansen <john.johansen@canonical.com>2017-09-22 16:00:58 -0400
commit15372b97aa7593c6f5bc1afe69f42fd403c40685 (patch)
tree31992972666da995cce4785f88a7c87f0d6a6b8e
parent290638a52a808d658bd04b746b3ca46886c157e0 (diff)
apparmor: ensure unconfined profiles have dfas initialized
Generally unconfined has early bailout tests and does not need the dfas initialized, however if an early bailout test is ever missed it will result in an oops. Be defensive and initialize the unconfined profile to have null dfas (no permission) so if an early bailout test is missed we fail closed (no perms granted) instead of oopsing. Signed-off-by: John Johansen <john.johansen@canonical.com>
-rw-r--r--security/apparmor/policy_ns.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/security/apparmor/policy_ns.c b/security/apparmor/policy_ns.c
index 351d3bab3a3d..62a3589c62ab 100644
--- a/security/apparmor/policy_ns.c
+++ b/security/apparmor/policy_ns.c
@@ -112,6 +112,8 @@ static struct aa_ns *alloc_ns(const char *prefix, const char *name)
112 ns->unconfined->label.flags |= FLAG_IX_ON_NAME_ERROR | 112 ns->unconfined->label.flags |= FLAG_IX_ON_NAME_ERROR |
113 FLAG_IMMUTIBLE | FLAG_NS_COUNT | FLAG_UNCONFINED; 113 FLAG_IMMUTIBLE | FLAG_NS_COUNT | FLAG_UNCONFINED;
114 ns->unconfined->mode = APPARMOR_UNCONFINED; 114 ns->unconfined->mode = APPARMOR_UNCONFINED;
115 ns->unconfined->file.dfa = aa_get_dfa(nulldfa);
116 ns->unconfined->policy.dfa = aa_get_dfa(nulldfa);
115 117
116 /* ns and ns->unconfined share ns->unconfined refcount */ 118 /* ns and ns->unconfined share ns->unconfined refcount */
117 ns->unconfined->ns = ns; 119 ns->unconfined->ns = ns;