Re: [PATCH 2/2] mm/util: drop FOLL_FORCE from get_cmdline()

From: David Hildenbrand (Arm)

Date: Sun Nov 29 2026 - 04:44:12 EST


On 11/29/26 06:51, Chris Down wrote:
> 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.

That will now match what we do in get_mm_cmdline(), and I think not using
FOLL_FORCE would be great. Thanks!

Reviewed-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>


I do wonder if there would be a way to have both functions share a common core
helper. Not completely trivial I guess.


--
Cheers,

David