Re: [Python-Dev] Defending against stack overflow (was Sandboxing Python)

2012-03-04 Thread Maciej Fijalkowski
On Sun, Mar 4, 2012 at 12:35 PM, "Martin v. Löwis" wrote: >> So, how to handle stack overflows (of the C stack)? >> To prevent a stack overflow an exception must be raised before >> the VM runs out C stack. To do this we need 2 pieces of info: >> a) How much stack we've used >> b) How much stack i

Re: [Python-Dev] Defending against stack overflow (was Sandboxing Python)

2012-03-04 Thread Martin v. Löwis
> So, how to handle stack overflows (of the C stack)? > To prevent a stack overflow an exception must be raised before > the VM runs out C stack. To do this we need 2 pieces of info: > a) How much stack we've used > b) How much stack is available. Python has already dedicated counters for stack de

[Python-Dev] Defending against stack overflow (was Sandboxing Python)

2012-03-04 Thread Mark Shannon
Having a look at the "crashers" in Lib/test/crashers it seems to me that they fall into four groups. 1. Unsafe gc functions like getreferrers() 2. Stack overflows. 3. "Normal" bugs that can be fixed on a case-by-case basis (like borrowed_ref_1.py and borrowed_ref_2.py) 4. Things that don't crash