[*] POSIX hardening: dont COW this futex

This commit is contained in:
Reece Wilson 2024-01-21 18:41:53 +00:00
parent 75f39b9858
commit 98e76f0832
3 changed files with 17 additions and 0 deletions

View File

@ -14,6 +14,11 @@ namespace Aurora::Process
{
static AuThreadPrimitives::Mutex gEnvMutex;
void PosixForkResetLocks()
{
AuResetMember(gEnvMutex);
}
AUKN_SYM AuList<AuPair<AuString, AuString>> EnvironmentGetAll()
{
AU_LOCK_GUARD(gEnvMutex);

View File

@ -12,6 +12,11 @@
#include <unistd.h>
#include <Source/IO/FS/FS.hpp>
namespace Aurora::Process
{
void PosixForkResetLocks();
}
namespace Aurora::Processes
{
static void UnixOpenAsyncThread(AuString uri, bool bType)
@ -60,6 +65,7 @@ namespace Aurora::Processes
{
setsid();
AuProcess::PosixForkResetLocks();
auto optStringA = AuProcess::EnvironmentGetOne("container");
auto optStringB = AuProcess::EnvironmentGetOne("AURORA_RUNTIME_USE_GDBUS_BIN_TO_PORTAL");
bool bIsFireJail = optStringA && optStringA.Value() == "firejail";

View File

@ -47,6 +47,10 @@
#include <sched.h>
#endif
namespace Aurora::Process
{
void PosixForkResetLocks();
}
namespace Aurora::Processes
{
@ -563,6 +567,8 @@ namespace Aurora::Processes
void ProcessImpl::ForkMain()
{
AuProcess::PosixForkResetLocks();
{
::dup2(this->pipeStdIn_[0], STDIN_FILENO);
::close(this->pipeStdIn_[0]);