-
Notifications
You must be signed in to change notification settings - Fork 271
feat: ARM64 runtime guards (SMT, CPU info, seccomp, UFFD) #2259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 4 commits
da3757b
064b1a6
32ed031
97e9af2
22e145a
2bb018d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,13 +22,31 @@ func Detect() (MachineInfo, error) { | |
| } | ||
|
|
||
| if len(info) > 0 { | ||
| if info[0].Family == "" || info[0].Model == "" { | ||
| family := info[0].Family | ||
| model := info[0].Model | ||
|
|
||
| // On ARM64, gopsutil doesn't populate Family/Model from /proc/cpuinfo. | ||
| // Provide fallback values so callers don't get an error. | ||
| // NOTE: Using a generic "arm64" family treats all ARM64 CPUs as compatible. | ||
| // This works for same-host snapshot restore but cross-host restore between | ||
| // different ARM CPU implementations (e.g. Graviton2 vs Graviton3) may fail. | ||
| // For finer granularity, consider using MIDR_EL1 register values. | ||
| if runtime.GOARCH == "arm64" { | ||
| if family == "" { | ||
| family = "arm64" | ||
| } | ||
| if model == "" { | ||
|
Comment on lines
+34
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 The ARM64 CPU family fallback at line 32 sets Extended reasoning...What the bug is In How it manifests On any ARM64 node where Why existing code does not prevent it There is no validation that Impact CPU family from How to fix Change line 32 from Step-by-step proof
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code uses family = "arm64" which is correct — it's a label for CPU family grouping consistent with runtime.GOARCH semantics, not the ARMv8 numeric family identifier. The PR description mentioning "8" was a mistake in the bot's interpretation.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How can we make sure that 2 different ARM CPUs are compatible?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a comment documenting this limitation. Using generic "arm64" family works for same-host snapshots. Cross-host restore between different ARM CPUs (e.g. Graviton2 vs Graviton3) may need MIDR_EL1 register values — noted as a follow-up.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a comment in the code documenting this limitation — generic arm64 family works for same-host, cross-host may need MIDR_EL1.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. btw what's in ModelName? Could using that for |
||
| model = "0" | ||
| } | ||
| } | ||
|
|
||
| if family == "" || model == "" { | ||
| return MachineInfo{}, fmt.Errorf("unable to detect CPU platform from CPU info: %+v", info[0]) | ||
| } | ||
|
|
||
| return MachineInfo{ | ||
| Family: info[0].Family, | ||
| Model: info[0].Model, | ||
| Family: family, | ||
| Model: model, | ||
| ModelName: info[0].ModelName, | ||
| Flags: info[0].Flags, | ||
| Arch: runtime.GOARCH, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.