lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Mon,  6 Jun 2016 10:45:25 -0700
From:	Mike Kravetz <mike.kravetz@...cle.com>
To:	linux-mm@...ck.org, linux-kernel@...r.kernel.org
Cc:	Andrea Arcangeli <aarcange@...hat.com>,
	Hugh Dickins <hughd@...gle.com>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
	Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
	Hillf Danton <hillf.zj@...baba-inc.com>,
	Michal Hocko <mhocko@...e.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Mike Kravetz <mike.kravetz@...cle.com>
Subject: [RFC PATCH 0/6] hugetlb support for userfaultfd

With fallcoate hole punch now supported by hugetlbfs, users of this
functionality would like to catch subsequent faults to holes.  The
use case is based on a database model where:
- Many tasks map the same huegtlbfs file to provide a large shared area
- One management task determines that part of this area is no longer used
  and releases the associated pages by fallocate hole punch
- It is an error if any of the tasks fault on the hole
userfaultfd can be used to catch faults to the holes, and the application
can take appropriate action.

This patch set replicates the functionality of the existing userfaultfd
routines __mcopy_atomic and mcopy_atomic_pte with modifications for huge
pages.  The register/unregister routines are modified to accept hugetlb
vma's and a hook is added to huge page fault handling.  The existing
selftest is modified to work with huge pages so that the new code can be
exercised and tested.

To test the code with selftest, this patch is required:
https://lkml.org/lkml/2016/5/31/782

Some issues to consider in the RFC
- Is hugetlb.c the best place for hugetlb_mcopy_atomic_pte?
- Is there a better way to handle mmap_sem locking on entry/exit
  to __mcopy_atomic_hugetlb?
- Is there a better way to do huge page alignment/sanity checking
  in the register/unregister routines?  Unfortunately, we do not
  know we are dealing with huge pages until looking at the vma's.
- userfaultfd for hugepmd does not support UFFDIO_ZEROPAGE as there
  is no zero page support for huge pages (except THP case).
- Should there be another config option?  Support is now provided
  if both userfaultfd and hugetlb are configured.
- This has only been tested on x86, but the code should be arch
  independent.

Mike Kravetz (6):
  mm/memory: add copy_huge_page_from_user for hugetlb userfaultfd
    support
  mm/hugetlb: add hugetlb_mcopy_atomic_pte for userfaultfd support
  mm/userfaultfd: add __mcopy_atomic_hugetlb for huge page UFFDIO_COPY
  mm/hugetlb: add userfaultfd hugetlb hook
  fs/userfaultfd: allow registration of ranges containing huge pages
  selftests/userfaultfd: add userfaultfd_hugetlb test

 fs/userfaultfd.c                         |  69 +++++++++++-
 include/linux/hugetlb.h                  |   8 +-
 include/linux/mm.h                       |   3 +
 include/uapi/linux/userfaultfd.h         |   3 +
 mm/hugetlb.c                             | 102 ++++++++++++++++++
 mm/memory.c                              |  22 ++++
 mm/userfaultfd.c                         | 179 +++++++++++++++++++++++++++++++
 tools/testing/selftests/vm/Makefile      |   3 +
 tools/testing/selftests/vm/run_vmtests   |  13 +++
 tools/testing/selftests/vm/userfaultfd.c | 161 ++++++++++++++++++++++++---
 10 files changed, 540 insertions(+), 23 deletions(-)

-- 
2.4.11

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ