Files
PS5_RetroArch/tools
Mihawk cdc2b0716c curl for the PS5: mbedTLS built thread-safe (the WebUI daemon crashed)
The daemon died at start on the console (SIGSEGV, fault address 0) and never came up:
the backtrace (klog, symbolized against build/webui-daemon/ps5-retroarch-webui.elf)
runs from a scraper worker's download through curl_easy_perform into
mbedtls_ssl_write_client_hello -> mbedtls_ctr_drbg_random_with_add ->
mbedtls_entropy_func -> mbedtls_sha512_update. curl 8.22 shares one CTR-DRBG (prediction
resistance on) among all its connections and relies on mbedTLS's own locks for it; our
mbedTLS 3.6.7 was built without them. With 32 workers (a034b6e) starting handshakes
together the shared generator was torn; the job resumed by itself at every start, so
every start crashed.

tools/build-curl.sh now sets MBEDTLS_THREADING_C and MBEDTLS_THREADING_PTHREAD
(scripts/config.py) before building mbedTLS. Why a flag in a shared script: curl's
mbedTLS backend requires it whenever handles run on several threads; the ES-DE build
that links this curl gains the same locks.

Evidence: libmbedcrypto.a's ctr_drbg.o now calls mbedtls_mutex_lock (pthread mutexes in
threading.o); the daemon's mbedtls_ctr_drbg_random calls the lock before and after its
work (objdump). tools/verify.sh: PASS (format unit build integration evidence). The
console run follows the deploy.
2026-10-07 16:04:38 -04:00
..