Skip to content

fix(dist-checkpointing): AUT-1599 restrict PG cache unpickling - #6702

Open
svcnemo-autobot wants to merge 5 commits into
NVIDIA:mainfrom
svcnemo-autobot:fix/secure-pg-dist-cache-260819
Open

fix(dist-checkpointing): AUT-1599 restrict PG cache unpickling#6702
svcnemo-autobot wants to merge 5 commits into
NVIDIA:mainfrom
svcnemo-autobot:fix/secure-pg-dist-cache-260819

Conversation

@svcnemo-autobot

@svcnemo-autobot svcnemo-autobot commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Background

PG distribution caches are trusted metadata, but unrestricted pickle loading permits arbitrary global resolution.

What changed

  • Preserve the existing pickle format and atomic writer.
  • Load caches through a restricted unpickler.
  • Centralize the PG-cache allowlist and unpickler in safe_globals as requested.
  • Keep the PG-cache allowlist isolated from broader FP8 checkpoint globals.

Details

flowchart LR
  P[PG cache pickle] --> U[PG-specific safe unpickler]
  U -->|allowed metadata| C[cache objects]
  U -->|other globals| R[reject]
Loading

The branch remains based on frozen MCore pin 731b791469004f8fdcb896e65d610d6b1b0ebb32.

Tested

  • git diff --check
  • Prior exact-head 8-H100 PG-cache validation passed; renewed CI is pending for this refactor

@svcnemo-autobot
svcnemo-autobot requested review from a team as code owners August 20, 2026 11:43
@copy-pr-bot

copy-pr-bot Bot commented Aug 20, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@svcnvidia-nemo-ci
svcnvidia-nemo-ci marked this pull request as draft August 20, 2026 11:43
@github-actions

Copy link
Copy Markdown
Contributor

This PR has been automatically converted to draft because all PRs must start as drafts.

When you are ready for review, click Ready for Review to begin the review process. This will:

  1. Add the oncall reviewer (optional reviewer)
  2. Add required review teams based on your changes

See the contribution guide for more details.

@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test 2addad1

@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test 4046319

@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test 2f96975

# The cache contains only ShardDistribution, data-less ShardedTensor metadata,
# and primitive containers. Extend the project's restricted unpickler with
# exactly those globals instead of trusting the cache path with pickle.load.
_PG_DIST_CACHE_SAFE_CLASSES = frozenset(

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.

let's just extend existing frozen set for SafeUnpickler and then use SafeUnpickler(f).load()'. If it's not possible and we need a separate class here let's move _PG_DIST_CACHE_SAFE_CLASSES&_PgDistCacheUnpicklertomegatron.core.safe_globals` and import it from there.

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.

@svcnemo-autobot please address this feedback

Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test 840607c

@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test 737063f

Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test 2fb227d

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.

5 participants