Skip to content

[16.0-stable] evetpm, newlogd and unit-test fixes - #6995

Merged
eriknordmark merged 8 commits into
lf-edge:16.0-stablefrom
eriknordmark:backports-2026-10-30-16.0-stable
Nov 2, 2026
Merged

eriknordmark merged 8 commits into
lf-edge:16.0-stablefrom
eriknordmark:backports-2026-10-30-16.0-stable

Conversation

@eriknordmark

@eriknordmark eriknordmark commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

Backport of #6691, #6839, #6953 to 16.0-stable, combined into one PR to save
CI runs. Every commit is cherry-picked with -x from master, in master merge
order:

Adaptations:

#6841 and #6760 are EVE-k changes and go to 17.0-stable only.

PR dependencies

None.

How to test and validate this PR

  • gofmt, go build ./... (with and without -tags k), go vet and
    go test of every touched pillar package, and of pkg/newlog/cmd, pass on
    this branch.
  • The evetpm tests run against swtpm (tests/tpm/prep-and-run.sh).
    TestDiskKeyPresentFailsOnTPMError fails on this branch when diskKeyPresent
    treats a TPM error as an absent key again.
  • Device-level validation is described in each source PR.

Changelog notes

  • A transient TPM error at boot no longer replaces the vault's disk key with a
    new one.
  • Device logs from the first seconds of boot are no longer lost while the log
    pipeline starts up.

PR Backports

Checklist

  • I've provided a proper description
  • I've added the proper documentation — no documentation change needed.
  • I've tested my PR on amd64 device — unit tests on this branch only; the
    device testing is on the source PRs.
  • I've tested my PR on arm64 device — not tested.
  • I've written the test verification instructions
  • I've set the proper labels to this PR — none apply to a backport.

For backport PRs:

  • I've added a reference link to the original PR

  • PR's title follows the template

  • I've checked the boxes above, or I've provided a good reason why I didn't
    check them.

🤖 Generated with Claude Code

eriknordmark and others added 8 commits October 30, 2026 11:53
When the vault key is fetched, a TPM error while checking for the sealed
disk key was read as "no key present", so EVE generated and sealed a
fresh key over the existing one. Data encrypted with the old key, such as
a reused etcd zvol after a kvm-to-k vault migration redo, then could not
be opened by any key. The check now distinguishes an undefined NV index
from a TPM error, retries the error twice with a log line per attempt,
and fails the fetch rather than generating a key if it persists. An index
that is defined but never written still counts as absent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: eriknordmark <erik@zededa.com>
(cherry picked from commit e3969c3)
Fetching the vault key must not take a TPM error for an absent key, or
it seals a fresh key over the one the vault is encrypted with. The tests
put a proxy between EVE and the TPM simulator that fails the disk-key
presence check while every other command, sealing included, keeps
working. A transient failure must yield the sealed key, and a persistent
one an error with the sealed key left in place. Against the earlier
presence check, the transient case replaces the key.

The proxy answers TPM_RC_NV_UNAVAILABLE rather than TPM_RC_RETRY because
go-tpm retries TPM_RC_RETRY itself and never returns it to the caller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: eriknordmark <erik@zededa.com>
(cherry picked from commit aaaaab0)
Vector creates its input sockets only once its topology is up, about
20 s into an EVE-k boot, while the services and pillar log their
startup. newlogd queued 1000 entries per socket and silently dropped
the rest, so the first 1000 log entries of a boot were followed by a
gap: 866 entries on one EVE-k boot, including everything nodeagent
logged before it published its status.

For the first 60 s after it starts writing to vector, newlogd now
waits for room in the queue instead of dropping. That stops it reading
from memlogd, whose ring buffer holds the backlog meanwhile. Once the
window ends a full queue drops as before, so a vector that never comes
up or stalls later cannot hold up logging for longer than that.

Signed-off-by: eriknordmark <erik@zededa.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 0353a11)
The dropped-message counter of the vector socket writer is incremented
by the logging goroutine when the buffer is full, by the writer
goroutine when a socket write fails, and read when deciding whether to
report drops, with no synchronization. Make it an atomic.Int64 so the
race detector stays quiet and the count stays exact.

Signed-off-by: eriknordmark <erik@zededa.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 0b6761e)
TestSingleEthInterface and TestSingleEthInterfaceWithIPv6 failed
intermittently on loaded CI runners, with DNS servers still reported
after the interface lost its addresses. One simulated interface update
publishes address, DNS and route events, and the first of them wakes
the test. The reconciler's watcher picks randomly between a queued
event and the pause request from Reconcile, so Reconcile could run
before the DNS change was processed and skip the DNS state.

Wait until the watcher has received every published event before
reconciling. The mock network monitor reports the number of events
still queued for its subscribers for this purpose.

Signed-off-by: eriknordmark <erik@zededa.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 5c2a208)
TestManageStatFileSizeTargetSizesAvgThreshold asserted that rewriting a
6.8 MB stat file takes under 5 s. Under -race on a loaded CI runner it
sometimes does not, failing the test although the trimmed file is
correct. The test checks the result, which is what it is for; log the
duration and drop the bound.

Signed-off-by: eriknordmark <erik@zededa.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 30428f1)
Probe latency is measured in real time around the mock's simulated
RTT, so a slow scheduler only inflates it, and the fixed headroom the
tests allowed was exceeded on loaded CI runners. A probe that outlasts
UserProbeTimeout fails instead of reporting latency, so use that as
the upper bound.

Signed-off-by: eriknordmark <erik@zededa.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 50fd414)
The send and verify tests reached google.com and postman-echo.com, so
a slow resolver or a CI runner without Internet access failed them; a
5 s DNS timeout did so on CI. Serve them from an httptest TLS server
bound to the port's IPv4 address instead. The URL is an IP literal,
so these tests no longer exercise DNS resolution.

Signed-off-by: eriknordmark <erik@zededa.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit b81f434)
@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 33.07%. Comparing base (5028d41) to head (b586c54).
⚠️ Report is 47 commits behind head on 16.0-stable.

Files with missing lines Patch % Lines
pkg/pillar/evetpm/tpm.go 88.00% 3 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           16.0-stable    #6995      +/-   ##
===============================================
+ Coverage        31.67%   33.07%   +1.39%     
===============================================
  Files               10       25      +15     
  Lines             1026     3988    +2962     
===============================================
+ Hits               325     1319     +994     
- Misses             701     2669    +1968     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@eriknordmark
eriknordmark requested review from rene and removed request for christoph-zededa, deitch, europaul, naiming-zededa, rucoder and shjala October 30, 2026 20:36
@eriknordmark
eriknordmark marked this pull request as ready for review October 30, 2026 20:36

@rene rene 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.

LGTM

@eriknordmark
eriknordmark merged commit 8b2b5e0 into lf-edge:16.0-stable Nov 2, 2026
69 of 72 checks passed
@eriknordmark
eriknordmark deleted the backports-2026-10-30-16.0-stable branch November 6, 2026 10:35
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