Skip to contentSkip to conversation

proc.5: clarify cmdline mutability

PATCH Michael Kerrisk (man-pages) 1 participant 1 message Apr 10, 2020 1 message not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Hi Mike,

Quoted 8 lines · Mike Frysinger

From: Mike Frysinger <[email protected]>

The cmdline file is a window into memory that is controlled by the target process, and that memory may be changed arbitrarily, as can the window via prctl settings. Make sure people understand that this file is all an illusion.

Thanks. Patch applied.

Cheers,

Michael

Quoted 28 lines
---
 man5/proc.5 | 12 ++++++++++++
 1 file changed, 12 insertions(+)
man5/proc.5 +12 -0
index c07ebf06bfa8..93b8c7d26bf3 100644
@@ -435,6 +435,18 @@ that is, a read on this file will return 0 characters.
 The command-line arguments appear in this file as a set of
 strings separated by null bytes (\(aq\\0\(aq),
 with a further null byte after the last string.
+.IP
+If, after an
+.BR execve (2),
+the process modifies its argv strings, those changes will show up here.
+This is not the same thing as modifying the argv array.
+.IP
+Furthermore, a process may change the memory location that this file refers via
+.BR prctl (2)
+operations such as
+.BR PR_SET_MM_ARG_START .
+.IP
+Think of this file as the command line that the process wants you to see.
 .TP
 .IR /proc/[pid]/comm " (since Linux 2.6.33)"
 .\" commit 4614a696bd1c3a9af3a08f0e5874830a85b889d4
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/