diff options
| author | Oleg Nesterov <[email protected]> | 2016-05-20 16:58:36 -0700 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2016-05-20 17:58:30 -0700 |
| commit | d2005e3f41d4f9299e2df6a967c8beb5086967a9 (patch) | |
| tree | 075dc5ba6de68cfe96acdb91478595e7d3366f2e /tools/perf/scripts/python | |
| parent | cd33a76b0f2805fb0d6a05a2d53933f3817ccc9b (diff) | |
userfaultfd: don't pin the user memory in userfaultfd_file_create()
userfaultfd_file_create() increments mm->mm_users; this means that the
memory won't be unmapped/freed if mm owner exits/execs, and UFFDIO_COPY
after that can populate the orphaned mm more.
Change userfaultfd_file_create() and userfaultfd_ctx_put() to use
mm->mm_count to pin mm_struct. This means that
atomic_inc_not_zero(mm->mm_users) is needed when we are going to
actually play with this memory. Except handle_userfault() path doesn't
need this, the caller must already have a reference.
The patch adds the new trivial helper, mmget_not_zero(), it can have
more users.
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Oleg Nesterov <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: Michal Hocko <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions