From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lucio De Re To: 9fans@cse.psu.edu Subject: Re: [9fans] Re: Threads: Sewing badges of honor onto a Kernel Message-ID: <20040227100507.D24932@cackle.proxima.alt.za> References: <0374a3982e4b359e09ce2a3be9192f06@yourdomain.dom> <20040227093954.D22848@cackle.proxima.alt.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: ; from Linus Torvalds on Thu, Feb 26, 2004 at 11:57:52PM -0800 Date: Fri, 27 Feb 2004 10:05:08 +0200 Topicbox-Message-UUID: fdd37728-eacc-11e9-9e20-41e7f4b1d025 On Thu, Feb 26, 2004 at 11:57:52PM -0800, Linus Torvalds wrote: > > On Fri, 27 Feb 2004, Lucio De Re wrote: > > > > Is Torvalds really saying that environment[] is held _in_ the stack?! > > No wonder he was reluctant to copy it! Specially when using "bash". > > But I must be mistaken. > > Take a look if you don't believe me. > > There is a _lot_ of state on the stack. That's how C works. > Hm. Yes, C allows it. And your point is valid that an arbitrary data segment may justifiably be copied. But the stack is traditionally the repository of special, let's call it "holy" information and having a thread stomping all over it when another thread gets to find out the hard way is not a thrilling prospect. After all, there is nothing to prevent a coder from altering the return address (traditionally a stack entry) in one thread and totally wrecking the behaviour of another on return, right? I still think the acid test lies with whether one version can model the other. ++L PS: and I really hope that the arguments and environment variables are stored elsewhere and only the pointers appear on the stack :-) I mean, even MS-DOS got that bit "sane", to use a very loaded word previously used by Linus in this discussion.