You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(sidecar): use fchown via SO_PEERCRED to grant cross-user SHM access
In PHP-FPM thread mode the master process runs as root and spawns worker
processes as www-data. Named POSIX SHM objects were created with 0600
(owner-only), so workers could not open them for writing.
The correct fix is to fchown() the SHM to the worker's UID after creation.
The worker UID is obtained via SO_PEERCRED (peer_cred()) on the first
accepted Unix socket connection in the thread listener, before the SHM
lazy-lock is initialized.
Changes:
- Replace set_shm_open_mode/SHM_OPEN_MODE with set_shm_owner_uid/SHM_OWNER_UID
in both mem_handle.rs and mem_handle_macos.rs
- Call fchown(fd, worker_uid, None) in NamedShmHandle::create_mode() when
SHM_OWNER_UID is set; restore default mode to S_IWUSR|S_IRUSR (0600)
- Add nix "user" feature to datadog-ipc for fchown/Uid support
- Add init_shm_eagerly field to MainLoopConfig (default true); thread mode
sets it false to defer SHM initialization to first connection
- In accept_socket_loop_thread: use FIRST_CONNECTION_INIT OnceLock to call
set_shm_owner_uid(peer_uid) then init SHM_LIMITER exactly once on first
worker connection
- Remove ddog_sidecar_set_shm_open_mode FFI function (no longer needed)
0 commit comments