Skip to content

fix(cargo-oxide): install the cached backend by rename, not in place - #1329

Open
midagedev wants to merge 1 commit into
NVIDIA:mainfrom
midagedev:fix/atomic-backend-install
Open

midagedev wants to merge 1 commit into
NVIDIA:mainfrom
midagedev:fix/atomic-backend-install

Conversation

@midagedev

@midagedev midagedev commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

install_backend_into copies over the cached .so with fs::copy. That rewrites the same inode, so a rustc that loaded it can die with SIGBUS. Two parallel cargo oxide build runs hit this.

Changes

  • Copy to a temporary file in the cache dir, then fs::rename it over the .so. On error, remove it.
  • Tests: an open handle keeps the old bytes and inode; a failed copy or rename leaves no temporary file.

Testing

Verified at f4a5ec9e: 242 cargo-oxide host tests, Clippy, fmt, doc, guards. A reader that mmaps the .so during a second cargo oxide setup: SIGBUS 3/3 before, 0/3 after. Not run: just check, examples.

AI (Claude) helped write this change.

  • just check passes (the local mirror of CI: fmt, clippy, tests, guards, docs)
  • cargo oxide run <example> passes, or scripts/smoketest.sh -o '^<example>$'
  • New example added (if applicable)

Checklist

  • All commits signed off (git commit -s)
  • SPDX headers on new source files

@midagedev
midagedev force-pushed the fix/atomic-backend-install branch from cada00a to f4a5ec9 Compare September 25, 2026 00:13
install_backend_into copied the new backend over the cached .so with
fs::copy. That truncates and rewrites the same inode, so a rustc that
already loaded the old file can die with SIGBUS.

Copy to a temporary file in the cache dir, then rename it over the .so.
If the copy or the rename fails, remove the temporary file and return
the error.

Tests: an open handle keeps reading the old bytes and inode after an
install; a failed copy or rename leaves the old .so and no temporary
file.

Signed-off-by: midagedev <midagedev@gmail.com>
@midagedev
midagedev force-pushed the fix/atomic-backend-install branch from f4a5ec9 to 95d1174 Compare October 8, 2026 02:44
@midagedev
midagedev requested a review from nihalpasham as a code owner October 8, 2026 02:44
@copy-pr-bot

copy-pr-bot Bot commented Oct 8, 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.

@nihalpasham nihalpasham added the cuda-oxide SIMT programming model: rustc backend, cargo oxide, cuda-device, cuda-host, book label Oct 11, 2026

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

cuda-oxide SIMT programming model: rustc backend, cargo oxide, cuda-device, cuda-host, book

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants