Re: [PATCH v3] mm: Fix mremap not considering huge pmd devmap

2020-06-05 Thread Ajay Kaher
Thanks Fan, this scenario works to reproduce on v4.9. And following fix works for v4.9: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/commit/?h=linux-4.9.y&id=44cb51d5b4a736446b728bbde8407844d71843ef -Ajay

Re: [PATCH v3] mm: Fix mremap not considering huge pmd devmap

2020-06-04 Thread Fan Yang
Hi Ajay, > On Jun 5, 2020 at 02:23,Ajay Kaher wrote: > > So, v4.9.y should be vulnerable, however not able to reproduce on v4.9.y. > Does any specific scenerio need to test for v4.9.y? > > For v4.9, modified test program as MAP_SHARED_VALIDATE is not available: > - return mmap(NULL, REGION_PM_S

[PATCH v3] mm: Fix mremap not considering huge pmd devmap

2020-06-04 Thread Ajay Kaher
Hi Fan, Able to reproduce this issue on v4.19.y using your test program. And as per commit message it fixes commit 5c7fb56e5e3f ("mm, dax: dax-pmd vs thp-pmd vs hugetlbfs-pm”) at kernel version v4.5. So, v4.9.y should be vulnerable, however not able to reproduce on v4.9.y. Does any specific scen

[PATCH v3] mm: Fix mremap not considering huge pmd devmap

2020-06-04 Thread Fan Yang
The original code in mm/mremap.c checks huge pmd by: if (is_swap_pmd(*old_pmd) || pmd_trans_huge(*old_pmd)) { However, a DAX mapped nvdimm is mapped as huge page (by default) but it is not transparent huge page (_PAGE_PSE | PAGE_DEVMAP). This commit changes the condition to inclu

Subject: [PATCH v3] mm: Fix mremap not considering huge pmd devmap

2020-06-04 Thread Fan Yang
Hi, The original code in mm/mremap.c checks huge pmd by: if (is_swap_pmd(*old_pmd) || pmd_trans_huge(*old_pmd)) { However, a DAX mapped nvdimm is mapped as huge page (by default) but it is not transparent huge page (_PAGE_PSE | PAGE_DEVMAP). This commit changes the condition to