X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_NONE,TW_CP,TW_RG,UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org X-Yahoo-SMTP: jenXL62swBAWhMTL3wnej93oaS0ClBQOAKs8jbEbx_o- Date: Mon, 17 Oct 2011 10:18:48 -0400 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: /proc/*/cmdline corrupted Message-ID: <20111017141848.GD2054@ednor.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <32663265 DOT post AT talk DOT nabble DOT com> <20111017082718 DOT GC30527 AT calimero DOT vinschen DOT de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111017082718.GC30527@calimero.vinschen.de> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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//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