Thread (15 messages) 15 messages, 5 authors, 2021-08-04

Re: [PATCH] Add mmap_assert_locked() annotations to find_vma*()

From: Andrew Morton <akpm@linux-foundation.org>
Date: 2021-08-01 19:33:40
Also in: lkml

On Sat, 31 Jul 2021 10:53:41 -0700 Luigi Rizzo [off-list ref] wrote:
find_vma() and variants need protection when used.
This patch adds mmap_assert_lock() calls in the functions.

To make sure the invariant is satisfied, we also need to add a
mmap_read_loc() around the get_user_pages_remote() call in
get_arg_page(). The lock is not strictly necessary because the mm
has been newly created, but the extra cost is limited because
the same mutex was also acquired shortly before in __bprm_mm_init(),
so it is hot and uncontended.
Well, it isn't cost-free.  find_vma() is called a lot and a surprising
number of systems apparently run with CONFIG_DEBUG_VM.  Why do you
think this cost is justified?

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help