From: Yongji Xie <xyjxie@linux.vnet.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kirill.shutemov@linux.intel.com, jmarchan@redhat.com,
mingo@kernel.org, vbabka@suse.cz, dave.hansen@linux.intel.com,
dan.j.williams@intel.com, matthew.r.wilcox@intel.com,
aarcange@redhat.com, mhocko@suse.com, luto@kernel.org,
dahi@linux.vnet.ibm.com
Subject: Re: [PATCH] mm: Fix incorrect pfn passed to untrack_pfn in remap_pfn_range
Date: Sun, 24 Apr 2016 11:44:15 +0800 [thread overview]
Message-ID: <571C410F.6020601@linux.vnet.ibm.com> (raw)
In-Reply-To: <20160422113831.6294e65dbc4fe7a2d3421539@linux-foundation.org>
On 2016/4/23 2:38, Andrew Morton wrote:
> On Fri, 22 Apr 2016 18:31:28 +0800 Yongji Xie <xyjxie@linux.vnet.ibm.com> wrote:
>
>> We used generic hooks in remap_pfn_range to help archs to
>> track pfnmap regions. The code is something like:
>>
>> int remap_pfn_range()
>> {
>> ...
>> track_pfn_remap(vma, &prot, pfn, addr, PAGE_ALIGN(size));
>> ...
>> pfn -= addr >> PAGE_SHIFT;
>> ...
>> untrack_pfn(vma, pfn, PAGE_ALIGN(size));
>> ...
>> }
>>
>> Here we can easily find the pfn is changed but not recovered
>> before untrack_pfn() is called. That's incorrect.
> What are the runtime effects of this bug?
Noi 1/4 ? this is just a fix in theory:-) .
>> --- a/mm/memory.c
>> +++ b/mm/memory.c
>> @@ -1755,6 +1755,7 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr,
>> break;
>> } while (pgd++, addr = next, addr != end);
>>
>> + pfn += (end - PAGE_ALIGN(size)) >> PAGE_SHIFT;
>> if (err)
>> untrack_pfn(vma, pfn, PAGE_ALIGN(size));
> I'm having trouble understanding this. Wouldn't it be better to simply
> save the track_pfn_remap() call's `pfn' arg in a new local variable?
>
Yes, it's a little difficult to understand this. I will send a v2 soon.
Thanks,
Yongji
--
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>
prev parent reply other threads:[~2016-04-24 3:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-22 10:31 [PATCH] mm: Fix incorrect pfn passed to untrack_pfn in remap_pfn_range Yongji Xie
2016-04-22 18:38 ` Andrew Morton
2016-04-24 3:44 ` Yongji Xie [this message]
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=571C410F.6020601@linux.vnet.ibm.com \
--to=xyjxie@linux.vnet.ibm.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dahi@linux.vnet.ibm.com \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=jmarchan@redhat.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=matthew.r.wilcox@intel.com \
--cc=mhocko@suse.com \
--cc=mingo@kernel.org \
--cc=vbabka@suse.cz \
/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).