Re: [PATCH v4 09/11] smack: namespace groundwork

From: Lukasz Pawelczyk
Date: Fri Oct 16 2015 - 06:13:54 EST


On piÄ, 2015-10-16 at 11:04 +0800, Hillf Danton wrote:
> > +
> > static inline void smack_userns_free(struct user_namespace *ns)
> > {
> > struct smack_ns *snsp = ns->security;
> > @@ -4680,12 +4689,11 @@ static inline void smack_userns_free(struct
> > user_namespace *ns)
> >
> > mutex_lock(&skp->smk_mapped_lock);
> > list_del_rcu(&sknp->smk_list_known);
> > - if (sknp->smk_allocated)
> > - kfree(sknp->smk_mapped);
> > - kfree(sknp);
> > mutex_unlock(&skp->smk_mapped_lock);
> >
> > list_del(&sknp->smk_list_ns);
>
> Is list_del safe, given the operation
>
> + mutex_lock(&snsp->smk_mapped_lock);
> + list_add_rcu(&sknp->smk_list_ns, &snsp->smk_mapped);
> + mutex_unlock(&snsp->smk_mapped_lock);
>
> in smk_import_mapped() function(copied below)?

Yes, the namespace is destroyed when all its references are gone. This
also includes processes that were in that namespace. Meaning there is
no way to import a new mapping for them anymore at this point.


--
Lukasz Pawelczyk
Samsung R&D Institute Poland
Samsung Electronics




--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/