fix(watchdog): arm pre-pivot and inherit the fd across the pivot#15
Open
ananthb wants to merge 1 commit into
Open
fix(watchdog): arm pre-pivot and inherit the fd across the pivot#15ananthb wants to merge 1 commit into
ananthb wants to merge 1 commit into
Conversation
The post-pivot supervisor reopened /dev/watchdog by path, but the pivoted rootfs's /dev doesn't expose the node, so arming failed and fell back to modprobe softdog — which also can't work: pivot_root keeps the running host kernel and the in-RAM rootfs has no softdog.ko for it. Seen on a box with a working wdat_wdt (ACPI WDAT) watchdog: post-pivot 'watchdog: cannot arm' aborted before the entrypoint (flatcar-install) ever ran. pivot_root doesn't change the kernel, so a watchdog opened before the pivot keeps ticking after it. ArmWatchdogPrePivot opens+arms /dev/watchdog on the host, clears FD_CLOEXEC, and the fd is handed to the supervisor across the exec via XMORPH_WATCHDOG_FD; the supervisor pets that same live device (AdoptWatchdog) instead of reopening by path. Armed right before the pivot so the un-petted window is just the mount sequence + exec, and disarmed on any abort before exec. Non-linux stubs added. Found dogfooding the enterprise->pwu1 Flatcar reprovision.
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.
Bug
Post-pivot, the supervisor reopened
/dev/watchdogby path, but xmorph's pivoted/devdoesn't expose the watchdog node, so arming failed and fell back tomodprobe softdog— which also can't work:pivot_rootkeeps the running host kernel, and the in-RAM rootfs has nosoftdog.kofor it. On a box with a perfectly goodwdat_wdt(ACPI WDAT) hardware watchdog, this aborted the run beforeflatcar-installever executed (found dogfooding the enterprise→pwu1 reprovision; the pre-fix run died atwatchdog: cannot arm post-pivot).Fix
pivot_rootdoesn't change the kernel, so a watchdog opened before the pivot keeps ticking after it. So:ArmWatchdogPrePivotopens + arms/dev/watchdogon the host/dev, sets the timeout, and clearsFD_CLOEXEC.pivot_rootand theexecinto the supervisor viaXMORPH_WATCHDOG_FD.AdoptWatchdogs that same live fd and pets it — no reopen by path, nosoftdog.The pre-pivot
EnsureWatchdogAvailablefail-fast check stays (validates while the old OS is fully alive).softdogremains only as a pre-pivot fallback, where it can load.Test
GOOS=linux go build ./...,go vet ./..., gofmt, nativepostpivot/config/logtests — all clean. Real-kernel behavior exercised on the enterprise reprovision.