[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230201230943.fg2q6fmvu7gggxar@box.shutemov.name>
Date: Thu, 2 Feb 2023 02:09:43 +0300
From: "Kirill A. Shutemov" <kirill@...temov.name>
To: David Stevens <stevensd@...omium.org>
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/khugepaged: skip shmem with armed userfaultfd
On Wed, Feb 01, 2023 at 12:41:37PM +0900, David Stevens wrote:
> From: David Stevens <stevensd@...omium.org>
>
> Collapsing memory in a vma that has an armed userfaultfd results in
> zero-filling any missing pages, which breaks user-space paging for those
> filled pages. Avoid khugepage bypassing userfaultfd by not collapsing
> pages in shmem reached via scanning a vma with an armed userfaultfd if
> doing so would zero-fill any pages.
Could you elaborate on the failure? Will zero-filling the page prevent
userfaultfd from catching future access?
A test-case would help a lot.
And what prevents the same pages be filled (with zeros or otherwise) via
write(2) bypassing VMA checks? I cannot immediately see it.
BTW, there's already a check that prevent establishing PMD in the place if
VM_UFFD_WP is set.
Maybe just an update of the check in retract_page_tables() from
userfaultfd_wp() to userfaultfd_armed() would be enough?
I have very limited understanding of userfaultfd(). Sorry in advance for
stupid questions.
--
Kiryl Shutsemau / Kirill A. Shutemov
Powered by blists - more mailing lists