Skip to content

fix: validate DBD::DBM MLDBM serializer before lock file is created - #201

Merged
Tux merged 1 commit into
masterfrom
rrwo/fix-mldbm-lock
Oct 17, 2026
Merged

Tux merged 1 commit into
masterfrom
rrwo/fix-mldbm-lock

Conversation

@robrwo

@robrwo robrwo commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

This was a bug introduced by the fix for CVE-2026-78030.

The exception unwound DBI::DBD::SqlEngine::Table::new before the Table object was blessed, so no DESTROY ever releases the lock, while $meta (with the open, locked lockfh) stays cached in $dbh->{sql_meta}{t_ser}. The next open of the table opens a second descriptor on the same .lck and blocks in flock() -- forever, because the holder is the same process.

Why only the Gofer variant hung: in plain mode the DROP reuses the same $meta, so DBD::File's $meta->{lockfh} = $fh drops the old handle (and with it the lock) just before it calls flock. Under Gofer the DROP is served by a different server-side dbh with its own fresh $meta, so the stale handle is never replaced. The same thing happens without Gofer for any second handle or any second process: a separate process doing SELECT * FROM t_ser blocks until the first process exits (measured on 1.652, 1.655 and master).

This change also factors out code for releasing the lock into a separate method that is used by DESTROY.

The version for DBD::File is bumped.

Assisted-By: Claude Mythos 5.1 noreply@anthropic.com

@robrwo
robrwo requested a review from Tux October 17, 2026 11:31
…CVE-2026-111879)

This was a bug introduced by the fix for CVE-2026-78030.

The exception unwound DBI::DBD::SqlEngine::Table::new before the Table object
was blessed, so no DESTROY ever releases the lock, while $meta (with the
open, locked lockfh) stays cached in $dbh->{sql_meta}{t_ser}. The next
open of the table opens a second descriptor on the same .lck and blocks in
flock() -- forever, because the holder is the same process.

Why only the Gofer variant hung: in plain mode the DROP reuses the same
$meta, so DBD::File's $meta->{lockfh} = $fh drops the old handle (and
with it the lock) just before it calls flock. Under Gofer the DROP is
served by a different server-side dbh with its own fresh $meta, so the
stale handle is never replaced. The same thing happens without Gofer for
any second handle or any second process: a separate process doing
SELECT * FROM t_ser blocks until the first process exits (measured on
1.652, 1.655 and master).

This change also factors out code for releasing the lock into a separate
method that is used by DESTROY.

The version for DBD::File is bumped.

Assisted-By: Claude Mythos 5.1 <noreply@anthropic.com>

Signed-off-by: Robert Rothenberg <perl@rhizomnic.com>
@robrwo
robrwo force-pushed the rrwo/fix-mldbm-lock branch from 6fa62b0 to 99bbf2a Compare October 17, 2026 11:43

@Tux Tux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll fix the style in DBD::File

@Tux
Tux merged commit aab4231 into master Oct 17, 2026
34 checks passed
@robrwo
robrwo deleted the rrwo/fix-mldbm-lock branch October 18, 2026 11:01
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.

2 participants