mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[GH-ISSUE #137] Single-node CPU intersection bypasses KVM read-only leaf filtering and breaks sandbox creation #47
Labels
No labels
bug
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/AgentENV#47
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @feimingxliu on GitHub (Aug 7, 2026).
Original GitHub issue: https://github.com/kvcache-ai/AgentENV/issues/137
Affected component
Gateway / scheduler, with impact on the Firecracker runtime and observability CPU-template reporting.
AgentENV version
mainat00ba6cb74f309a0cbd65f6ec415640e9e674a371(v0.1.1-22-g00ba6cbaccording togit describe)Host environment
ublk_drvloaded and/dev/ublk-controlavailablev1.17.0-next.1from the PVM dependency manifestOperation and configuration
Steps to reproduce
cpu-template-helper.received cluster cpu config intersection from scheduler.cpu-template-helperunavailable/non-executable, restart the scheduler and node, and repeat the same sandbox creation. It succeeds.The failure reproduced consistently before disabling the helper. With the helper disabled, cold start, command execution, pause, resume, and memory-state preservation all succeeded.
Expected behavior
A CPU configuration returned by the scheduler should be safe to apply to Firecracker. A single-node cluster should still run the same sanitization that removes KVM read-only/dynamic CPUID leaves.
Actual behavior
Sandbox creation fails with HTTP 500. Firecracker returns:
Root cause
IntersectCpuConfigsreturns the only input unchanged when the cluster has one CPU report:github.com/kvcache-ai/AgentENV@00ba6cb74f/services/scheduler/internal/cpu_template.go (L46-L52)That bypasses JSON validation and the existing KVM read-only leaf filter. The same file already classifies leaf
0xBas read-only and removes it in the normal intersection path:github.com/kvcache-ai/AgentENV@00ba6cb74f/services/scheduler/internal/cpu_template.go (L83-L85)github.com/kvcache-ai/AgentENV@00ba6cb74f/services/scheduler/internal/cpu_template.go (L120-L135)The current single-input unit test explicitly requires byte-for-byte passthrough and does not include a read-only CPUID leaf:
github.com/kvcache-ai/AgentENV@00ba6cb74f/services/scheduler/internal/cpu_template_test.go (L54-L63)Why leaf
0xB, subleaf1appears in the dump:CPUID.(EAX=0BH, ECX=1)fromKVM_GET_SUPPORTED_CPUID.cpu-template-helper template dumpreads the already-configured vCPU and serializes every CPUID entry into custom-template JSON.Firecracker normalization source:
https://github.com/kvcache-ai/firecracker-next/blob/v1.17.0-next.1/src/vmm/src/cpu_config/x86_64/cpuid/normalize.rs#L265-L286
Helper dump conversion source:
https://github.com/kvcache-ai/firecracker-next/blob/v1.17.0-next.1/src/cpu-template-helper/src/template/dump/x86_64.rs#L18-L45
This was observed on PVM, but the control flow is not inherently PVM-specific. A recent standard KVM environment can be affected whenever its helper dump contains leaf
0xB.Suggested fix
len(jsons) == 1raw-return fast path, or pass a single input through a dedicated sanitizer before returning it.kvmReadOnlyLeafIDs, while preserving all safe fields unchanged.0xBand verify the output omits it.cpu-template-helper template verifybefore publishing a generated cluster template.Frequency
Always, with the described single-node configuration.
Regression information
8f028b1369a4ce9a66d140174d0a646e72398517)Additional context
The Firecracker documentation describes
template dumpas an entry point for creating a template and recommends stripping, reviewing, and verifying the result rather than replaying the raw dump directly:https://github.com/firecracker-microvm/firecracker/blob/main/docs/cpu_templates/cpu-template-helper.md
AgentENV automates the dump/intersection/replay flow, so it needs to perform the required sanitization itself for every cluster size.
Pre-submission checklist