Skip to content

Berkeley DB (libdb) 5.3.31

Choose a tag to compare

@gburd gburd released this 27 Jul 20:26

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_destroy NULL-deref (ENV alloc failed); __lock_getlocker_int NULL sh_locker from a >> vs >>= typo that broke the retry loop; __db_pgin/pgout empty-pgcookie deref; a __txn_end heap-use-after-free (locker freed after the detail it reads si_ref from). The malloc sweep now passes clean across 506 failure points under ASan.
  • Malformed/hostile-file hardening: SIGFPE on zero pagesize (__memp_fopen) and on minkey<2 (bt_cursor); heap OOB read copying out an on-page item with a bogus length (new __db_ret_okitem bounds-check at the one cursor-return chokepoint); OOB read on a corrupt log-record length (__log_valid); overflow-chain page guards.
  • btree: SR_SNAPSHOT graceful 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_include prototype-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.