[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190824223907.GB21891@lst.de>
Date: Sun, 25 Aug 2019 00:39:07 +0200
From: Christoph Hellwig <hch@....de>
To: Ralph Campbell <rcampbell@...dia.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
nouveau@...ts.freedesktop.org,
Jérôme Glisse <jglisse@...hat.com>,
Jason Gunthorpe <jgg@...lanox.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Christoph Hellwig <hch@....de>
Subject: Re: [PATCH 2/2] mm/hmm: hmm_range_fault() infinite loop
On Fri, Aug 23, 2019 at 03:17:53PM -0700, Ralph Campbell wrote:
> Normally, callers to handle_mm_fault() are supposed to check the
> vma->vm_flags first. hmm_range_fault() checks for VM_READ but doesn't
> check for VM_WRITE if the caller requests a page to be faulted in
> with write permission (via the hmm_range.pfns[] value).
> If the vma is write protected, this can result in an infinite loop:
> hmm_range_fault()
> walk_page_range()
> ...
> hmm_vma_walk_hole()
> hmm_vma_walk_hole_()
> hmm_vma_do_fault()
> handle_mm_fault(FAULT_FLAG_WRITE)
> /* returns VM_FAULT_WRITE */
> /* returns -EBUSY */
> /* returns -EBUSY */
> /* returns -EBUSY */
> /* loops on -EBUSY and range->valid */
> Prevent this by checking for vma->vm_flags & VM_WRITE before calling
> handle_mm_fault().
>
> Signed-off-by: Ralph Campbell <rcampbell@...dia.com>
Looks good,
Reviewed-by: Christoph Hellwig <hch@....de>
Powered by blists - more mailing lists