Skip to content

Fix checkpoint retries stuck on a rejected snapshot - #3727

Open
Ferran Pons Serra (ferponse) wants to merge 1 commit into
agent-substrate:mainfrom
ferponse:fix/reuse-checkpoint-validate-names
Open

Ferran Pons Serra (ferponse) wants to merge 1 commit into
agent-substrate:mainfrom
ferponse:fix/reuse-checkpoint-validate-names

Conversation

@ferponse

Copy link
Copy Markdown

ReuseCheckpoint accepted snapshot names from the completion marker that atelet then rejected. os.Stat follows symlinks, and filepath.Join accepts .., so the list can name a file outside the checkpoint directory. atelet rejects that list, the marker stays, and the next CheckpointWorkload returns the same list.

Names now have to pass ValidateSnapshotFileNames, and os.Root.Lstat has to show a regular file. Any failure returns nil. gVisor and microVM CheckpointWorkload then take a fresh checkpoint, which clears the directory.

Before this change, TestReuseCheckpointSnapshotNames failed for a symlink, a symlink directory, a .. name, and a nested name. After it, go vet ./internal/ateworker/ is clean and go test -race -count=3 -shuffle=on ./internal/ateworker/ passes.

AI use: AI-assisted. An agent wrote the change and ran the tests above.

  • Tests pass
  • Docs updated

ReuseCheckpoint called os.Stat on names from the completion marker.
os.Stat follows symlinks, and filepath.Join lets ".." leave the
directory. The worker returned that list, atelet rejected it, and the
marker stayed, so a retry returned the same list. Check the names with
ValidateSnapshotFileNames and require a regular file from os.Root.Lstat.
A miss returns nil and the caller checkpoints again.

Signed-off-by: Ferran Pons Serra <ferranponsuniversidad@gmail.com>
Co-authored-by: Ferran Pons Serra <ferponse@users.noreply.github.com>

This branch has not been deployed

No deployments
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