Showing content from http://mail.python.org/pipermail/python-dev/attachments/20060720/d60aea40/attachment.htm below:
<br><br><div><span class="gmail_quote">On 7/20/06, <b class="gmail_sendername">Giovanni Bajo</b> <<a href="mailto:rasky@develer.com">rasky@develer.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Brett Cannon wrote:<br><br>>><br><a href="http://svn.python.org/view/python/branches/bcannon-sandboxing/securing_python.txt?rev=50717&view=log">http://svn.python.org/view/python/branches/bcannon-sandboxing/securing_python.txt?rev=50717&view=log
</a><br>>> .<br>>><br>>> How do you plan to handle CPU-hogs? Stuff like execution of a<br>>> gigantic integer multiplication.<br>><br>><br>> I don't. =) Protecting the CPU is damn hard to do in any form of
<br>> portable fashion. And even getting it to work on an OS you do know<br>> the details of leads to probably an interrupt implementation and<br>> that doesn't sound fun.<br><br>I think the trick used by the safe_eval recipe (a separate thread which
<br>interrupts the script through thread.interrupt_main()) shows that, in most<br>cases, it's possible to make sure that an embedded script does not take too<br>long to execute. Do you agree that this usage case ("allow me to timeout an
<br>embedded script") is something which would be a very good start in the right<br>direction?</blockquote><div><br>Probably. I just don't feel like worrying about it right now. =) <br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Now, I wonder, in a restricted execution environment such as that depicted<br>in your document, how many different ways are there to make the Python<br>interpreter enter a long calcolation loop which does not release the GIL? I
<br>can think of bignum*bignum, bignum**bignum or similar mathematical<br>operations, but there are really a few. If we could make those release the<br>GIL (or poll some kind of watchdog used to abort them, pretty much like they
<br>normally poll CTRL+C), then the same trick used by the recipe could be used.</blockquote><div><br>Well, any work that does most of its calculation within C code and that does not touch base with the interpreter on a semi-regular basis would need to relesae the GIL.
<br><br>-Brett<br></div></div>
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4