linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -mmotm] prctl: add comment about mmap_sem and arg_lock
@ 2018-04-18 18:56 Yang Shi
  0 siblings, 0 replies; only message in thread
From: Yang Shi @ 2018-04-18 18:56 UTC (permalink / raw)
  To: mhocko, gorcunov, akpm; +Cc: yang.shi, linux-mm, linux-kernel

Add comment to elaborate why mmap_sem for is used by prctl.

Signed-off-by: Yang Shi <yang.shi@linux.alibaba.com>
---
akpm: this patch can be foled into:
mm-introduce-arg_lock-to-protect-arg_startend-and-env_startend-in-mm_struct.patch

 kernel/sys.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/sys.c b/kernel/sys.c
index 0cc5a1c..943fdc5 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -2011,6 +2011,10 @@ static int prctl_set_mm_map(int opt, const void __user *addr, unsigned long data
 			return error;
 	}
 
+	/*
+	 * arg_lock protects concurent updates but we still need mmap_sem for
+	 * read to exclude races with sys_brk.
+	 */
 	down_read(&mm->mmap_sem);
 
 	/*
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-18 18:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-18 18:56 [PATCH -mmotm] prctl: add comment about mmap_sem and arg_lock Yang Shi

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).