Repository navigation
Let the crash watchdog write to FTL.log through a copy of its path - #3354
Merged
DL6ER merged 1 commit intoNov 22, 2026
Merged
Conversation
DL6ER
requested changes
Nov 13, 2026
DL6ER
left a comment
Member
There was a problem hiding this comment.
PATH_MAX needs #include <limits.h> in log.c. musl provides it through another header, glibc does not, so the CodeQL build fails:
src/log.c:41:30: error: 'PATH_MAX' undeclared here (not in a function)
`log_ftl_raw()` opened `config.files.log.ftl.v.s`, but `cleanup()` frees that string when FTL.log is not at the default path (set in pihole.toml or through `FTLCONF_files_log_ftl`). The crash watchdog writes its line after `cleanup()`, when `exit()` hangs, so it read freed memory, and the one line explaining the forced exit could get lost or, in theory, go to another file. `start_crash_watchdog()` now copies the path into a static buffer, which `log_ftl_raw()` uses. The path does not change while FTL runs. Signed-off-by: 010011110 <duckenheim@posteo.de>
010011110
force-pushed
the
v6.9-crash-watchdog-log-path
branch
from
November 18, 2026 13:04
bf4cf33 to
f06fb05
Compare
Contributor
Author
|
thanks, added the limits.h include to log.c, a glibc build of it passes now |
DL6ER
approved these changes
Nov 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this implement/fix?
for a v6.9.x, this is against master because development does not have the bug: its logger keeps its own file descriptor and cleanup() no longer frees the path
log_ftl_raw() opens config.files.log.ftl.v.s, but cleanup() frees that string when FTL.log is not at the default path (files.log.ftl in pihole.toml or FTLCONF_files_log_ftl) and leaves the pointer set. the crash watchdog writes its "FTL did not shut down after the crash" line after cleanup(), in exactly the case it exists for (exit() hanging after a crash), so it opened FTL.log through freed memory. the line could get lost or, in theory, go to another file. start_crash_watchdog() now copies the path into a static buffer that log_ftl_raw() uses, the path does not change while FTL runs
no test, it needs a crash whose shutdown hangs with FTL.log at a non-default path, and the existing crash-thread test runs in CLI mode where log_ftl_raw() does nothing
How to test the change during review
read the diff, the watchdog line is written through the copy taken in start_crash_watchdog(), nothing reads config.files.log.ftl after cleanup() anymore
Additional information
Related issue or feature (if applicable): N/A
Pull request in docs with documentation (if applicable): N/A
By submitting this pull request, I confirm the following:
git rebase)src/dnsmasq/. That tree is a verbatim copy of upstream dnsmasq and we do not carry anything in it that deviates from upstream. Fixes have to go through thednsmasq-discussmailing list first, we merge them once they are in dnsmasq master.Checklist:
developmentbranch.