apparmor: fix blob compression when ns is forced on a policy load
When blob compression is turned on, if the policy namespace is forced onto a policy load, the policy load will fail as the namespace name being referenced is inside the compressed policy blob, resulting in invalid or names that are too long. So duplicate the name before the blob is compressed. Fixes: 876dd866c084 ("apparmor: Initial implementation of raw policy blob compression") Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
@@ -944,11 +944,14 @@ static int verify_header(struct aa_ext *e, int required, const char **ns)
|
||||
e, error);
|
||||
return error;
|
||||
}
|
||||
if (*ns && strcmp(*ns, name))
|
||||
if (*ns && strcmp(*ns, name)) {
|
||||
audit_iface(NULL, NULL, NULL, "invalid ns change", e,
|
||||
error);
|
||||
else if (!*ns)
|
||||
*ns = name;
|
||||
} else if (!*ns) {
|
||||
*ns = kstrdup(name, GFP_KERNEL);
|
||||
if (!*ns)
|
||||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user