EAI-8240: Fix diagnose emitting invalid UNKNOWN render-group remediation - #302
Open
r0x0r wants to merge 1 commit into
Open
EAI-8240: Fix diagnose emitting invalid UNKNOWN render-group remediation#302r0x0r wants to merge 1 commit into
r0x0r wants to merge 1 commit into
Conversation
check_4_render_group built the render-group remediation command from the /dev/kfd owner group obtained via `stat -c %G`. When the device GID has no matching group name, stat prints the literal "UNKNOWN", and the existing guard only rejected empty strings. That let UNKNOWN leak into the suggested fix, producing `sudo usermod -a -G UNKNOWN,video "$USER"` in the plan, summary, and --json output -- a command that fails because no such group exists. Reject "UNKNOWN" (case-insensitive) alongside empty values so the group falls back to "render", matching the group that fix.rs hardcodes. Add a regression test covering the UNKNOWN value producing the render fallback. Signed-off-by: Roman Sirokov <roman.sirokov@amd.com>
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.
Summary
rocm diagnosebuilt the render-group remediation command from the/dev/kfdowner group, obtained viastat -c %G /dev/kfd. When the device GID has no matching group name,statprints the literal stringUNKNOWN. The guard incheck_4_render_grouponly rejected empty strings, soUNKNOWNflowed straight into the suggested fix:No group named
UNKNOWNexists, so the command fails if a user copy-pastes it. The bad command appeared in the human-readable plan, the summary, and the machine-readablediagnose --jsonoutput.Root cause
In
crates/rocm-core/src/diagnose.rs(check_4_render_group), the group was selected with a filter that only rejects empty strings (!g.is_empty()), not the literalUNKNOWNthatstat -c %Gemits when the GID has no name.Fix
Reject
UNKNOWN(case-insensitive) alongside empty values so the group falls back torender, matching the group thatfix.rshardcodes. The emitted command is now:This also unifies the group source so
diagnoseandfixno longer disagree.Reproduction
On any container where
/dev/kfd's GID is not mapped to a group name:Before the fix,
rocm diagnose(and--json) emitted the invalidUNKNOWN,videocommand.Testing
unknown_kfd_group_falls_back_to_renderasserting theUNKNOWNGID produces therenderfallback and never appears in the command or summary.cargo test -p rocm-core diagnose::— all 23 diagnose tests pass.cargo clippy -p rocm-core --all-targets -- -D warnings— clean.