Skip to content

Fix boot time retrieval#1078

Merged
ansasaki merged 1 commit intokeylime:masterfrom
sarroutbi:202508141617-fix-boot-time-retrieval
Aug 14, 2025
Merged

Fix boot time retrieval#1078
ansasaki merged 1 commit intokeylime:masterfrom
sarroutbi:202508141617-fix-boot-time-retrieval

Conversation

@sarroutbi
Copy link
Copy Markdown
Contributor

@sarroutbi sarroutbi commented Aug 14, 2025

This patch correctly implements boot time retrieval for the Rust agent, replacing the temporary use of the current time with the actual system boot time.

  • New boot_time.rs Module: A new module was created to contain the logic for getting the system boot time. It works by parsing the btime field from the /proc/stat file, which is the standard method on Linux.

  • Updated Agent Payload: The agent no longer sends the current time (chrono::Utc::now()) as the boot_time. Instead, it now calls the new get_boot_time() function to provide the true boot time in its capabilities report.

  • Error Handling: If reading the boot time fails, the agent now logs an error and defaults to the Unix epoch (1970-01-01), ensuring the program doesn't crash.

@sarroutbi sarroutbi force-pushed the 202508141617-fix-boot-time-retrieval branch from cddf0c1 to 1ee9346 Compare August 14, 2025 14:19
Comment thread keylime-push-model-agent/src/struct_filler.rs Outdated
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
@sarroutbi sarroutbi force-pushed the 202508141617-fix-boot-time-retrieval branch from 1ee9346 to 4dae70c Compare August 14, 2025 15:07
@sarroutbi sarroutbi requested a review from ansasaki August 14, 2025 15:32
Copy link
Copy Markdown
Contributor

@ansasaki ansasaki left a comment

Choose a reason for hiding this comment

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

LGTM!

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 14, 2025

Codecov Report

❌ Patch coverage is 53.57143% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.99%. Comparing base (f17040d) to head (4dae70c).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
keylime/src/boot_time.rs 63.15% 7 Missing ⚠️
keylime-push-model-agent/src/struct_filler.rs 33.33% 6 Missing ⚠️
Additional details and impacted files
Flag Coverage Δ
e2e-testsuite 58.99% <53.57%> (-0.01%) ⬇️
upstream-unit-tests 58.99% <53.57%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
keylime-push-model-agent/src/struct_filler.rs 23.62% <33.33%> (+0.58%) ⬆️
keylime/src/boot_time.rs 63.15% <63.15%> (ø)

... and 4 files with indirect coverage changes

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

@ansasaki ansasaki merged commit fac6d6f into keylime:master Aug 14, 2025
11 of 13 checks passed
@sarroutbi sarroutbi deleted the 202508141617-fix-boot-time-retrieval branch August 14, 2025 16:33
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.

3 participants