Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 5 Aug 2014 17:04:39 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: 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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.