Skip to content

fix(rdc): initialize topology subcommand option state - #13694

Merged
adam360x merged 1 commit into
developfrom
users/adam360x/rdci-topo-option-init
Oct 19, 2026
Merged

adam360x merged 1 commit into
developfrom
users/adam360x/rdci-topo-option-init

Conversation

@adam360x

Copy link
Copy Markdown
Contributor

Motivation

rdci topo without -i should stop with "Need to specify the group index to notify". The
constructor of RdciTopologyLinkSubSystem left the group index and its "was set" flag
uninitialized, so on a dirty heap the check read garbage as "index given". rdci then skipped it
and asked rdcd for the topology of an undefined GPU index. Depending on the garbage, that printed
the topology of an arbitrary GPU or an unrelated error.

Technical Details

  • Initialize group_index_ and is_group_index_set in the constructor, as the group subcommand
    already does.
  • New CI test TestCLIUsage::test_topo_without_gpu_index in tests/ci/test_rdc_core.py. It runs
    rdci topo without -i with MALLOC_PERTURB_ set, so new heap memory is nonzero. It needs no
    GPU or daemon because rdci checks the options before it connects.
  • CHANGELOG entry under Resolved Issues.

No overlap with #13386, which changes RdciTopologyLinkSubSystem::process() in the same file.
Trial merges with the open RDC PRs that touch the same files (#13386, #13570, #13658) are clean.

Issue Tracking

No ticket. Found during a code review; valgrind and MALLOC_PERTURB_ confirmed it.

Test Plan

  • Run the new test against an rdci built with and without the fix (ASan Debug build, whose
    allocator also fills new memory with nonzero bytes).
  • Run the whole TestCLIUsage class with the fix.
  • Run RDC pre-commit on the changed files.

Test Result

  • Without the fix: the test fails, rdci exits 8 instead of 5 (RDC_ST_BAD_PARAMETER).
  • With the fix: the test passes, and TestCLIUsage passes 16/16.
  • Pre-commit: all hooks pass.

Submission Checklist

- Initialize the group index and its "was set" flag in the constructor so
  the "need to specify the group index" check cannot be skipped.
- Both members were read before assignment, so with a dirty heap the
  validation was bypassed and an indeterminate index reached the
  topology query; confirmed by valgrind and by MALLOC_PERTURB_.
- Matches the initialization already done by the group subcommand.
- Add a CI test that runs rdci topo without -i on a dirty heap, and a
  changelog entry.

Signed-off-by: Adam360x <Adam.pryor@amd.com>
@adam360x
adam360x requested review from a team as code owners October 18, 2026 06:19
Copilot AI balanced review requested due to automatic review settings October 18, 2026 06:19
@therock-pr-bot

Copy link
Copy Markdown

✅ All Policy Checks Passed

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ✅ Pass —
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —

🎉 All policy checks passed!

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused initialization fix has regression coverage, and no blocking issues were identified.

No open issues 🎉

What changed in this PR

Fixes uninitialized topology option state so rdci topo reliably rejects a missing GPU index before connecting to the daemon.

Changes:

  • Initializes the index and its presence flag.
  • Adds a regression test using nonzero heap memory.
  • Documents the fix in the changelog.
File Description
projects/​rdc/​tests/​ci/​test_rdc_core.py Tests rejection of a missing GPU index.
projects/​rdc/​rdci/​src/​RdciTopologyLinkSubSystem.cc Initializes topology option state.
projects/​rdc/​CHANGELOG.md Records the corrected behavior.

Review effort: Balanced

@adam360x
adam360x merged commit 8800425 into develop Oct 19, 2026
124 of 136 checks passed
@adam360x
adam360x deleted the users/adam360x/rdci-topo-option-init branch October 19, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants