[pypy-svn] r45886 - in pypy/branch/pypy-more-rtti-inprogress/translator/c: . src
arigo at codespeak.net
arigo at codespeak.net
Mon Aug 20 17:39:42 CEST 2007
Author: arigo
Date: Mon Aug 20 17:39:41 2007
New Revision: 45886
Modified:
pypy/branch/pypy-more-rtti-inprogress/translator/c/genc.py
pypy/branch/pypy-more-rtti-inprogress/translator/c/src/support.h
Log:
While we're at it, let's always enable RPY_LL_ASSERT in a sandboxed
program.
Modified: pypy/branch/pypy-more-rtti-inprogress/translator/c/genc.py
==============================================================================
--- pypy/branch/pypy-more-rtti-inprogress/translator/c/genc.py (original)
+++ pypy/branch/pypy-more-rtti-inprogress/translator/c/genc.py Mon Aug 20 17:39:41 2007
@@ -127,6 +127,8 @@
defines = defines.copy()
if self.config.translation.countmallocs:
defines['COUNT_OP_MALLOCS'] = 1
+ if self.config.translation.sandbox:
+ defines['RPY_SANDBOXED'] = 1
if CBuilder.have___thread is None:
CBuilder.have___thread = check_under_under_thread()
if not self.standalone:
Modified: pypy/branch/pypy-more-rtti-inprogress/translator/c/src/support.h
==============================================================================
--- pypy/branch/pypy-more-rtti-inprogress/translator/c/src/support.h (original)
+++ pypy/branch/pypy-more-rtti-inprogress/translator/c/src/support.h Mon Aug 20 17:39:41 2007
@@ -34,6 +34,10 @@
* RPY_LL_ASSERT, all GcArray indexing are checked, which is safer
* against attacks and segfaults - but less precise in the case of
* lists, because of the overallocated bit.
+ *
+ * For extra safety, in programs translated with --sandbox we always
+ * assume that we want RPY_LL_ASSERT. You can change it below to trade
+ * safety for performance, though the hit is not huge (~10%?).
*/
#ifdef RPY_ASSERT
# define RPyAssert(x, msg) \
@@ -55,7 +59,7 @@
# define RPyAssert(x, msg) /* nothing */
#endif
-#ifdef RPY_LL_ASSERT
+#if defined(RPY_LL_ASSERT) || defined(RPY_SANDBOXED)
/* obscure macros that can be used as expressions and lvalues to refer
* to a field of a structure or an item in an array in a "safe" way --
* they abort() in case of null pointer or out-of-bounds index. As a
More information about the Pypy-commit
mailing list