lkml.org 
[lkml]   [2023]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [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@chromium.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

    \
     
     \ /
      Last update: 2023-03-27 00:06    [W:3.143 / U:0.200 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site