java-topology/whitepaper/outreach/ompi.md
russell@unturf.com 652608142a feat: close outreach doc gap — 276 docs (batches 11-16)
All projects with patches now have outreach docs. 276 new docs covering
CWE-407, CWE-312, CWE-362 across C, C++, Java, Python, Go, Rust, C#,
PHP, Ruby, JavaScript, Dart, Erlang, R, and more.

Outreach gap: 276 -> 0.
2026-04-15 13:57:42 -04:00

2.7 KiB
Raw Permalink Blame History

Open MPI — CWE-407 Disclosure Brief (ompi-0001)

2026-04-13 · Patch available — awaiting upstream merge

Finding

Three O(N × M) defects in Open MPI's group operations. All patched. ompi_group_translate_ranks(), ompi_group_intersection(), and ompi_group_overlap() use nested linear scans for process name matching, producing O(N × M) behavior at HPC scale.

The Defects

ompi-0001 (PATCHED — CRITICAL): ompi/group/group.c

  1. ompi_group_translate_ranks() (line 98):
for (int proc = 0; proc < n_ranks; ++proc) {
    for (int proc2 = 0; proc2 < group2->grp_proc_count; ++proc2) {
        if (0 == opal_compare_proc(proc1_name, proc2_name)) {
            ranks2[proc] = proc2;
            break;
        }
    }
}
  1. ompi_group_intersection() (line 453): Same nested-loop pattern.

  2. ompi_group_overlap() (line 629): Same nested-loop pattern.

All three iterate group2 linearly for every element in group1. With N processes in group1 and M in group2, cost: O(N × M).

Complexity Proof

At N=M=10,000 processes:

  • Defective: 10,000 × 10,000 = 100,000,000 process name comparisons
  • Fixed: 10,000 (hash build) + 10,000 × O(1) = 20,000 operations
  • 5,000× op reduction at 10,000 processes.

Impact

Open MPI is one of the two major MPI implementations used across the world's supercomputers. Group operations fire during communicator creation, which happens at application startup, sub-communicator creation, and dynamic process management. At HPC scale (tens of thousands of processes), the quadratic cost in group operations creates significant overhead.

The Fix

Build a reverse hash table of group2 (process name -> rank) for O(1) lookup:

// Before: O(N*M) nested loops
for (proc2 = 0; proc2 < group2->grp_proc_count; ++proc2) {
    if (0 == opal_compare_proc(proc1_name, proc2_name)) { ... }
}

// After: O(1) hash lookup
opal_hash_table_t *g2_ht = OBJ_NEW(opal_hash_table_t);
// key = (jobid << 32) | vpid
opal_hash_table_get_value_uint64(g2_ht, key, &val);

Patch

Fix available: defects/ompi/patch/ompi-0001-group-ops-process-name-hashmap.patch

Touches ompi/group/group.c. Uses existing opal_hash_table infrastructure. 5,000× speedup at 10,000 processes.

What We Ask

A patch is ready for review.

  1. Confirm receipt and assign a GitHub issue reference (open-mpi/ompi).
  2. Assess severity — fires during communicator creation at HPC scale.
  3. Coordinate a disclosure date — we are targeting 90 days from first contact.
  4. We will credit the Open MPI team in the public disclosure. Preferred acknowledgment format welcome.

Contact: see cover email. This brief is confidential until coordinated disclosure.