提交 0a41ebb1 编写于 作者: J John Johansen 提交者: Zheng Zengkai

apparmor: fix setting unconfined mode on a loaded profile

stable inclusion
from stable-v5.10.138
commit 1ac89741a2e7ce6d446df33ad610a1e41f6c3241
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I60QFD

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=1ac89741a2e7ce6d446df33ad610a1e41f6c3241

--------------------------------

commit 3bbb7b2e upstream.

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: 03816507 ("apparmor: allow setting any profile into the unconfined state")
Signed-off-by: NJohn Johansen <john.johansen@canonical.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 67dc6616
......@@ -746,16 +746,18 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name)
profile->label.flags |= FLAG_HAT;
if (!unpack_u32(e, &tmp, NULL))
goto fail;
if (tmp == PACKED_MODE_COMPLAIN || (e->version & FORCE_COMPLAIN_FLAG))
if (tmp == PACKED_MODE_COMPLAIN || (e->version & FORCE_COMPLAIN_FLAG)) {
profile->mode = APPARMOR_COMPLAIN;
else if (tmp == PACKED_MODE_ENFORCE)
} else if (tmp == PACKED_MODE_ENFORCE) {
profile->mode = APPARMOR_ENFORCE;
else if (tmp == PACKED_MODE_KILL)
} else if (tmp == PACKED_MODE_KILL) {
profile->mode = APPARMOR_KILL;
else if (tmp == PACKED_MODE_UNCONFINED)
} else if (tmp == PACKED_MODE_UNCONFINED) {
profile->mode = APPARMOR_UNCONFINED;
else
profile->label.flags |= FLAG_UNCONFINED;
} else {
goto fail;
}
if (!unpack_u32(e, &tmp, NULL))
goto fail;
if (tmp)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册