/proc/$pid/cmdline returns wrong value when argv[] array set to short string.

Solution Verified - Updated -

Issue

  • The proc/$pid/cmdline of a process shows many x strings in the output.
  • This is reproducible when an application uses setproctitle() function.
# cat /proc/54326/cmdline
oft_eb v : QMD_SQAL #10 [idle]xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

$ 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.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content