Author: Armin Rigo <[email protected]>
Branch: py3.6-sandbox-2
Changeset: r97220:0ae0d48891a6
Date: 2019-08-19 22:19 +0200
http://bitbucket.org/pypy/pypy/changeset/0ae0d48891a6/

Log:    Don't call syscall() from the sandbox

diff --git a/rpython/rlib/rurandom.py b/rpython/rlib/rurandom.py
--- a/rpython/rlib/rurandom.py
+++ b/rpython/rlib/rurandom.py
@@ -6,7 +6,7 @@
 import errno
 
 from rpython.rtyper.lltypesystem import lltype, rffi
-from rpython.rlib.objectmodel import not_rpython
+from rpython.rlib.objectmodel import not_rpython, fetch_translated_config
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 from rpython.rtyper.tool import rffi_platform
 
@@ -148,7 +148,9 @@
         # initialize the random seed of string hashes
         result = []
         if SYS_getrandom is not None:
-            n = _getrandom(n, result, signal_checker)
+            config = fetch_translated_config()
+            if config is None or not config.translation.sandbox:
+                n = _getrandom(n, result, signal_checker)
         if n <= 0:
             return ''.join(result)
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to