Skip to content

bug: obs-util: windows-gnu profiler_parity access violation - #682

Merged
zackees merged 2 commits into
obs-rust:masterfrom
nathan-v:fix/441-mingw-profiler-crash
Oct 14, 2026
Merged

zackees merged 2 commits into
obs-rust:masterfrom
nathan-v:fix/441-mingw-profiler-crash

Conversation

@nathan-v

Copy link
Copy Markdown
Contributor

Fixes #441

RED 0f82bc0a3: oracle_profiler_survives_process_tls in profiler_parity. On x86_64-pc-windows-gnu the process exits 0xC0000005 (STATUS_ACCESS_VIOLATION) inside pthread_getspecific, reading an address whose top 32 bits are zero. MSVC runs the same calls and returns.

GREEN 2925d060c: oracle_profiler_survives_process_tls passes on windows-gnu and on MSVC. The whole obs-util suite passed locally for x86_64-pc-windows-gnu.

libgcc emutls calls pthread_getspecific and loads pthread_key_t as a 32-bit unsigned long. The oracle's w32-pthreads key is a pointer. On real Windows that pointer is above 4GB, so the truncated value is not a valid address. Wine and a debugger heap stay in the low 4GB, which is why the same binary survived there. windows-gnu now renames the oracle's pthread_*, sem_*, and sched_* symbols to oracle_* and links libwinpthread for the unprefixed names.

The RED commit is the check that the rename matters: without it, that test crashes. The rename was put back in GREEN.

GCC 15 needs sys/stat.h included before platform.h's struct stat. MSVC /W4 treats uthash's while (0) as C4127, so that warning is disabled next to the existing C4702 disable.

Docker is not installed here, so the Tier 2 cmocka lane and the local-gate stamp were not run. ./lint on this machine fails in ci/ unit tests because cmake is not on PATH and the working tree has an unrelated dirty plugins/obs-websocket pointer. soldr rustfmt --check passed on the two Rust files in this PR. Please rebase onto master and stamp if this branch is behind or the stamp is required.

Reporter: @zackees

On x86_64-pc-windows-gnu, starting the C profiler exits 0xC0000005
before this fix. MSVC has no libgcc, so the same calls return.

Refs obs-rust#441
@nathan-v
nathan-v requested a review from zackees as a code owner October 14, 2026 05:49
@zackees zackees added the ci-full Run every CI job on this PR, including the release-gating OBS app builds and Flatpak label Oct 14, 2026
libgcc emutls calls pthread_getspecific and loads pthread_key_t as a
32-bit unsigned long. The oracle's w32-pthreads key is a pointer, so on
real Windows the truncated key is not a valid address. windows-gnu now
renames those pthread, sem, and sched symbols to oracle_* and links
libwinpthread for the unprefixed names.

GCC 15 needs sys/stat.h before platform.h's struct stat. MSVC /W4 treats
uthash's while (0) as C4127, so that warning is disabled with C4702.

Fixes obs-rust#441

Local-Gate: v1 tree=5dce400cf7f35892300c42b81598a6898f74eae3 secs=472 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run
Ci-Attestation: {"at":1791957527,"gate":"rust/all/fmt","host":"linux-x86_64","key":"79fbbb0031bd937abe8be2ca103ace2c95fa82a98f43d633c6e2d3e0d6435de3","lane":"lint","parents":["0f82bc0a34e8f51fd3c9e1d817e56e8232c88f11"],"secs":42,"stamp":"2dd9dac1f157ca1072218fb5554ca00c","tree":"5dce400cf7f35892300c42b81598a6898f74eae3","v":1,"via":"run"}
Ci-Attestation: {"at":1791957527,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"79fbbb0031bd937abe8be2ca103ace2c95fa82a98f43d633c6e2d3e0d6435de3","lane":"lint","parents":["0f82bc0a34e8f51fd3c9e1d817e56e8232c88f11"],"secs":42,"stamp":"d87b630fd9f2056b2015f56be610cf0b","tree":"5dce400cf7f35892300c42b81598a6898f74eae3","v":1,"via":"run"}
Ci-Attestation: {"at":1791957527,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"47a8ff0b77da71c65ac65d61e0242c0569b96b00b47620df0b621d74675f9821","lane":"rust-test","parents":["0f82bc0a34e8f51fd3c9e1d817e56e8232c88f11"],"secs":135,"stamp":"627a1e828325fb6b28238af64a0bd30d","tree":"5dce400cf7f35892300c42b81598a6898f74eae3","v":1,"via":"run"}
Ci-Attestation: {"at":1791957527,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"68f639aca67118a8c7951aa8b05645819455ce8a787dbd49d06e3b8c79454f1c","lane":"cross","parents":["0f82bc0a34e8f51fd3c9e1d817e56e8232c88f11"],"secs":136,"stamp":"a781699c147dc880f123d3f296f35eb8","tree":"5dce400cf7f35892300c42b81598a6898f74eae3","v":1,"via":"run"}
Ci-Attestation: {"at":1791957527,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"68f639aca67118a8c7951aa8b05645819455ce8a787dbd49d06e3b8c79454f1c","lane":"cross","parents":["0f82bc0a34e8f51fd3c9e1d817e56e8232c88f11"],"secs":136,"stamp":"5cf0c557cd10d28ea6893f43b72d39cc","tree":"5dce400cf7f35892300c42b81598a6898f74eae3","v":1,"via":"run"}
Ci-Attestation: {"at":1791957527,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"68f639aca67118a8c7951aa8b05645819455ce8a787dbd49d06e3b8c79454f1c","lane":"cross","parents":["0f82bc0a34e8f51fd3c9e1d817e56e8232c88f11"],"secs":136,"stamp":"822ce47fdd348842f3159fefeb5cdbfb","tree":"5dce400cf7f35892300c42b81598a6898f74eae3","v":1,"via":"run"}
Ci-Attestation: {"at":1791957527,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"68f639aca67118a8c7951aa8b05645819455ce8a787dbd49d06e3b8c79454f1c","lane":"cross","parents":["0f82bc0a34e8f51fd3c9e1d817e56e8232c88f11"],"secs":136,"stamp":"7e653eac2efe67d0f8f9ae1ab423ac14","tree":"5dce400cf7f35892300c42b81598a6898f74eae3","v":1,"via":"run"}
Ci-Attestation: {"at":1791957527,"gate":"rust/x86_64-apple-darwin/clippy","host":"linux-x86_64","key":"68f639aca67118a8c7951aa8b05645819455ce8a787dbd49d06e3b8c79454f1c","lane":"cross","parents":["0f82bc0a34e8f51fd3c9e1d817e56e8232c88f11"],"secs":136,"stamp":"4e553f9f45985fb0e059b1c914f197be","tree":"5dce400cf7f35892300c42b81598a6898f74eae3","v":1,"via":"run"}
Ci-Attestation: {"at":1791957527,"gate":"rust/x86_64-apple-darwin/dylint","host":"linux-x86_64","key":"68f639aca67118a8c7951aa8b05645819455ce8a787dbd49d06e3b8c79454f1c","lane":"cross","parents":["0f82bc0a34e8f51fd3c9e1d817e56e8232c88f11"],"secs":136,"stamp":"74dbaa0e6a68e9de6f16f8cbe90d71b0","tree":"5dce400cf7f35892300c42b81598a6898f74eae3","v":1,"via":"run"}
Ci-Attestation: {"at":1791957527,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"72129a31187ce100be612fae7c74a538d8103eb42b4265c23cca4c5017fcb8f9","lane":"tier2-linux","parents":["0f82bc0a34e8f51fd3c9e1d817e56e8232c88f11"],"secs":159,"stamp":"9ab99000d0b59aa15ce69bf92bb01fb2","tree":"5dce400cf7f35892300c42b81598a6898f74eae3","v":1,"via":"run"}
@zackees

zackees commented Oct 14, 2026

Copy link
Copy Markdown
Member

Rebased onto master, ran the local gate and stamped it, as you asked. Its cross lane builds and clippy-checks windows-gnu.

Red → green: CI has no windows-gnu test lane, only MSVC on Windows, and the crash does not reproduce under Wine. So the RED (0f82bc0a3, 0xC0000005 in pthread_getspecific) and GREEN (2925d060c) evidence for windows-gnu is your real-Windows run; I could not reproduce it here. ci-full is set so the MSVC and Linux Rust tests and Tier 2 confirm the rename breaks nothing else.

  • Rebased on master, local gate passed; pushed as 1583d96.

@zackees
zackees force-pushed the fix/441-mingw-profiler-crash branch from 2925d06 to 1583d96 Compare October 14, 2026 05:58
@zackees
zackees merged commit 8769842 into obs-rust:master Oct 14, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-full Run every CI job on this PR, including the release-gating OBS app builds and Flatpak

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug: obs-util: profiler_parity crashes under x86_64-pc-windows-gnu (STATUS_ACCESS_VIOLATION)

2 participants