prctl: add comment about mmap_sem and arg_lock
PATCH 1/1 prctl: add comment about mmap_sem and arg_lock
Add comment to elaborate why mmap_sem for is used by prctl.
Signed-off-by Yang Shi <[email protected]>
---
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(+)
kernel/sys.c +4 -0
@@ -2011,6 +2011,10 @@ static int prctl_set_mm_map(int opt, const void __user *addr, unsigned long datareturn 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);/*
Signature · 1 line
1.8.3.1