diff options
| author | Zousar Shaker <[email protected]> | 2026-04-13 15:17:32 -0600 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-04-13 15:17:32 -0600 |
| commit | 977bd5b196875b47b6ed1616f41bb3d8b0f8b652 (patch) | |
| tree | 46a8a67de6d9afdffa02e7f0b5d918fb46d03ffe | |
| parent | fix utf characters in source code (#953) (diff) | |
| parent | Removing CLOEXEC use on shared memory descriptors (diff) | |
| download | zen-977bd5b196875b47b6ed1616f41bb3d8b0f8b652.tar.xz zen-977bd5b196875b47b6ed1616f41bb3d8b0f8b652.zip | |
Merge pull request #955 from ue-foundation/zs/shared-memory-open-flags-fix
Stop using O_CLOEXEC in shm_open
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | src/zencore/filesystem.cpp | 2 | ||||
| -rw-r--r-- | src/zenutil/zenserverprocess.cpp | 10 |
3 files changed, 7 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index a0f7a79c3..aa35ca96c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ - Improvement: Default memory allocator changed back to mimalloc from rpmalloc - Bugfix: Dashboard stats tiles no longer flicker on page load when WebSocket updates arrive before all stats are available - Bugfix: Build storage operations now silence HTTP exceptions on aborted requests instead of logging spurious errors +- Bugfix: Avoid use of `O_CLOEXEC` when operating on shared memory on Mac and Linux as it was reported to cause issues for MacOS 26.4 and later ## 5.8.3 - Feature: Incremental CAS-based hydration/dehydration replacing the previous full-copy approach diff --git a/src/zencore/filesystem.cpp b/src/zencore/filesystem.cpp index 70d0f32b3..5160bfdc6 100644 --- a/src/zencore/filesystem.cpp +++ b/src/zencore/filesystem.cpp @@ -3462,7 +3462,7 @@ public: ZEN_UNUSED(SystemGlobal); std::string InstanceMapName = fmt::format("/{}", Name); - ScopedFd FdGuard(shm_open(InstanceMapName.c_str(), O_RDWR | O_CREAT | O_CLOEXEC, 0666)); + ScopedFd FdGuard(shm_open(InstanceMapName.c_str(), O_RDWR | O_CREAT, 0666)); if (!FdGuard) { return {}; diff --git a/src/zenutil/zenserverprocess.cpp b/src/zenutil/zenserverprocess.cpp index 9a282a848..1fe373228 100644 --- a/src/zenutil/zenserverprocess.cpp +++ b/src/zenutil/zenserverprocess.cpp @@ -181,7 +181,7 @@ ZenServerState::Initialize() ThrowLastError("Could not map view of Zen server state"); } #else - int Fd = shm_open("/UnrealEngineZen", O_RDWR | O_CREAT | O_CLOEXEC, geteuid() == 0 ? 0766 : 0666); + int Fd = shm_open("/UnrealEngineZen", O_RDWR | O_CREAT, geteuid() == 0 ? 0766 : 0666); if (Fd < 0) { // Work around a potential issue if the service user is changed in certain configurations. @@ -191,7 +191,7 @@ ZenServerState::Initialize() // shared memory object and retry, we'll be able to get past shm_open() so long as we have // the appropriate permissions to create the shared memory object. shm_unlink("/UnrealEngineZen"); - Fd = shm_open("/UnrealEngineZen", O_RDWR | O_CREAT | O_CLOEXEC, geteuid() == 0 ? 0766 : 0666); + Fd = shm_open("/UnrealEngineZen", O_RDWR | O_CREAT, geteuid() == 0 ? 0766 : 0666); if (Fd < 0) { ThrowLastError("Could not open a shared memory object"); @@ -244,7 +244,7 @@ ZenServerState::InitializeReadOnly() ThrowLastError("Could not map view of Zen server state"); } #else - int Fd = shm_open("/UnrealEngineZen", O_RDONLY | O_CLOEXEC, 0666); + int Fd = shm_open("/UnrealEngineZen", O_RDONLY, 0666); if (Fd < 0) { return false; @@ -651,7 +651,7 @@ ZenServerInstanceInfo::Create(const Oid& SessionId, const InstanceInfoData& Data ThrowLastError("Could not map instance info shared memory"); } #else - int Fd = shm_open(Name.c_str(), O_RDWR | O_CREAT | O_TRUNC | O_CLOEXEC, 0666); + int Fd = shm_open(Name.c_str(), O_RDWR | O_CREAT | O_TRUNC, 0666); if (Fd < 0) { ThrowLastError("Could not create instance info shared memory"); @@ -718,7 +718,7 @@ ZenServerInstanceInfo::OpenReadOnly(const Oid& SessionId) return false; } #else - int Fd = shm_open(Name.c_str(), O_RDONLY | O_CLOEXEC, 0666); + int Fd = shm_open(Name.c_str(), O_RDONLY, 0666); if (Fd < 0) { return false; |