linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Kees Cook <keescook@chromium.org>
Cc: James Morris <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] securityfs: Add missing d_delete() call on removal
Date: Wed, 6 May 2020 05:02:52 +0100	[thread overview]
Message-ID: <20200506040252.GC23230@ZenIV.linux.org.uk> (raw)
In-Reply-To: <202005052024.2D7626C742@keescook>

On Tue, May 05, 2020 at 08:28:33PM -0700, Kees Cook wrote:
> On Wed, May 06, 2020 at 02:14:31AM +0100, Al Viro wrote:
> > On Tue, May 05, 2020 at 04:40:35PM -0700, Kees Cook wrote:
> > > After using simple_unlink(), a call to d_delete() is needed in addition
> > > to dput().
> > > 
> > > Signed-off-by: Kees Cook <keescook@chromium.org>
> > > ---
> > > Is this correct? I went looking around and there are a lot of variations
> > > on the simple_unlink() pattern...
> > > 
> > > Many using explicit locking and combinations of d_drop(), __d_drop(), etc.
> > 
> > Quite a few of those should switch to simple_recursive_removal().  As for
> > securityfs...  d_drop() is _probably_ a saner variant, but looking at the
> > callers of that thing... at least IMA ones seem to be garbage.
> 
> Hmm, I dunno. I hadn't looked at these yet. I'm not sure what's needed
> for those cases.
> 
> Is my patch to add d_delete() correct, though? I'm trying to construct
> the right set of calls for pstore's filesystem, and I noticed that most
> will do simple_unlink(), d_delete(), dput(), but securityfs seemed to be
> missing it.

d_drop().  d_delete() is for the situations when you want the sucker
to become a hashed negative, if at all possible.

Re pstore: context, please.

  reply	other threads:[~2020-05-06  4:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-05 23:40 [PATCH] securityfs: Add missing d_delete() call on removal Kees Cook
2020-05-06  1:14 ` Al Viro
2020-05-06  3:28   ` Kees Cook
2020-05-06  4:02     ` Al Viro [this message]
2020-05-06 15:34       ` Kees Cook
2020-05-06 18:49         ` Al Viro
2020-05-06 22:49           ` Kees Cook

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=20200506040252.GC23230@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=jmorris@namei.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=serge@hallyn.com \
    /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;
as well as URLs for NNTP newsgroup(s).