Skip to content

EAI-8240: Fix diagnose emitting invalid UNKNOWN render-group remediation - #302

Open
r0x0r wants to merge 1 commit into
mainfrom
fix-diagnose-unknown-render-group
Open

EAI-8240: Fix diagnose emitting invalid UNKNOWN render-group remediation#302
r0x0r wants to merge 1 commit into
mainfrom
fix-diagnose-unknown-render-group

Conversation

@r0x0r

@r0x0r r0x0r commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

rocm diagnose built the render-group remediation command from the /dev/kfd owner group, obtained via stat -c %G /dev/kfd. When the device GID has no matching group name, stat prints the literal string UNKNOWN. The guard in check_4_render_group only rejected empty strings, so UNKNOWN flowed straight into the suggested fix:

sudo usermod -a -G UNKNOWN,video "$USER"

No group named UNKNOWN exists, so the command fails if a user copy-pastes it. The bad command appeared in the human-readable plan, the summary, and the machine-readable diagnose --json output.

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 literal UNKNOWN that stat -c %G emits when the GID has no name.

Fix

Reject UNKNOWN (case-insensitive) alongside empty values so the group falls back to render, matching the group that fix.rs hardcodes. The emitted command is now:

sudo usermod -a -G render,video "$USER"

This also unifies the group source so diagnose and fix no longer disagree.

Reproduction

On any container where /dev/kfd's GID is not mapped to a group name:

$ stat -c %G /dev/kfd
UNKNOWN

Before the fix, rocm diagnose (and --json) emitted the invalid UNKNOWN,video command.

Testing

  • Added regression test unknown_kfd_group_falls_back_to_render asserting the UNKNOWN GID produces the render fallback 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.

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>
@r0x0r
r0x0r requested a review from a team as a code owner August 24, 2026 08:40
@r0x0r
r0x0r requested a review from rominf August 24, 2026 08:40
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.

1 participant