From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Wen Yang <wenyang@linux.alibaba.com>
Cc: Sasha Levin <sashal@kernel.org>,
linux-kernel@vger.kernel.org,
"Eric W. Biederman" <ebiederm@xmission.com>,
Al Viro <viro@zeniv.linux.org.uk>,
stable@vger.kernel.org
Subject: Re: [PATCH] exit: fix a race in release_task when flushing the dentry
Date: Sat, 28 Nov 2020 15:05:24 +0100 [thread overview]
Message-ID: <X8JZJGG67tE4jngE@kroah.com> (raw)
In-Reply-To: <24bd714d-f598-c7c6-6821-38fd9c1f4d2b@linux.alibaba.com>
On Sat, Nov 28, 2020 at 09:59:09PM +0800, Wen Yang wrote:
>
>
> 在 2020/11/28 下午4:06, Greg Kroah-Hartman 写道:
> > On Sat, Nov 28, 2020 at 02:47:22PM +0800, Wen Yang wrote:
> > > [ Upstream commit 7bc3e6e55acf065500a24621f3b313e7e5998acf ]
> >
> > No, that is not this commit at all.
> >
> > What are you wanting to have happen here?
> >
> > confused,
> >
> > greg k-h
> >
>
> Thanks.
> Let's explain it briefly:
>
> The dentries such as /proc/<pid>/ns/ipc have the DCACHE_OP_DELETE flag, they
> should be deleted when the process exits.
> Suppose the following race appears:
>
> release_task dput
> -> proc_flush_task
> -> dentry->d_op->d_delete(dentry)
> -> __exit_signal
> -> dentry->d_lockref.count-- and return.
>
>
> In the proc_flush_task function, because another processe is using this
> dentry, it cannot be deleted;
> In the dput function, d_delete may be executed before __exit_signal (the pid
> has not been unhashed), so that d_delete returns false and the dentry can
> not be deleted.
>
> So this dentry is still caches (count is 0), and its parent dentries are
> also caches, and those dentries can only be deleted when drop_caches is
> manually triggered.
>
>
> In the release_task function, we should move proc_flush_task after the
> tasklist_lock is released(Just like the commit
> 7bc3e6e55acf065500a24621f3b313e7e5998acf did).
I do not understand, is this a patch being submitted for the main kernel
tree, or for a stable kernel release?
If stable, please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.
If main kernel tree, you can't have the "Upstream commit" line in the
changelog text as that makes no sense at all.
thanks,
greg k-h
next prev parent reply other threads:[~2020-11-28 21:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20201128064722.9106-1-wenyang@linux.alibaba.com>
2020-11-28 8:06 ` [PATCH] exit: fix a race in release_task when flushing the dentry Greg Kroah-Hartman
[not found] ` <24bd714d-f598-c7c6-6821-38fd9c1f4d2b@linux.alibaba.com>
2020-11-28 14:05 ` Greg Kroah-Hartman [this message]
[not found] ` <b73daaf0-bd6d-5153-9155-ef3a8568a6f2@linux.alibaba.com>
2020-11-29 6:05 ` Greg Kroah-Hartman
2020-11-29 14:43 ` Wen Yang
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=X8JZJGG67tE4jngE@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=wenyang@linux.alibaba.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