This commit is contained in:
Victor Tabary 2024-06-26 19:09:43 +02:00
parent 0eaa6f5fe7
commit 29c9b2817f
2 changed files with 7 additions and 4 deletions

View File

@ -19,6 +19,10 @@ function clear.clearAllGlobals()
for k, v in pairs(_G) do for k, v in pairs(_G) do
if not table_contains(WHITELIST, tostring(k)) then _G[k] = nil end; if not table_contains(WHITELIST, tostring(k)) then _G[k] = nil end;
end end
_G["k"] = nil
_G["v"] = nil
_G["WHITELIST"] = nil
_G["clearAllGlobals"] = nil
end end
jit.off(table_contains) jit.off(table_contains)
jit.off(clear.clearAllGlobals) jit.off(clear.clearAllGlobals)

View File

@ -616,7 +616,6 @@ int init_seccomp()
return prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) || prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog); return prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) || prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog);
} }
#include "math.h" #include "math.h"
int random_digit() int random_digit()
{ {
@ -651,8 +650,8 @@ int do_something()
struct global_var_t { struct global_var_t {
char input_buffer[LUA_MAXINPUT]; char input_buffer[LUA_MAXINPUT];
int (*c_functions[C_FUNCTIONS_N]) (void); int (*c_functions[C_FUNCTIONS_N]) (void);
} }
__attribute__ ((aligned (0x10000))) // early optimization rocks __attribute__ ((aligned (0x10000))) // early optimization rocks
global = {{},{random_digit,get_time,do_something,0,0,0,0,0,0,0}}; global = {{},{random_digit,get_time,do_something,0,0,0,0,0,0,0}};
@ -681,7 +680,7 @@ int check_safe_func(void* ptr){
v1 >>= 6; v1 >>= 6;
long long int v2 = ptr-((size_t)((size_t)&main)&~0xffff); long long int v2 = ptr-((size_t)((size_t)&main)&~0xffff);
// TODO: remove // TODO: remove
printf("[DEBUG] v1 = %lld, \tv2 = %lld\n",v1,v2); printf("[DEBUG] v1 = %lld, \tv2 = %lld\n",v1,v2);
return !(v2<0||(0<v1 && v1<31415926)||(ptr == &random_digit || ptr==&do_something || ptr==&get_time)); return !(v2<0||(0<v1 && v1<31415926)||(ptr == &random_digit || ptr==&do_something || ptr==&get_time));
} }