public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Pawelczyk <l.pawelczyk@samsung.com>
To: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: "'Andy Lutomirski'" <luto@amacapital.net>,
	"'Kees Cook'" <keescook@chromium.org>,
	"'linux-kernel'" <linux-kernel@vger.kernel.org>,
	linux-security-module@vger.kernel.org
Subject: Re: [PATCH v4 09/11] smack: namespace groundwork
Date: Fri, 16 Oct 2015 12:13:45 +0200	[thread overview]
Message-ID: <1444990425.5661.12.camel@samsung.com> (raw)
In-Reply-To: <026701d107bf$6ef3e280$4cdba780$@alibaba-inc.com>

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





  reply	other threads:[~2015-10-16 10:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <019801d1071b$2c124000$8436c000$@alibaba-inc.com>
2015-10-15  7:38 ` [PATCH v4 09/11] smack: namespace groundwork Hillf Danton
2015-10-15 12:41   ` Lukasz Pawelczyk
2015-10-15 12:53     ` Lukasz Pawelczyk
2015-10-16  3:04       ` Hillf Danton
2015-10-16 10:13         ` Lukasz Pawelczyk [this message]
2015-10-14 12:41 [PATCH v4 00/11] Smack namespace Lukasz Pawelczyk
2015-10-14 12:42 ` [PATCH v4 09/11] smack: namespace groundwork Lukasz Pawelczyk
2015-10-29 22:51   ` Casey Schaufler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1444990425.5661.12.camel@samsung.com \
    --to=l.pawelczyk@samsung.com \
    --cc=hillf.zj@alibaba-inc.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=luto@amacapital.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox