Skip to content

Fix bundled SQLite CVEs (rusqlite 0.34) and LMDB EINVAL failures on macOS - #2103

Open
erubboli wants to merge 4 commits into
masterfrom
fix_bundled_sqlite_cves_and_macos_lmdb
Open

Fix bundled SQLite CVEs (rusqlite 0.34) and LMDB EINVAL failures on macOS#2103
erubboli wants to merge 4 commits into
masterfrom
fix_bundled_sqlite_cves_and_macos_lmdb

Conversation

@erubboli

Copy link
Copy Markdown
Member

Summary

Dependency and platform fixes surfaced during routine dependency auditing.

1. Bump rusqlite 0.33.0 → 0.34.0 (libsqlite3-sys → 0.32.0)

  • libsqlite3-sys 0.32.0 bundles SQLite 3.49.1 (verified via SQLITE_VERSION
    in compiled build output); 0.31.0 bundled an older release.
  • Resolves upstream advisories CVE-2025-29030/-29031 for builds using the
    bundled feature (storage/sqlite).
  • Not remotely exploitable: requires local execution of crafted SQL or opening
    a maliciously crafted database file. Node operators should still update at
    their convenience.
  • cargo-vet trust entries are publisher-scoped, so no audits.toml change needed.

2. Fix LMDB failures on macOS (Invalid argument (os error 22))

  • On Darwin, lmdb defaults to System V semaphores; per-process kernel limits
    (kern.sysv.semume) cause semop(2) to fail once several DB environments
    are open concurrently in one process.
  • Fix: compile lmdb on Apple targets only with -DMDB_USE_POSIX_MUTEX=1 -DMDB_USE_ROBUST=0
    via target-scoped CFLAGS_*-apple-darwin in .cargo/config.toml.
    Linux/CI builds are untouched.
  • Documented trade-off: robust mutexes are unavailable on Darwin, so after a hard
    crash while holding an env lock, other processes may deadlock on that environment.

Testing

  • storage-lmdb backend suite: previously flaky on macOS → 45/45 green ×3 consecutive runs
  • cargo test --workspace --no-fail-fast: 202 suites, 3,014 passed, 0 failed

libsqlite3-sys 0.32.0 bundles SQLite 3.49.1, which fixes upstream
CVE-2025-29030/-29031 present in the previously bundled 3.48.0.
Relevant only to builds using the 'bundled' feature (storage/sqlite);
not remotely exploitable (requires local crafted SQL/DB file).
Darwin's default System V semaphore backend fails with EINVAL once a
process holds locks on more than kern.sysv.semume (=10) semaphore sets
concurrently, breaking workloads that open multiple DB environments in
one process (e.g. the storage-lmdb test suite).

Compile lmdb with MDB_USE_POSIX_MUTEX=1 on Apple targets via target-
scoped CFLAGS in .cargo/config.toml; MDB_USE_ROBUST must be disabled
because Darwin does not implement robust mutexes. Linux builds keep
upstream defaults.
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