From: Jason Gunthorpe <jgg@ziepe.ca>
To: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: linux-kernel@vger.kernel.org,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
linux-mm@kvack.org
Subject: Re: [PATCH] mm/gup: dereference page table entry using helper
Date: Tue, 14 Apr 2020 13:32:34 -0300 [thread overview]
Message-ID: <20200414163234.GG5100@ziepe.ca> (raw)
In-Reply-To: <1586877001-19138-1-git-send-email-agordeev@linux.ibm.com>
On Tue, Apr 14, 2020 at 05:10:01PM +0200, Alexander Gordeev wrote:
> Commit 0005d20 ("mm/gup: Move page table entry dereference
> into helper function") wrapped access to page table entries
> larger than sizeof(long) into a race-aware accessor. One of
> the two dereferences in gup_fast path was however overlooked.
>
> CC: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> CC: linux-mm@kvack.org
> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
> mm/gup.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/gup.c b/mm/gup.c
> index d53f7dd..eceb98b 100644
> +++ b/mm/gup.c
> @@ -2208,7 +2208,7 @@ static int gup_pte_range(pmd_t pmd, unsigned long addr, unsigned long end,
> if (!head)
> goto pte_unmap;
>
> - if (unlikely(pte_val(pte) != pte_val(*ptep))) {
> + if (unlikely(pte_val(pte) != pte_val(gup_get_pte(ptep)))) {
It doesn't seem like this needs the special helper as it is just
checking that the pte hasn't changed, it doesn't need to be read
exactly.
But it probably should technically still be a READ_ONCE. Although I
think the atomic inside try_grab_compound_head prevents any real
problems.
Jason
next prev parent reply other threads:[~2020-04-14 16:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-14 15:10 Alexander Gordeev
2020-04-14 16:32 ` Jason Gunthorpe [this message]
2020-04-14 18:58 ` Ira Weiny
2020-04-14 19:06 ` Jason Gunthorpe
2020-04-14 19:39 ` Ira Weiny
2020-04-14 19:45 ` Jason Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200414163234.GG5100@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=agordeev@linux.ibm.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox