Skip to content

pppd: clear pppdb after closing it in the forked child - #637

Closed
wdecarne wants to merge 1 commit into
ppp-project:masterfrom
wdecarne:patch-1
Closed

wdecarne wants to merge 1 commit into
ppp-project:masterfrom
wdecarne:patch-1

Conversation

@wdecarne

Copy link
Copy Markdown

When TDB support is enabled, ppp_safe_fork() closes the child's TDB context but leaves pppdb pointing to the freed context.

Before executing a script, run_program() calls ppp_script_setenv() to set PPP_SCRIPT_INSTANCE. This can access the closed TDB context through update_db_entry(), resulting in tdb_store failed: Locking error messages and potentially a crash.

Set pppdb to NULL after closing it in the child to prevent further access.

Tested by applying the patch to pppd 2.5.4 on Gentoo, rebuilding from source, and rebooting. The previously observed TDB locking errors no longer appeared. Shutdown and reconnection paths have not yet been separately verified.

Diagnosis and patch proposed by OpenAI ChatGPT (Codex), reviewed and tested by me.

Fixes #636

Signed-off-by: Werner de Carne <werner@carne.de>

@jkroonza jkroonza left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me.

@jkroonza

Copy link
Copy Markdown
Contributor

Let's please close this in preference of #638

@wdecarne

Copy link
Copy Markdown
Author

Fix in #638

@wdecarne wdecarne closed this Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

pppd 2.5.4: dangling pppdb pointer in script child causes TDB locking errors

2 participants