[quake3-bugzilla] [Bug 4282] Fix potential overlap of VM stack and bss sections

bugzilla-daemon at icculus.org bugzilla-daemon at icculus.org
Thu Sep 17 19:46:58 EDT 2009


http://bugzilla.icculus.org/show_bug.cgi?id=4282

Ryan C. Gordon <icculus at icculus.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |icculus at icculus.org

--- Comment #3 from Tim Angus <tim at ngus.net> 2009-09-17 18:27:01 EDT ---
<Amanieu> Timbo: um doesn't q3asm already reserve STACK_SIZE in the bss
section?
 <Amanieu> I'm pretty sure it does

Comments?

--- Comment #4 from Ryan C. Gordon <icculus at icculus.org> 2009-09-17 19:46:52 EDT ---
This is in q3asm.c ...

    // reserve the stack in bss
    DefineSymbol( "_stackStart", segment[BSSSEG].imageUsed );
    segment[BSSSEG].imageUsed += stackSize;
    DefineSymbol( "_stackEnd", segment[BSSSEG].imageUsed );

...stackSize is 0x10000.

So, yeah, we allocate space for the stack at the end of the BSS in the
assembler.

Note that the QVM interpreter defines STACK_SIZE to be 0x20000, though, so it's
possible we _could_ overflow it, I guess.

Patrick's patch probably fixes that possibility (although _stackEnd is probably
wrong at runtime), at a cost of some kilobytes of memory, but it's not clear to
me if it's safe to either lower STACK_SIZE in the virtual machine or raise
stackSize in the assembler to otherwise account for the difference, so I don't
really know which approach is best.

--ryan.

-- 
Configure bugmail: http://bugzilla.icculus.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the quake3-bugzilla mailing list