[apparmor] [PATCH 18/32] apparmor: provide base for multiple profiles to be replaced at once

Seth Arnold seth.arnold at canonical.com
Sat Jan 26 08:40:28 UTC 2013

On Fri, Jan 25, 2013 at 11:50:20PM -0800, John Johansen wrote:
> >> +	if (unpack_str(e, &name, "namespace")) {
> >> +		if (*ns && strcmp(*ns, name)) {
> >> +			audit_iface(NULL, NULL, "invalide ns change", e, error);
> >> +		} else if (!*ns)
> >> +			*ns = name;

> the ns from the pack stream is only set if the policy being loaded
> specifies one. We only get into the conditional block setting it if
> +	if (unpack_str(e, &name, "namespace")) {
> succeeds.
> If its not specified then it should be, but isn't, set to null *sigh*

Okay, so the first branch (*ns && strcmp(*ns, name)) is aimed primarily
at a future use where the kernel loading code _expects_ a namespace in
the packed stream (LXC?) and the "else if (!*ns)" is the code path that
you _wanted_ to be default when the packed stream sets a namespace, but
because the = NULL is missing in aa_replace_profiles(), is accidentally

Is that about right?

Where else might eventually call aa_unpack _without_ wanting to know the
namespace set in a stream? Could the if(!*ns) go away and just write
into *ns regardless? It feels like it'll always be needed.

Thanks John

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20130126/6192ca8a/attachment.pgp>

More information about the AppArmor mailing list