[PATCH 0/2] mm/util: use FOLL_ANON in get_cmdline() like /proc/pid/cmdline

From: Chris Down

Date: Sun Nov 29 2026 - 00:51:41 EST


get_cmdline() reads a task's arguments for audit's proctitle record,
Yama's ptrace reports, loadpin and the msm and etnaviv GPU hang
messages. Unlike /proc/pid/cmdline, which has only read anonymous
memory since 7f7ccc2ccc2e ("proc: do not access cmdline nor environ
from file-backed areas"), it still reads whatever the task has mapped
at arg_start. That includes a file on a FUSE filesystem whose server
can take as long as it likes to answer, and some of those readers are
other tasks, or msm's hang recovery with gpu->lock held.

Patch 1 passes FOLL_ANON, so get_cmdline() reads the same memory as
/proc. This is the one for stable.

Patch 2 drops FOLL_FORCE, which get_cmdline() only has because it was
missed when 272ddc8b3735 ("proc: don't use FOLL_FORCE for reading
cmdline and environment") dropped it from /proc.

For device mappings, patch 1 relies on "mm: do not call vm_ops->access
with FOLL_ANON" from David's vm_ops->access series [1], but it doesn't
need it to apply or build.

[1] https://lore.kernel.org/r/20261122-access_shite-v2-1-808d8d2aa700@xxxxxxxxxx

Chris Down (2):
mm/util: don't let get_cmdline() stall on file-backed arguments
mm/util: drop FOLL_FORCE from get_cmdline()

mm/util.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)


base-commit: c6f53520f32302ea64cbcfd7cc25a31081e34548
--
2.56.1