/proc/$pid/cmdline returns wrong value when argv[] array set to short string.
Issue
- The proc/$pid/cmdline of a process shows many
xstrings in the output. - This is reproducible when an application uses setproctitle() function.
# cat /proc/54326/cmdline
oft_eb v : QMD_SQAL #10 [idle]xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- This is reported at upstream as well.
$ for i in $(seq 1 10); do
perl -e '$0 = "1234567890"x'"$i"'; print `cat /proc/$$/cmdline`;' | wc -c;
done
3291
3291
3291
3291
3291
3291
71
81
91
101
$
Environment
- Red Hat Enterprise Linux 8
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.