Author: Armin Rigo <[email protected]>
Branch: py3.6-sandbox-2
Changeset: r97222:4b3a0b8bf44b
Date: 2019-08-20 10:34 +0200
http://bitbucket.org/pypy/pypy/changeset/4b3a0b8bf44b/

Log:    Compile the sandbox with the _socket module

diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -47,7 +47,7 @@
 # --sandbox
 sandbox_modules = default_modules.copy()
 sandbox_modules.update([
-    "array", "binascii",
+    "array", "binascii", "_socket",
 ])
 
 import rpython.rlib.rvmprof.cintf
diff --git a/rpython/rlib/_rsocket_rffi.py b/rpython/rlib/_rsocket_rffi.py
--- a/rpython/rlib/_rsocket_rffi.py
+++ b/rpython/rlib/_rsocket_rffi.py
@@ -1217,21 +1217,21 @@
                        size_t, CCHARP, size_t, rffi.INT], rffi.INT)
 
 if sys.platform.startswith("openbsd") or sys.platform.startswith("darwin"):
-    htonl = external('htonl', [rffi.UINT], rffi.UINT, releasegil=False, 
macro=True)
-    htons = external('htons', [rffi.USHORT], rffi.USHORT, releasegil=False, 
macro=True)
-    ntohl = external('ntohl', [rffi.UINT], rffi.UINT, releasegil=False, 
macro=True)
-    ntohs = external('ntohs', [rffi.USHORT], rffi.USHORT, releasegil=False, 
macro=True)
+    htonl = external('htonl', [rffi.UINT], rffi.UINT, releasegil=False, 
macro=True, sandboxsafe=True)
+    htons = external('htons', [rffi.USHORT], rffi.USHORT, releasegil=False, 
macro=True, sandboxsafe=True)
+    ntohl = external('ntohl', [rffi.UINT], rffi.UINT, releasegil=False, 
macro=True, sandboxsafe=True)
+    ntohs = external('ntohs', [rffi.USHORT], rffi.USHORT, releasegil=False, 
macro=True, sandboxsafe=True)
 else:
-    htonl = external('htonl', [rffi.UINT], rffi.UINT, releasegil=False)
-    htons = external('htons', [rffi.USHORT], rffi.USHORT, releasegil=False)
-    ntohl = external('ntohl', [rffi.UINT], rffi.UINT, releasegil=False)
-    ntohs = external('ntohs', [rffi.USHORT], rffi.USHORT, releasegil=False)
+    htonl = external('htonl', [rffi.UINT], rffi.UINT, releasegil=False, 
sandboxsafe=True)
+    htons = external('htons', [rffi.USHORT], rffi.USHORT, releasegil=False, 
sandboxsafe=True)
+    ntohl = external('ntohl', [rffi.UINT], rffi.UINT, releasegil=False, 
sandboxsafe=True)
+    ntohs = external('ntohs', [rffi.USHORT], rffi.USHORT, releasegil=False, 
sandboxsafe=True)
 
 if _POSIX:
     inet_aton = external('inet_aton', [CCHARP, lltype.Ptr(in_addr)],
-                                rffi.INT)
+                                rffi.INT, sandboxsafe=True)
 
-inet_ntoa = external('inet_ntoa', [in_addr], rffi.CCHARP)
+inet_ntoa = external('inet_ntoa', [in_addr], rffi.CCHARP, sandboxsafe=True)
 
 
 inet_pton = external('inet_pton', [rffi.INT, rffi.CCHARP,
@@ -1242,7 +1242,7 @@
                                    socklen_t], CCHARP,
                      save_err=SAVE_ERR)
 
-inet_addr = external('inet_addr', [rffi.CCHARP], rffi.UINT)
+inet_addr = external('inet_addr', [rffi.CCHARP], rffi.UINT, sandboxsafe=True)
 socklen_t_ptr = lltype.Ptr(rffi.CFixedArray(socklen_t, 1))
 socketaccept = external('accept', [socketfd_type, sockaddr_ptr,
                                    socklen_t_ptr], socketfd_type,
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to