Skip to content

Commit 15372b9

Browse files
committed
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>
1 parent 290638a commit 15372b9

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎security/apparmor/policy_ns.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ static struct aa_ns *alloc_ns(const char *prefix, const char *name)
112112
ns->unconfined->label.flags |= FLAG_IX_ON_NAME_ERROR |
113113
FLAG_IMMUTIBLE | FLAG_NS_COUNT | FLAG_UNCONFINED;
114114
ns->unconfined->mode = APPARMOR_UNCONFINED;
115+
ns->unconfined->file.dfa = aa_get_dfa(nulldfa);
116+
ns->unconfined->policy.dfa = aa_get_dfa(nulldfa);
115117

116118
/* ns and ns->unconfined share ns->unconfined refcount */
117119
ns->unconfined->ns = ns;

0 commit comments

Comments
 (0)