[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZV-S_8XWSL9I9aw4@x1n>
Date: Thu, 23 Nov 2023 12:59:27 -0500
From: Peter Xu <peterx@...hat.com>
To: Christoph Hellwig <hch@...radead.org>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Mike Kravetz <mike.kravetz@...cle.com>,
"Kirill A . Shutemov" <kirill@...temov.name>,
Lorenzo Stoakes <lstoakes@...il.com>,
Axel Rasmussen <axelrasmussen@...gle.com>,
Matthew Wilcox <willy@...radead.org>,
John Hubbard <jhubbard@...dia.com>,
Mike Rapoport <rppt@...nel.org>,
Hugh Dickins <hughd@...gle.com>,
David Hildenbrand <david@...hat.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Rik van Riel <riel@...riel.com>,
James Houghton <jthoughton@...gle.com>,
Yang Shi <shy828301@...il.com>,
Jason Gunthorpe <jgg@...dia.com>,
Vlastimil Babka <vbabka@...e.cz>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH RFC 05/12] mm/gup: Fix follow_devmap_p[mu]d() to return
even if NULL
On Wed, Nov 22, 2023 at 11:25:28PM -0800, Christoph Hellwig wrote:
> On Wed, Nov 15, 2023 at 08:29:01PM -0500, Peter Xu wrote:
> > This seems to be a bug not by any report but by code observations.
> >
> > When GUP sees a devpmd or devpud, it should return whatever value returned
> > from follow_devmap_p[mu]d(). If page==NULL returned, it means a fault is
> > probably required. Skipping return the NULL should allow the code to fall
> > through, which can cause unexpected behavior.
> >
> > It was there at least before the follow page rework (080dbb618b) in 2017,
> > so 6 years. Not yet digging for a Fixes, assuming it can hardly trigger
> > even if the logical bug does exist.
> >
> > Signed-off-by: Peter Xu <peterx@...hat.com>
>
> I'd still add a fixes tag and send if off to Linux for 6.7-rc instead
> of letting it linger.
Will do.
>
> Otherwise looks good:
>
> Reviewed-by: Christoph Hellwig <hch@....de>
When rethinking, "return page" is correct for devmap, but it should be
better to always use no_page_table() instead for page==NULL when trying to
return NULL for follow_page(), even if no_page_table() should constantly
return NULL for devmap, afaict, so it should be the same.
So I'll make it slightly different when reposting separately, please feel
free to have another look.
Thanks,
--
Peter Xu
Powered by blists - more mailing lists