configurable trans-membrance hostcall blocklist

This commit is contained in:
root
2026-06-16 01:13:06 +00:00
parent 52cf266a5e
commit f2a3503ac3
60 changed files with 1675 additions and 338 deletions
+17 -3
View File
@@ -5,12 +5,13 @@
#include <cstdlib>
#include <cctype>
#include <filesystem>
#include <fcntl.h>
#include <sys/file.h>
#include <unistd.h>
namespace {
const u64 UCE_UNIT_ABI_VERSION = 7;
const u64 UCE_UNIT_ABI_VERSION = 8;
struct SharedUnitFilesystemState
{
@@ -210,15 +211,28 @@ int compiler_open_lock_file(String file_name, String purpose)
auto lock_dir = dirname(file_name);
if(lock_dir != "")
mkdir(lock_dir);
int fdlock = file_open_locked(file_name, O_RDWR | O_CREAT, LOCK_EX, 0666);
int fdlock = open(file_name.c_str(), O_RDWR | O_CREAT, 0666);
if(fdlock == -1)
{
printf("(!) Could not open lock file %s\n", file_name.c_str());
return(fdlock);
}
fcntl(fdlock, F_SETFD, FD_CLOEXEC);
if(flock(fdlock, LOCK_EX) != 0)
{
close(fdlock);
printf("(!) Could not lock file %s\n", file_name.c_str());
return(-1);
}
return(fdlock);
}
void compiler_close_lock_file(int fdlock)
{
file_close_locked(fdlock);
if(fdlock == -1)
return;
flock(fdlock, LOCK_UN);
close(fdlock);
}
String compiler_normalize_unit_path(Request* context, String file_name)