Jinoh Kang (@iamahuman) commented about server/mapping.c:
+ size = (size + page_mask) & ~((mem_size_t)page_mask); + + if ((unix_fd = create_temp_file( size )) == -1) return -1; + if (!(fd = create_anonymous_fd( &mapping_fd_ops, unix_fd, &session_mapping->obj, FILE_SYNCHRONOUS_IO_NONALERT ))) + { + close( unix_fd ); + return -1; + } + if ((new_session.shared = mmap( NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, unix_fd, 0 )) == MAP_FAILED) + { + release_object( fd ); + return -1; + } + allow_fd_caching( fd ); + + SHARED_WRITE_BEGIN( new_session.shared, session_shm_t ) No need to write-lock the new session as nothing can be using the new session yet.
Not using `SHARED_WRITE_BEGIN` for any potentially long-running code makes the shared memory users easier to reason about. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3103#note_62044