From: Yang Shi <yang.shi@linux.alibaba.com>
To: mhocko@kernel.org, gorcunov@gmail.com, akpm@linux-foundation.org
Cc: yang.shi@linux.alibaba.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: [PATCH -mmotm] prctl: add comment about mmap_sem and arg_lock
Date: Thu, 19 Apr 2018 02:56:39 +0800 [thread overview]
Message-ID: <1524077799-80690-1-git-send-email-yang.shi@linux.alibaba.com> (raw)
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
reply other threads:[~2018-04-18 18:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1524077799-80690-1-git-send-email-yang.shi@linux.alibaba.com \
--to=yang.shi@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=gorcunov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).