From: Christopher Faylor <cgf-use-the-mailinglist-please@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: /proc/*/cmdline corrupted
Date: Mon, 17 Oct 2011 14:19:00 -0000 [thread overview]
Message-ID: <20111017141848.GD2054@ednor.casa.cgf.cx> (raw)
In-Reply-To: <20111017082718.GC30527@calimero.vinschen.de>
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.
i.e.,
strcpy (__argv[1], "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
>start again.
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.
cgf
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
next prev parent reply other threads:[~2011-10-17 14:19 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-12 15:08 Jon Clugston
2011-10-13 12:56 ` jan.kolar
2011-10-13 13:02 ` Christopher Faylor
2011-10-13 18:02 ` Jon Clugston
2011-10-13 18:14 ` Andrew DeFaria
2011-10-17 16:47 ` jan.kolar
2011-10-17 23:29 ` Jon Clugston
2011-10-16 21:31 ` jan.kolar
2011-10-16 23:59 ` Andrew DeFaria
2011-10-17 7:42 ` jan.kolar
2011-10-17 8:30 ` Corinna Vinschen
2011-10-17 8:28 ` Corinna Vinschen
2011-10-17 14:19 ` Christopher Faylor [this message]
2011-10-17 15:54 ` jan.kolar
2011-10-17 0:17 ` Jon Clugston
2011-10-17 8:34 ` jan.kolar
2011-10-17 10:41 ` jan.kolar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111017141848.GD2054@ednor.casa.cgf.cx \
--to=cgf-use-the-mailinglist-please@cygwin.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).