Author: Armin Rigo <[email protected]>
Branch: sandbox-2
Changeset: r97113:72768e4f4ec6
Date: 2019-08-09 12:44 +0200
http://bitbucket.org/pypy/pypy/changeset/72768e4f4ec6/
Log: Mark a few functions as sandboxsafe=True, because I don't think they
can cause any problem
diff --git a/pypy/module/time/interp_time.py b/pypy/module/time/interp_time.py
--- a/pypy/module/time/interp_time.py
+++ b/pypy/module/time/interp_time.py
@@ -112,7 +112,6 @@
)
CLOCKS_PER_SEC = platform.ConstantInteger("CLOCKS_PER_SEC")
clock_t = platform.SimpleType("clock_t", rffi.ULONG)
- has_gettimeofday = platform.Has('gettimeofday')
if _POSIX:
calling_conv = 'c'
@@ -167,19 +166,17 @@
tm = cConfig.tm
glob_buf = lltype.malloc(tm, flavor='raw', zero=True, immortal=True)
-if cConfig.has_gettimeofday:
- c_gettimeofday = external('gettimeofday', [rffi.VOIDP, rffi.VOIDP],
rffi.INT)
TM_P = lltype.Ptr(tm)
c_time = external('time', [rffi.TIME_TP], rffi.TIME_T)
-c_ctime = external('ctime', [rffi.TIME_TP], rffi.CCHARP)
+c_ctime = external('ctime', [rffi.TIME_TP], rffi.CCHARP, sandboxsafe=True)
c_gmtime = external('gmtime', [rffi.TIME_TP], TM_P,
- save_err=rffi.RFFI_SAVE_ERRNO)
-c_mktime = external('mktime', [TM_P], rffi.TIME_T)
-c_asctime = external('asctime', [TM_P], rffi.CCHARP)
+ save_err=rffi.RFFI_SAVE_ERRNO, sandboxsafe=True)
+c_mktime = external('mktime', [TM_P], rffi.TIME_T, sandboxsafe=True)
+c_asctime = external('asctime', [TM_P], rffi.CCHARP, sandboxsafe=True)
c_localtime = external('localtime', [rffi.TIME_TP], TM_P,
- save_err=rffi.RFFI_SAVE_ERRNO)
+ save_err=rffi.RFFI_SAVE_ERRNO, sandboxsafe=True)
if _POSIX:
- c_tzset = external('tzset', [], lltype.Void)
+ c_tzset = external('tzset', [], lltype.Void, sandboxsafe=True)
if _WIN:
win_eci = ExternalCompilationInfo(
includes = ["time.h"],
@@ -218,7 +215,7 @@
rffi.INT, win_eci, calling_conv='c')
c_strftime = external('strftime', [rffi.CCHARP, rffi.SIZE_T, rffi.CCHARP,
TM_P],
- rffi.SIZE_T)
+ rffi.SIZE_T, sandboxsafe=True)
def _init_accept2dyear(space):
if os.environ.get("PYTHONY2K"):
diff --git a/rpython/rlib/entrypoint.py b/rpython/rlib/entrypoint.py
--- a/rpython/rlib/entrypoint.py
+++ b/rpython/rlib/entrypoint.py
@@ -41,7 +41,9 @@
return deco
-pypy_debug_catch_fatal_exception =
rffi.llexternal('pypy_debug_catch_fatal_exception', [], lltype.Void)
+pypy_debug_catch_fatal_exception = rffi.llexternal(
+ 'pypy_debug_catch_fatal_exception', [], lltype.Void,
+ sandboxsafe=True)
def entrypoint_highlevel(key, argtypes, c_name=None):
"""
diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -1079,7 +1079,7 @@
# for more details. If this get's fixed we can use lltype.Signed
# again. (The exact same issue occurs on ppc64 big-endian.)
c_func = external(name, [rffi.INT], lltype.Signed,
- macro=_MACRO_ON_POSIX)
+ macro=_MACRO_ON_POSIX, sandboxsafe=True)
returning_int = name in ('WEXITSTATUS', 'WSTOPSIG', 'WTERMSIG')
@replace_os_function(name)
@@ -1990,9 +1990,12 @@
if sys.platform != 'win32':
# These are actually macros on some/most systems
- c_makedev = external('makedev', [rffi.INT, rffi.INT], rffi.INT, macro=True)
- c_major = external('major', [rffi.INT], rffi.INT, macro=True)
- c_minor = external('minor', [rffi.INT], rffi.INT, macro=True)
+ c_makedev = external('makedev', [rffi.INT, rffi.INT], rffi.INT, macro=True,
+ sandboxsafe=True)
+ c_major = external('major', [rffi.INT], rffi.INT, macro=True,
+ sandboxsafe=True)
+ c_minor = external('minor', [rffi.INT], rffi.INT, macro=True,
+ sandboxsafe=True)
@replace_os_function('makedev')
def makedev(maj, min):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit