The patch titled Subject: prctl: add comment about mmap_sem and arg_lock has been added to the -mm tree. Its filename is mm-introduce-arg_lock-to-protect-arg_startend-and-env_startend-in-mm_struct-fix.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-introduce-arg_lock-to-protect-arg_startend-and-env_startend-in-mm_struct-fix.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-introduce-arg_lock-to-protect-arg_startend-and-env_startend-in-mm_struct-fix.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Yang Shi <yang.shi@xxxxxxxxxxxxxxxxx> Subject: prctl: add comment about mmap_sem and arg_lock add comment to elaborate why mmap_sem for is used by prctl Link: http://lkml.kernel.org/r/1524077799-80690-1-git-send-email-yang.shi@xxxxxxxxxxxxxxxxx Signed-off-by: Yang Shi <yang.shi@xxxxxxxxxxxxxxxxx> Cc: Cyrill Gorcunov <gorcunov@xxxxxxxxxx> Cc: Alexey Dobriyan <adobriyan@xxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: Mateusz Guzik <mguzik@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/sys.c | 4 ++++ 1 file changed, 4 insertions(+) diff -puN kernel/sys.c~mm-introduce-arg_lock-to-protect-arg_startend-and-env_startend-in-mm_struct-fix kernel/sys.c --- a/kernel/sys.c~mm-introduce-arg_lock-to-protect-arg_startend-and-env_startend-in-mm_struct-fix +++ a/kernel/sys.c @@ -2011,6 +2011,10 @@ static int prctl_set_mm_map(int opt, con 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); /* _ Patches currently in -mm which might be from yang.shi@xxxxxxxxxxxxxxxxx are mm-introduce-arg_lock-to-protect-arg_startend-and-env_startend-in-mm_struct.patch mm-introduce-arg_lock-to-protect-arg_startend-and-env_startend-in-mm_struct-fix.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html