From: Peter Xu <peterx@redhat.com>
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: Axel Rasmussen <axelrasmussen@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Andrea Arcangeli <aarcange@redhat.com>,
Nadav Amit <nadav.amit@gmail.com>
Subject: Re: [PATCH 1/2] mm/uffd: Fix vma check on userfault for wp
Date: Mon, 24 Oct 2022 15:42:59 -0400 [thread overview]
Message-ID: <Y1bqw7M36Gyya3eD@x1n> (raw)
In-Reply-To: <20221024193336.1233616-2-peterx@redhat.com>
On Mon, Oct 24, 2022 at 03:33:35PM -0400, Peter Xu wrote:
> We used to have a report that pte-marker code can be reached even when
> uffd-wp is not compiled in for file memories, here:
>
> https://lore.kernel.org/all/YzeR+R6b4bwBlBHh@x1n/T/#u
>
> I just got time to revisit this and found that the root cause is we simply
> messed up with the vma check, so that for !PTE_MARKER_UFFD_WP system, we
> will allow UFFDIO_REGISTER of MINOR & WP upon shmem as the check was wrong:
>
> if (vm_flags & VM_UFFD_MINOR)
> return is_vm_hugetlb_page(vma) || vma_is_shmem(vma);
>
> Where we'll allow anything to pass on shmem as long as minor mode is
> requested.
>
> Axel did it right when introducing minor mode but I messed it up in
> b1f9e876862d when moving code around. Fix it.
>
> Cc: Axel Rasmussen <axelrasmussen@google.com>
> Fixes: b1f9e876862d ("mm/uffd: enable write protection for shmem & hugetlbfs")
Should also have had:
Cc: stable@vger.kernel.org
> Signed-off-by: Peter Xu <peterx@redhat.com>
--
Peter Xu
next prev parent reply other threads:[~2022-10-24 19:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-24 19:33 [PATCH 0/2] mm/uffd: Fix vma check Peter Xu
2022-10-24 19:33 ` [PATCH 1/2] mm/uffd: Fix vma check on userfault for wp Peter Xu
2022-10-24 19:42 ` Peter Xu [this message]
2022-10-24 19:33 ` [PATCH 2/2] Revert "mm/uffd: fix warning without PTE_MARKER_UFFD_WP compiled in" Peter Xu
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=Y1bqw7M36Gyya3eD@x1n \
--to=peterx@redhat.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nadav.amit@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).