delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/10/17/11:54:12

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RP_MATCHES_RCVD,TW_CG,TW_CP,TW_RG,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
Message-ID: <32668296.post@talk.nabble.com>
Date: Mon, 17 Oct 2011 08:53:44 -0700 (PDT)
From: "jan.kolar" <kolar AT math DOT cas DOT cz>
To: cygwin AT cygwin DOT com
Subject: Re: /proc/*/cmdline corrupted
In-Reply-To: <20111017141848.GD2054@ednor.casa.cgf.cx>
MIME-Version: 1.0
References: <CAG_2cT=rmeJpmZbYDo7RAwjNcTTDSTH1SMhuzzL9qi09ZJwGyA AT mail DOT gmail DOT com> <32663265 DOT post AT talk DOT nabble DOT com> <j7fr4c$mmf$1 AT dough DOT gmane DOT org> <20111017082718 DOT GC30527 AT calimero DOT vinschen DOT de> <20111017141848 DOT GD2054 AT ednor DOT casa DOT cgf DOT cx>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com



Christopher Faylor-8 wrote:
> 
> 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
> 
> 
> 

See the previous post about Linux:
http://cygwin.com/ml/cygwin/2011-10/msg00314.html

And for the hell of possible solution see the link from that post:
http://cvs.rutgers.edu/cgi-bin/viewvc.cgi/tags/start/postman1.11/PsTitle.cc?revision=1806&view=markup

-- 
View this message in context: http://old.nabble.com/-proc-*-cmdline-corrupted-tp32639066p32668296.html
Sent from the Cygwin list mailing list archive at Nabble.com.


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019