Skip to content

Prevent CMP unlock buffer overruns after failed GSP bootstrap - #67

Closed
Galygious wants to merge 1 commit into
amoghmunikote:masterfrom
Galygious:cmp-signature-bounds-20261030
Closed

Galygious wants to merge 1 commit into
amoghmunikote:masterfrom
Galygious:cmp-signature-bounds-20261030

Conversation

@Galygious

Copy link
Copy Markdown

Summary

Reject CMP payload buffers that cannot hold the fixed-offset unlock payload, and stop unsafe initialization retries. A failed GSP bootstrap can otherwise re-enter the unlock pass after its 0xf800-byte descriptor has been replaced by the smaller stock signature descriptor.

Changes

  • Reject null/undersized buffers in the payload writer and undersized descriptors before mapping/refilling them; cap the initial fill at the payload extent.
  • Return an error if WPR_CFG, FBPA, WPR, or FEAT still fails register readback after the existing two attempts, before programming memory geometry. Booter return status alone is not treated as proof of unlock failure.
  • Keep NVIDIA's automatic bootstrap retry for other GPUs; skip it for the CMP unlock path once the stock signature has been restored.
  • Add an ASAN+UBSAN regression using the actual functions from the patch: zero/short/4 KiB/one-byte-short/null buffers, failed mapping, valid refill/metadata, and an oversized buffer with an untouched tail. Two valid payloads must match the complete pre-change golden bytes.

Testing

  • python3 -m pytest -v: 41 passed, including patch application on all six versions in driver/VERSION (610.43.02, 610.43.03, 610.57.04, 615.71.09, 615.71.10, 615.78.08).
  • Clean NVIDIA 615.78.08 source + the complete upstream patch order + this change: make -j4 modules SYSSRC=/lib/modules/7.0.14-26-pve/build CC=gcc exit 0. All five module versions/vermagic verified. These separately built modules were not installed or loaded.
  • Pre-change payload writer called with an actually allocated 4096-byte buffer: ASAN heap-buffer-overflow, first fixed-offset write 256 bytes beyond the allocation. The patched regression passes with no sanitizer error; valid payload bytes are unchanged.
  • Physical validation used our existing customized driver port, with the same payload bounds and primary-PLM checks and equivalent CMP no-retry behavior. After a clean maintenance boot: all three cards initialized, each completed a 61,504 MiB resident memory sweep with zero errors, integer CPU/GPU sums matched, BF16 output matched archived golden references, all 54 peer-content checks passed, and the existing LLM workload ran successfully. This PR branch has not been booted as a clean upstream installation; the 10GB/0x2082 variant is untested. Keeping the PR in draft makes that limit explicit.

Hardware tested on (if applicable):

  • GPU variant: 3 physical CMP 170HX 8GB / PCI device 0x20c2, each unlocked to 64 GiB; local setup runs at 175 W and PCIe Gen2 x4, ECC disabled.
  • PCIe slot / host: x86_64 Proxmox host; 0000:01:00.0, 0000:21:00.0, 0000:41:00.0.
  • Kernel / OS: 7.0.14-26-pve, Debian 13 / Proxmox VE 9.2 (pve-manager 9.2.24), NVIDIA 615.78.08.

The triggering observation came from upgrading a locally customized 610.57.04 driver: the initial 615.78.08 Booter returned 0x1c, then the retry path wrote fixed payload offsets through 0xf7f8 into a restored 4 KiB stock signature buffer. The host subsequently logged bad-page/page-table/vmalloc corruption. The unchecked writer and stock-signature/retry sequence are also present in current upstream master (2c7e2ec); the memory error is independently reproducible on the CPU.

For clarity, our successful local firmware workaround is separate and is not included in this PR: use the qualified 610.57.04 GA100 Booter only for the CMP privilege pass, then reallocate the current 615.78.08 Booter before normal GSP startup, with current 615.78.08 GSP firmware/userspace. That setup has additional local P2P/memory changes. It does not establish that every upstream 615.78.08 installation fails, or that the original 0x1c cause has been fully diagnosed.

This is also separate from CVE-2026-98432, which is a Linux IPv4/TCP lifetime bug fixed by a vendor-patched kernel and reboot, not by this unlocker change.

Comment thread tests/test_payload.py

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Won't be needing the test, please remove that.

@amoghmunikote

Copy link
Copy Markdown
Owner

No changes were made that I requested, closing this PR.

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.

2 participants