get_cmdline() passes FOLL_FORCE, so it reads a task's arguments even after the task has made them unreadable with mprotect(PROT_NONE). It has done that from the start, because access_process_vm() used to imply force, and commit f307ab6dcea0 ("mm: replace access_process_vm() write parameter with gup_flags") only made that explicit. Right after that, commit 272ddc8b3735 ("proc: don't use FOLL_FORCE for reading cmdline and environment") dropped it again for /proc/pid/cmdline and /proc/pid/environ, but get_cmdline() was missed. None of the callers of get_cmdline() are debuggers, and there is no reason for audit or Yama to see arguments that the task itself can't read. Let's drop FOLL_FORCE, which leaves get_cmdline() with the same flags as /proc/pid/cmdline. Signed-off-by: Chris Down --- mm/util.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mm/util.c b/mm/util.c index c250aa088046..8073af6708fb 100644 --- a/mm/util.c +++ b/mm/util.c @@ -1048,8 +1048,7 @@ int get_cmdline(struct task_struct *task, char *buffer, int buflen) if (len > buflen) len = buflen; - res = access_process_vm(task, arg_start, buffer, len, - FOLL_FORCE | FOLL_ANON); + res = access_process_vm(task, arg_start, buffer, len, FOLL_ANON); /* * If the nul at the end of args has been overwritten, then @@ -1064,8 +1063,7 @@ int get_cmdline(struct task_struct *task, char *buffer, int buflen) if (len > buflen - res) len = buflen - res; res += access_process_vm(task, env_start, - buffer+res, len, - FOLL_FORCE | FOLL_ANON); + buffer + res, len, FOLL_ANON); res = strnlen(buffer, res); } } -- 2.56.1