Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1737564 > unrolled thread

[PATCH] mm/device-public-memory: Fix edge case in _vm_normal_page()

Started byReza Arbab <arbab@linux.vnet.ibm.com>
First post2017-09-22 17:00 +0200
Last post2017-09-23 08:10 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] mm/device-public-memory: Fix edge case in _vm_normal_page() Reza Arbab <arbab@linux.vnet.ibm.com> - 2017-09-22 17:00 +0200
    Re: [PATCH] mm/device-public-memory: Fix edge case in  _vm_normal_page() Jerome Glisse <jglisse@redhat.com> - 2017-09-22 18:30 +0200
    Re: [PATCH] mm/device-public-memory: Fix edge case in _vm_normal_page() Balbir Singh <bsingharora@gmail.com> - 2017-09-23 08:10 +0200

#1737564 — [PATCH] mm/device-public-memory: Fix edge case in _vm_normal_page()

FromReza Arbab <arbab@linux.vnet.ibm.com>
Date2017-09-22 17:00 +0200
Subject[PATCH] mm/device-public-memory: Fix edge case in _vm_normal_page()
Message-ID<usxAR-7iO-1@gated-at.bofh.it>
With device public pages at the end of my memory space, I'm getting
output from _vm_normal_page():

BUG: Bad page map in process migrate_pages  pte:c0800001ffff0d06 pmd:f95d3000
addr:00007fff89330000 vm_flags:00100073 anon_vma:c0000000fa899320 mapping:          (null) index:7fff8933
file:          (null) fault:          (null) mmap:          (null) readpage:          (null)
CPU: 0 PID: 13963 Comm: migrate_pages Tainted: P    B      OE 4.14.0-rc1-wip #155
Call Trace:
[c0000000f965f910] [c00000000094d55c] dump_stack+0xb0/0xf4 (unreliable)
[c0000000f965f950] [c0000000002b269c] print_bad_pte+0x28c/0x340
[c0000000f965fa00] [c0000000002b59c0] _vm_normal_page+0xc0/0x140
[c0000000f965fa20] [c0000000002b6e64] zap_pte_range+0x664/0xc10
[c0000000f965fb00] [c0000000002b7858] unmap_page_range+0x318/0x670
[c0000000f965fbd0] [c0000000002b8074] unmap_vmas+0x74/0xe0
[c0000000f965fc20] [c0000000002c4a18] exit_mmap+0xe8/0x1f0
[c0000000f965fce0] [c0000000000ecbdc] mmput+0xac/0x1f0
[c0000000f965fd10] [c0000000000f62e8] do_exit+0x348/0xcd0
[c0000000f965fdd0] [c0000000000f6d2c] do_group_exit+0x5c/0xf0
[c0000000f965fe10] [c0000000000f6ddc] SyS_exit_group+0x1c/0x20
[c0000000f965fe30] [c00000000000b184] system_call+0x58/0x6c

The pfn causing this is the very last one. Correct the bounds check
accordingly.

Fixes: df6ad69838fc ("mm/device-public-memory: device memory cache coherent with CPU")
Cc: Jérôme Glisse <jglisse@redhat.com>
Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
---
 mm/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memory.c b/mm/memory.c
index ec4e154..a728bed 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -845,7 +845,7 @@ struct page *_vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
 		 * vm_normal_page() so that we do not have to special case all
 		 * call site of vm_normal_page().
 		 */
-		if (likely(pfn < highest_memmap_pfn)) {
+		if (likely(pfn <= highest_memmap_pfn)) {
 			struct page *page = pfn_to_page(pfn);
 
 			if (is_device_public_page(page)) {
-- 
1.8.3.1

[toc] | [next] | [standalone]


#1737611 — Re: [PATCH] mm/device-public-memory: Fix edge case in _vm_normal_page()

FromJerome Glisse <jglisse@redhat.com>
Date2017-09-22 18:30 +0200
SubjectRe: [PATCH] mm/device-public-memory: Fix edge case in _vm_normal_page()
Message-ID<usyZY-8kh-13@gated-at.bofh.it>
In reply to#1737564
On Fri, Sep 22, 2017 at 09:56:18AM -0500, Reza Arbab wrote:
> With device public pages at the end of my memory space, I'm getting
> output from _vm_normal_page():
> 
> BUG: Bad page map in process migrate_pages  pte:c0800001ffff0d06 pmd:f95d3000
> addr:00007fff89330000 vm_flags:00100073 anon_vma:c0000000fa899320 mapping:          (null) index:7fff8933
> file:          (null) fault:          (null) mmap:          (null) readpage:          (null)
> CPU: 0 PID: 13963 Comm: migrate_pages Tainted: P    B      OE 4.14.0-rc1-wip #155
> Call Trace:
> [c0000000f965f910] [c00000000094d55c] dump_stack+0xb0/0xf4 (unreliable)
> [c0000000f965f950] [c0000000002b269c] print_bad_pte+0x28c/0x340
> [c0000000f965fa00] [c0000000002b59c0] _vm_normal_page+0xc0/0x140
> [c0000000f965fa20] [c0000000002b6e64] zap_pte_range+0x664/0xc10
> [c0000000f965fb00] [c0000000002b7858] unmap_page_range+0x318/0x670
> [c0000000f965fbd0] [c0000000002b8074] unmap_vmas+0x74/0xe0
> [c0000000f965fc20] [c0000000002c4a18] exit_mmap+0xe8/0x1f0
> [c0000000f965fce0] [c0000000000ecbdc] mmput+0xac/0x1f0
> [c0000000f965fd10] [c0000000000f62e8] do_exit+0x348/0xcd0
> [c0000000f965fdd0] [c0000000000f6d2c] do_group_exit+0x5c/0xf0
> [c0000000f965fe10] [c0000000000f6ddc] SyS_exit_group+0x1c/0x20
> [c0000000f965fe30] [c00000000000b184] system_call+0x58/0x6c
> 
> The pfn causing this is the very last one. Correct the bounds check
> accordingly.
> 
> Fixes: df6ad69838fc ("mm/device-public-memory: device memory cache coherent with CPU")

Reviewed-by: Jérôme Glisse <jglisse@redhat.com>


> Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
> ---
>  mm/memory.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/memory.c b/mm/memory.c
> index ec4e154..a728bed 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -845,7 +845,7 @@ struct page *_vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
>  		 * vm_normal_page() so that we do not have to special case all
>  		 * call site of vm_normal_page().
>  		 */
> -		if (likely(pfn < highest_memmap_pfn)) {
> +		if (likely(pfn <= highest_memmap_pfn)) {
>  			struct page *page = pfn_to_page(pfn);
>  
>  			if (is_device_public_page(page)) {
> -- 
> 1.8.3.1
> 

[toc] | [prev] | [next] | [standalone]


#1737966

FromBalbir Singh <bsingharora@gmail.com>
Date2017-09-23 08:10 +0200
Message-ID<usLNv-7Vv-9@gated-at.bofh.it>
In reply to#1737564
On Sat, Sep 23, 2017 at 12:56 AM, Reza Arbab <arbab@linux.vnet.ibm.com> wrote:
> With device public pages at the end of my memory space, I'm getting
> output from _vm_normal_page():
>
> BUG: Bad page map in process migrate_pages  pte:c0800001ffff0d06 pmd:f95d3000
> addr:00007fff89330000 vm_flags:00100073 anon_vma:c0000000fa899320 mapping:          (null) index:7fff8933
> file:          (null) fault:          (null) mmap:          (null) readpage:          (null)
> CPU: 0 PID: 13963 Comm: migrate_pages Tainted: P    B      OE 4.14.0-rc1-wip #155
> Call Trace:
> [c0000000f965f910] [c00000000094d55c] dump_stack+0xb0/0xf4 (unreliable)
> [c0000000f965f950] [c0000000002b269c] print_bad_pte+0x28c/0x340
> [c0000000f965fa00] [c0000000002b59c0] _vm_normal_page+0xc0/0x140
> [c0000000f965fa20] [c0000000002b6e64] zap_pte_range+0x664/0xc10
> [c0000000f965fb00] [c0000000002b7858] unmap_page_range+0x318/0x670
> [c0000000f965fbd0] [c0000000002b8074] unmap_vmas+0x74/0xe0
> [c0000000f965fc20] [c0000000002c4a18] exit_mmap+0xe8/0x1f0
> [c0000000f965fce0] [c0000000000ecbdc] mmput+0xac/0x1f0
> [c0000000f965fd10] [c0000000000f62e8] do_exit+0x348/0xcd0
> [c0000000f965fdd0] [c0000000000f6d2c] do_group_exit+0x5c/0xf0
> [c0000000f965fe10] [c0000000000f6ddc] SyS_exit_group+0x1c/0x20
> [c0000000f965fe30] [c00000000000b184] system_call+0x58/0x6c
>
> The pfn causing this is the very last one. Correct the bounds check
> accordingly.
>
> Fixes: df6ad69838fc ("mm/device-public-memory: device memory cache coherent with CPU")
> Cc: Jérôme Glisse <jglisse@redhat.com>
> Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
> ---

Reviewed-by: Balbir Singh <bsingharora@gmail.com>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web