[LLVMdev] Accounting for stack space

Sandro Magi naasking at gmail.com
Tue Jul 10 13:51:26 PDT 2007


On 7/10/07, Gordon Henriksen <gordonhenriksen at mac.com> wrote:
>
> One of the existing malloc replacements should provide hints for how to go
> about that. www.hoard.org for one. The details on Windows are especially
> complicated.
>
> Be aware that even doing this won't reliably intercept all allocations. With
> Mac OS X, Mach's vm_allocate call is accessible. With Unix, mmap with flags
> = MAP_ANON allocates memory. And even still, the implementations of these
> aren't magic; it's possible to make the syscalls without linking to these
> symbols per se. There are likely further facilities to distrust on any given
> platform, as well. If you're intending to sandbox untrusted third-party
> code, then you need to consider these issues.

Ouch. Sandboxing untrusted code would certainly be an interesting
application, but I'm not that ambitious. My intended usage is a custom
VM with a custom bytecode JIT'd using LLVM.

I was going to track activation frames by CPS-transforming my input
program, so the LLVM stack should run in constant space. Please let me
know if there's some type of allocation LLVM might perform that
doesn't fall under these two categories.

Sandro



More information about the llvm-dev mailing list