Christoph Hellwig
2019-Aug-24 22:37 UTC
[Nouveau] [PATCH 1/2] mm/hmm: hmm_range_fault() NULL pointer bug
On Fri, Aug 23, 2019 at 03:17:52PM -0700, Ralph Campbell wrote:> Although hmm_range_fault() calls find_vma() to make sure that a vma exists > before calling walk_page_range(), hmm_vma_walk_hole() can still be called > with walk->vma == NULL if the start and end address are not contained > within the vma range.Should we convert to walk_vma_range instead? Or keep walk_page_range but drop searching the vma ourselves? Except for that the patch looks good to me: Reviewed-by: Christoph Hellwig <hch at lst.de>
Ralph Campbell
2019-Aug-26 18:02 UTC
[Nouveau] [PATCH 1/2] mm/hmm: hmm_range_fault() NULL pointer bug
On 8/24/19 3:37 PM, Christoph Hellwig wrote:> On Fri, Aug 23, 2019 at 03:17:52PM -0700, Ralph Campbell wrote: >> Although hmm_range_fault() calls find_vma() to make sure that a vma exists >> before calling walk_page_range(), hmm_vma_walk_hole() can still be called >> with walk->vma == NULL if the start and end address are not contained >> within the vma range. > > Should we convert to walk_vma_range instead? Or keep walk_page_range > but drop searching the vma ourselves? > > Except for that the patch looks good to me: > > Reviewed-by: Christoph Hellwig <hch at lst.de> >I think keeping the call to walk_page_range() makes sense. Jason is hoping to be able to snapshot a range with & without vmas and have the pfns[] filled with empty/valid entries as appropriate. I plan to repost my patch changing hmm_range_fault() to use walk.test_walk which will remove the call to find_vma(). Jason had some concerns about testing it so that's why I have been working on some HMM self tests before resending it.
Jason Gunthorpe
2019-Aug-26 18:09 UTC
[Nouveau] [PATCH 1/2] mm/hmm: hmm_range_fault() NULL pointer bug
On Mon, Aug 26, 2019 at 11:02:12AM -0700, Ralph Campbell wrote:> > On 8/24/19 3:37 PM, Christoph Hellwig wrote: > > On Fri, Aug 23, 2019 at 03:17:52PM -0700, Ralph Campbell wrote: > > > Although hmm_range_fault() calls find_vma() to make sure that a vma exists > > > before calling walk_page_range(), hmm_vma_walk_hole() can still be called > > > with walk->vma == NULL if the start and end address are not contained > > > within the vma range. > > > > Should we convert to walk_vma_range instead? Or keep walk_page_range > > but drop searching the vma ourselves? > > > > Except for that the patch looks good to me: > > > > Reviewed-by: Christoph Hellwig <hch at lst.de> > > > > I think keeping the call to walk_page_range() makes sense. > Jason is hoping to be able to snapshot a range with & without vmas > and have the pfns[] filled with empty/valid entries as appropriate. > > I plan to repost my patch changing hmm_range_fault() to use > walk.test_walk which will remove the call to find_vma(). > Jason had some concerns about testing it so that's why I have > been working on some HMM self tests before resending it.I'm really excited to see tests for hmm_range_fault()! Did you find this bug with the tests?? Jason
Apparently Analagous Threads
- [PATCH 1/2] mm/hmm: hmm_range_fault() NULL pointer bug
- [PATCH 1/2] mm/hmm: hmm_range_fault() NULL pointer bug
- [PATCH v2 5/7] mm/hmm: make full use of walk_page_range()
- [PATCH 1/4] mm/hmm: make full use of walk_page_range()
- [PATCH 1/2] mm/hmm: hmm_range_fault() NULL pointer bug