From: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
To: Robin Holt <holt@sgi.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Marcelo Tosatti <mtosatti@redhat.com>,
Gleb Natapov <gleb@redhat.com>, Avi Kivity <avi.kivity@gmail.com>,
Andrea Arcangeli <aarcange@redhat.com>,
LKML <linux-kernel@vger.kernel.org>, KVM <kvm@vger.kernel.org>,
Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [PATCH] mm: mmu_notifier: re-fix freed page still mapped in secondary MMU
Date: Tue, 16 Apr 2013 18:26:36 +0800 [thread overview]
Message-ID: <516D275C.8040406@linux.vnet.ibm.com> (raw)
In-Reply-To: <20130416093131.GJ3658@sgi.com>
On 04/16/2013 05:31 PM, Robin Holt wrote:
> On Tue, Apr 16, 2013 at 02:39:49PM +0800, Xiao Guangrong wrote:
>> The commit 751efd8610d3 (mmu_notifier_unregister NULL Pointer deref
>> and multiple ->release()) breaks the fix:
>> 3ad3d901bbcfb15a5e4690e55350db0899095a68
>> (mm: mmu_notifier: fix freed page still mapped in secondary MMU)
>
> Can you describe how the page is still mapped? I thought I had all
> cases covered. Whichever call hits first, I thought we had one callout
> to the registered notifiers. Are you saying we need multiple callouts?
No.
You patch did this:
hlist_del_init_rcu(&mn->hlist); 1 <======
+ spin_unlock(&mm->mmu_notifier_mm->lock);
+
+ /*
+ * Clear sptes. (see 'release' description in mmu_notifier.h)
+ */
+ if (mn->ops->release)
+ mn->ops->release(mn, mm); 2 <======
+
+ spin_lock(&mm->mmu_notifier_mm->lock);
At point 1, you delete the notify, but the page is still on LRU. Other
cpu can reclaim the page but without call ->invalid_page().
At point 2, you call ->release(), the secondary MMU make page Accessed/Dirty
but that page has already been on the free-list of page-alloctor.
>
> Also, shouldn't you be asking for a revert commit and then supply a
> subsequent commit for the real fix? I thought that was the process for
> doing a revert.
Can not do that pure reversion since your patch moved hlist_for_each_entry_rcu
which has been modified now.
Should i do pure-eversion + hlist_for_each_entry_rcu update first?
WARNING: multiple messages have this Message-ID (diff)
From: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
To: Robin Holt <holt@sgi.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Marcelo Tosatti <mtosatti@redhat.com>,
Gleb Natapov <gleb@redhat.com>, Avi Kivity <avi.kivity@gmail.com>,
Andrea Arcangeli <aarcange@redhat.com>,
LKML <linux-kernel@vger.kernel.org>, KVM <kvm@vger.kernel.org>,
Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [PATCH] mm: mmu_notifier: re-fix freed page still mapped in secondary MMU
Date: Tue, 16 Apr 2013 18:26:36 +0800 [thread overview]
Message-ID: <516D275C.8040406@linux.vnet.ibm.com> (raw)
In-Reply-To: <20130416093131.GJ3658@sgi.com>
On 04/16/2013 05:31 PM, Robin Holt wrote:
> On Tue, Apr 16, 2013 at 02:39:49PM +0800, Xiao Guangrong wrote:
>> The commit 751efd8610d3 (mmu_notifier_unregister NULL Pointer deref
>> and multiple ->release()) breaks the fix:
>> 3ad3d901bbcfb15a5e4690e55350db0899095a68
>> (mm: mmu_notifier: fix freed page still mapped in secondary MMU)
>
> Can you describe how the page is still mapped? I thought I had all
> cases covered. Whichever call hits first, I thought we had one callout
> to the registered notifiers. Are you saying we need multiple callouts?
No.
You patch did this:
hlist_del_init_rcu(&mn->hlist); 1 <======
+ spin_unlock(&mm->mmu_notifier_mm->lock);
+
+ /*
+ * Clear sptes. (see 'release' description in mmu_notifier.h)
+ */
+ if (mn->ops->release)
+ mn->ops->release(mn, mm); 2 <======
+
+ spin_lock(&mm->mmu_notifier_mm->lock);
At point 1, you delete the notify, but the page is still on LRU. Other
cpu can reclaim the page but without call ->invalid_page().
At point 2, you call ->release(), the secondary MMU make page Accessed/Dirty
but that page has already been on the free-list of page-alloctor.
>
> Also, shouldn't you be asking for a revert commit and then supply a
> subsequent commit for the real fix? I thought that was the process for
> doing a revert.
Can not do that pure reversion since your patch moved hlist_for_each_entry_rcu
which has been modified now.
Should i do pure-eversion + hlist_for_each_entry_rcu update first?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2013-04-16 10:26 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-16 6:39 [PATCH] mm: mmu_notifier: re-fix freed page still mapped in secondary MMU Xiao Guangrong
2013-04-16 6:39 ` Xiao Guangrong
2013-04-16 9:31 ` Robin Holt
2013-04-16 9:31 ` Robin Holt
2013-04-16 10:26 ` Xiao Guangrong [this message]
2013-04-16 10:26 ` Xiao Guangrong
2013-04-16 11:25 ` Robin Holt
2013-04-16 11:25 ` Robin Holt
2013-04-16 11:43 ` Robin Holt
2013-04-16 11:43 ` Robin Holt
2013-04-16 13:07 ` Xiao Guangrong
2013-04-16 13:07 ` Xiao Guangrong
2013-04-16 18:08 ` Robin Holt
2013-04-16 18:08 ` Robin Holt
2013-04-17 2:55 ` Xiao Guangrong
2013-04-17 2:55 ` Xiao Guangrong
2013-04-17 14:10 ` Robin Holt
2013-04-17 14:10 ` Robin Holt
2013-04-17 18:41 ` Xiao Guangrong
2013-04-17 18:41 ` Xiao Guangrong
2013-04-17 18:45 ` Robin Holt
2013-04-17 18:45 ` Robin Holt
2013-04-17 18:52 ` Xiao Guangrong
2013-04-17 18:52 ` Xiao Guangrong
2013-05-01 9:03 ` Robin Holt
2013-05-01 9:03 ` Robin Holt
2013-04-17 23:38 ` Simon Jeons
2013-04-17 23:38 ` Simon Jeons
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=516D275C.8040406@linux.vnet.ibm.com \
--to=xiaoguangrong@linux.vnet.ibm.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=avi.kivity@gmail.com \
--cc=gleb@redhat.com \
--cc=holt@sgi.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mtosatti@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.