Berkeley DB (libdb) 5.3.31
Testing-and-hardening release. A multi-tier test program — DST (FoundationDB/TigerBeetle-style deterministic simulation), property-based testing (Hegel), fuzzing (libFuzzer), malloc-fault injection (SQLite-style), Coccinelle convention + ABI-drift checks, and coverage measurement — found and fixed ten genuine engine bugs.
Bug fixes (all found by the new harnesses)
- mpool/crypto: two mutex leaks on OOM paths (
__memp_register,__db_generate_iv) that wedged a core mutex forever on ENOMEM. - OOM error paths:
__db_env_destroyNULL-deref (ENV alloc failed);__lock_getlocker_intNULLsh_lockerfrom a>>vs>>=typo that broke the retry loop;__db_pgin/pgoutempty-pgcookie deref; a__txn_endheap-use-after-free (locker freed after the detail it readssi_reffrom). The malloc sweep now passes clean across 506 failure points under ASan. - Malformed/hostile-file hardening: SIGFPE on zero pagesize (
__memp_fopen) and onminkey<2(bt_cursor); heap OOB read copying out an on-page item with a bogus length (new__db_ret_okitembounds-check at the one cursor-return chokepoint); OOB read on a corrupt log-record length (__log_valid); overflow-chain page guards. - btree:
SR_SNAPSHOTgraceful stale-restart in the lock-free root-snapshot read descent.
New testing infrastructure (advisory-gated in CI)
- DST (
--enable-dst): write-back durable-frontier crash model, 3 planted durability bugs each caught at seed 1, 14 deterministic scenarios across all four access methods + WAL/recovery/checkpoint. Zero overhead when off. - PBT (
test/pbt, Hegel), fuzzing (test/fuzz), malloc-fault injection (test/faultinject), Coccinelle (dist/cocci, 97.5% call-site recall + libabigail ABI-diff). - Coverage (
test/coverage): baseline raised from 18.6%/12.3% to 26.9%/17.8% (line/branch) by exercising the previously-untested hash/queue/recno/heap access methods and verify/salvage paths. - CI: TSan, compiler-warnings gate, mutex-backend matrix, nightly extended suite; OCR with Berkeley DB domain steering;
s_includeprototype-generation hardened.
Known issue
A pre-existing resource leak on the DB_PRIVATE region-teardown error path when opening a corrupt file (a leak, not a memory-safety fault); tracked for follow-up. No memory-safety crashes remain under the fuzzers.