#48

server: Align variable-sized shared object allocations

Openalantangokwants to merge intofrom

Variable-sized shared objects can leave the next session_object four-byte aligned. Its 64-bit sequence counter is then passed to WriteRelease64, which faults on ARM64. Round each allocation to eight bytes so both new and reused objects retain natural alignment.

This was observed during SimCity 4 Deluxe retail startup on an M1 iPad: wineserver stopped at alloc_shared_object+0x1e0, executing stlr x24, [x23] at a sequence address ending in ...c5c. The corresponding Madeira server copy has the same defect.

Validation:

  • A host harness compiling the production allocator and session structures, with stubbed mapping/list management, fails on the original code and passes 128 varying payload sizes after the change (ASan/UBSan).
  • Rebuilt Madeira's native server and app and verified the allocator fault no longer occurs on the M1 iPad. Local build 17, with additional per-game GDI/native DirectDraw compatibility changes, subsequently passed Traditional Chinese city construction and cold save/reload (population 76). The allocator change addresses the native fault; the separate rendering changes are required for that combined gameplay result.

No game binaries, licence keys or private device logs are included.