This is the mail archive of the
mailing list for the Cygwin project.
Re: /proc/*/cmdline corrupted
On Mon, Oct 17, 2011 at 10:27:18AM +0200, Corinna Vinschen wrote:
>On Linux, /proc/$PID/cmdline always contains the full command line as
>it has been when the process got started, irrespectively of changes
>after process startup. It looks like the loader creates a copy of the
>argv array before calling main.
You can change the contents of what __argv[n] points to to modify what
/proc/<pid>/cmdline displays though.
strcpy (__argv, "a");
That's pretty risky though.
>Cygwin doesn't generate a copy of the argv array at startup, so the
>processes __argv is the one used to call the main function. And I'm
>reluctant to do that since it costs just more time for a process to
Just creating a copy of argv without copying what it points to should be
pretty inexpensive. It's too bad that we export __argv and __argc. I
don't see Linux doing anything like that and it seems like a way for
a Cygwin program to cause mischief.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple