From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5734 Path: news.gmane.org!not-for-mail From: "Weiming Zhao" Newsgroups: gmane.linux.lib.musl.general Subject: RE: How to setup pre-allocated heap stack space? Date: Tue, 5 Aug 2014 14:07:16 -0700 Message-ID: <00c001cfb0f1$3c88a9f0$b599fdd0$@codeaurora.org> References: <00a001cfb0eb$97409930$c5c1cb90$@codeaurora.org> <20140805204726.GK1674@brightrain.aerifal.cx> <00ba01cfb0f0$21992d00$64cb8700$@codeaurora.org> <20140805210439.GM1674@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1407272861 16054 80.91.229.3 (5 Aug 2014 21:07:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Aug 2014 21:07:41 +0000 (UTC) To: Original-X-From: musl-return-5739-gllmg-musl=m.gmane.org@lists.openwall.com Tue Aug 05 23:07:31 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1XElxC-0005VY-3O for gllmg-musl@plane.gmane.org; Tue, 05 Aug 2014 23:07:30 +0200 Original-Received: (qmail 32295 invoked by uid 550); 5 Aug 2014 21:07:29 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 32287 invoked from network); 5 Aug 2014 21:07:29 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-caf-smtp.dmz.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, TVD_RCVD_SINGLE autolearn=no version=3.3.1 In-Reply-To: <20140805210439.GM1674@brightrain.aerifal.cx> X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQJ85JC3XRPbmtirSP3c4N3mlvv07wF1wLCrAo3fNJkB2Orx+Jo5NKGQ Content-Language: en-us X-Virus-Scanned: ClamAV using ClamSMTP Xref: news.gmane.org gmane.linux.lib.musl.general:5734 Archived-At: Yes, I will check the limit of the heap. Just want to check with you if the basic idea is correct. Thanks a lot! -----Original Message----- From: Rich Felker [mailto:dalias@aerifal.cx] On Behalf Of Rich Felker Sent: Tuesday, August 05, 2014 2:05 PM To: musl@lists.openwall.com Subject: Re: [musl] How to setup pre-allocated heap stack space? On Tue, Aug 05, 2014 at 01:59:21PM -0700, Weiming Zhao wrote: > Hi Rich, > > I'm using it on a bare-metal setup. So the heap space some fixed address. > So I think I should modify __brk() like: > uintptr_t __brk(uintptr_t newbrk) { > return newbrk == 0 ? HEAP_BASE : newbrk ; // assume heap is large > enough } Is that correct? I don't need to worry about free(), right? Well I would at least make sure you don't overflow into other memory, by checking against an upper bound for the heap. But yes, something like the above looks right. Rich