Skip to content

Commit 3bbb7b2

Browse files
committed
apparmor: fix setting unconfined mode on a loaded profile
When loading a profile that is set to unconfined mode, that label flag is not set when it should be. Ensure it is set so that when used in a label the unconfined check will be applied correctly. Fixes: 0381650 ("apparmor: allow setting any profile into the unconfined state") Signed-off-by: John Johansen <john.johansen@canonical.com>
1 parent f378973 commit 3bbb7b2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

security/apparmor/policy_unpack.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -750,16 +750,18 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name)
750750
profile->label.flags |= FLAG_HAT;
751751
if (!unpack_u32(e, &tmp, NULL))
752752
goto fail;
753-
if (tmp == PACKED_MODE_COMPLAIN || (e->version & FORCE_COMPLAIN_FLAG))
753+
if (tmp == PACKED_MODE_COMPLAIN || (e->version & FORCE_COMPLAIN_FLAG)) {
754754
profile->mode = APPARMOR_COMPLAIN;
755-
else if (tmp == PACKED_MODE_ENFORCE)
755+
} else if (tmp == PACKED_MODE_ENFORCE) {
756756
profile->mode = APPARMOR_ENFORCE;
757-
else if (tmp == PACKED_MODE_KILL)
757+
} else if (tmp == PACKED_MODE_KILL) {
758758
profile->mode = APPARMOR_KILL;
759-
else if (tmp == PACKED_MODE_UNCONFINED)
759+
} else if (tmp == PACKED_MODE_UNCONFINED) {
760760
profile->mode = APPARMOR_UNCONFINED;
761-
else
761+
profile->label.flags |= FLAG_UNCONFINED;
762+
} else {
762763
goto fail;
764+
}
763765
if (!unpack_u32(e, &tmp, NULL))
764766
goto fail;
765767
if (tmp)

0 commit comments

Comments
 (0)