Skip to content

fix: avoid vfork stack corruption and x86-64 charset abort - #27

Open
johoja12 wants to merge 3 commits into
cgnl:mainfrom
johoja12:fix/unsafe-vfork-interposer
Open

johoja12 wants to merge 3 commits into
cgnl:mainfrom
johoja12:fix/unsafe-vfork-interposer

Conversation

@johoja12

@johoja12 johoja12 commented Sep 26, 2026 •

Copy link
Copy Markdown

Plex 1.43.4 on x86-64 can fail during PostgreSQL-shim startup at two distinct points:

  1. The stock shim exports a Rust vfork wrapper. The child shares the suspended parent's address space and stack until exec, so returning through Rust code and logging from this wrapper is unsafe. In an isolated QNAP run, strace recorded a successful Plex Script Host execve followed immediately by SIGSEGV in the parent's createProcess path. The wrapper only logged, so this change lets Plex use libc's vfork.
  2. After removing that SIGSEGV, Plex aborted in boost::locale::util::create_simple_codecvt with invalid_charset_error for the literal ASCII. The shim already redirects ASCII to UTF-8 on AArch64. This change supplies the equivalent x86-64 tail-call while preserving the C++ hidden return pointer and argument registers.

Validation used a fresh PostgreSQL 15 database and Plex config, with upstream's own migration from a read-only SQLite snapshot. The migration reported 36 tables migrated, none skipped or failed, 63,238 metadata items, 1,152 blobs, and 8 library sections; doctor.sh --check passed all 32 checks. The patched shim passed the original SIGSEGV and charset abort points, confirmed by GDB and container logs. Plex then hit a separate Invalid uuid length exception, so this PR does not claim a fully healthy Plex server.

Related symptoms: #17, #26. The UUID failure is distinct from these two fixes.

@johoja12 johoja12 changed the title fix: remove unsafe Rust vfork interposer fix: avoid vfork stack corruption and x86-64 charset abort Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant