linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] userfaultfd v4.11 updates
@ 2017-03-02 17:37 Andrea Arcangeli
  2017-03-02 17:37 ` [PATCH 1/3] userfaultfd: non-cooperative: fix fork fctx->new memleak Andrea Arcangeli
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Andrea Arcangeli @ 2017-03-02 17:37 UTC (permalink / raw)
  To: linux-mm, Andrew Morton
  Cc: Mike Rapoport, Dr. David Alan Gilbert, Mike Kravetz,
	Pavel Emelyanov, Hillf Danton

Hello,

this is incremental against current -mm.

The earlier patchset fixed the fctx->orig memleak but as I thought
during review, there was a further leak in fctx->new and Mike promptly
fixed it too. I've been running a reproducer and there's no further
memleak when the uffd is closed by the parent while fork() blocks
waiting for the event to be received.

In addition I found a potential stale pointer in MADV_DONTNEED if
userfaultfd_remove has to block and releases the mmap_sem in the
process. This patch revalidates the vma and fixes the
race. Unfortunately calling userfaultfd_remove last is not ok as
explained in the commit.

A "make" run from the directory selftests/vm/ independently started to
fail in v4.11 trying to write executables to the root directory.
That's not very friendly because it worked before, but it's easy to
fix and the last patch corrects this behavior in the vm/Makefile.

Andrea Arcangeli (2):
  userfaultfd: non-cooperative: userfaultfd_remove revalidate vma in
    MADV_DONTNEED
  userfaultfd: selftest: vm: allow to build in vm/ directory

Mike Rapoport (1):
  userfaultfd: non-cooperative: fix fork fctx->new memleak

 fs/userfaultfd.c                    | 18 ++++++++++-----
 include/linux/userfaultfd_k.h       |  7 +++---
 mm/madvise.c                        | 44 ++++++++++++++++++++++++++++++++++---
 tools/testing/selftests/vm/Makefile |  4 ++++
 4 files changed, 60 insertions(+), 13 deletions(-)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-09-28 10:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-02 17:37 [PATCH 0/3] userfaultfd v4.11 updates Andrea Arcangeli
2017-03-02 17:37 ` [PATCH 1/3] userfaultfd: non-cooperative: fix fork fctx->new memleak Andrea Arcangeli
2017-03-03 11:09   ` Mike Rapoport
2017-09-28  9:26   ` Sasha Levin
2017-09-28 10:16     ` Andrea Arcangeli
2017-03-02 17:37 ` [PATCH 2/3] userfaultfd: non-cooperative: userfaultfd_remove revalidate vma in MADV_DONTNEED Andrea Arcangeli
2017-03-03 19:48   ` Mike Rapoport
2017-03-02 17:37 ` [PATCH 3/3] userfaultfd: selftest: vm: allow to build in vm/ directory Andrea Arcangeli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).