Oleg Nesterov
d2005e3f41
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/20160516172254.GA8595@redhat.com
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Michal Hocko <mhocko@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-05-20 17:58:30 -07:00
..
2016-05-17 15:05:23 -07:00
2016-05-17 15:05:23 -07:00
2016-05-17 16:26:30 -07:00
2016-05-02 19:49:32 -04:00
2016-05-10 14:24:57 -04:00
2016-05-09 11:41:14 -04:00
2016-05-18 10:28:45 -07:00
2016-04-04 10:41:08 -07:00
2016-05-18 10:08:45 -07:00
2016-05-19 09:21:36 -07:00
2016-05-02 19:49:29 -04:00
2016-05-09 11:41:13 -04:00
2016-05-09 11:41:14 -04:00
2016-04-12 20:01:35 -07:00
2016-04-12 15:01:53 -07:00
2016-04-26 15:47:32 -07:00
2016-04-04 10:41:08 -07:00
2016-05-18 11:51:59 -07:00
2016-05-07 07:06:13 +02:00
2016-05-09 11:41:14 -04:00
2016-05-17 17:05:30 -07:00
2016-05-02 19:49:29 -04:00
2016-05-17 15:05:23 -07:00
2016-05-17 15:05:23 -07:00
2016-05-17 15:05:23 -07:00
2016-05-17 15:05:23 -07:00
2016-05-09 11:41:14 -04:00
2016-04-04 10:41:08 -07:00
2016-05-17 15:05:23 -07:00
2016-05-18 10:08:45 -07:00
2016-05-17 15:05:23 -07:00
2016-05-17 15:05:23 -07:00
2016-05-12 19:49:30 -04:00
2016-05-12 19:47:13 -04:00
2016-04-04 10:41:08 -07:00
2016-05-11 00:00:29 -04:00
2016-04-18 11:18:55 +02:00
2016-05-09 11:41:14 -04:00
2016-05-18 10:08:45 -07:00
2016-05-17 11:01:31 -07:00
2016-05-09 11:42:19 -04:00
2016-05-02 19:49:32 -04:00
2016-04-04 10:41:08 -07:00
2016-05-19 09:21:36 -07:00
2016-05-17 15:05:23 -07:00
2016-05-17 15:05:23 -07:00
2016-05-19 19:12:14 -07:00
2016-05-01 19:58:39 -04:00
2016-05-19 19:12:14 -07:00
2016-05-09 11:41:14 -04:00
2016-05-09 11:41:14 -04:00
2016-05-02 19:47:23 -04:00
2016-05-17 02:17:59 -04:00
2016-05-19 20:00:06 -07:00
2016-04-04 10:41:08 -07:00
2016-05-09 11:41:14 -04:00
2016-05-09 11:41:14 -04:00
2016-04-26 12:00:48 -04:00
2016-05-20 17:58:30 -07:00
2016-05-17 15:05:23 -07:00
2016-05-09 11:41:15 -04:00
2016-05-09 11:41:15 -04:00
2016-05-02 19:49:32 -04:00
2016-05-18 10:08:45 -07:00
2016-05-17 15:05:23 -07:00
2016-05-02 19:49:32 -04:00
2016-05-18 10:28:45 -07:00
2016-04-03 19:51:33 -04:00
2016-04-11 00:48:00 -04:00
2016-05-18 11:51:59 -07:00
2016-05-18 11:51:59 -07:00
2016-05-01 19:58:39 -04:00
2016-05-19 19:12:14 -07:00
2016-05-02 19:49:28 -04:00
2016-05-12 16:55:50 -04:00
2016-05-01 19:58:39 -04:00
2016-05-18 11:51:59 -07:00
2016-05-01 19:58:39 -04:00
2016-03-22 15:36:02 -07:00
2016-05-19 19:12:14 -07:00
2016-05-19 09:21:36 -07:00
2016-03-22 15:36:02 -07:00
2016-05-02 19:49:28 -04:00
2016-05-20 17:58:30 -07:00
2016-05-02 19:49:28 -04:00
2016-03-26 12:59:04 -07:00
2016-05-09 11:41:14 -04:00
2016-03-26 12:59:04 -07:00
2016-02-22 22:44:04 -05:00
2016-04-04 10:41:08 -07:00
2016-05-19 09:21:36 -07:00
2016-05-17 14:41:03 -07:00
2016-04-04 10:41:08 -07:00
2016-05-05 09:54:45 -05:00
2016-04-10 20:48:24 -04:00
2016-03-16 13:09:08 -04:00
2016-05-18 11:46:23 -07:00
2016-05-02 19:49:29 -04:00
2016-05-19 19:12:14 -07:00
2016-04-14 12:56:09 -07:00
2016-05-11 00:00:29 -04:00
2016-04-18 11:18:55 +02:00
2016-04-04 10:41:08 -07:00
2016-05-20 17:58:30 -07:00
2016-04-11 00:48:00 -04:00