Skip to content

just check cannot pass inside the recommended nix develop shell: the probe pins llc by SHA-256, nixpkgs rewrites it #1211

Closed

Description

@almightychang

After #1209 / #1210 makes the flake usable again, just check still cannot pass in the nix develop environment recommended by CONTRIBUTING.md:123. The intrinsics probe requires the rust-toolchain llc binary to match the catalog's SHA-256, but nixpkgs rewrites that ELF.

In the fixed shell, just check passes fmt-check, clippy, test, test-cuda, and all of check-guards. It then fails in check-intrinsics at Justfile line 131, on cargo run -p cuda-intrinsics-gen -- probe --all --skip-terminal:

error: validate probe backend for abs_bf16x2: rust-toolchain llc SHA-256 mismatch: selected evidence records 2e5bc688625ca7d98bca9b5f0f0d14525d2eb59e8a9842964e480df3ffd1f921, found ca7af83e237af640fe337faff2eff49055988921933186ab5535b38addeb7b49; use an explicit `--llc` only for a comparison probe

intrinsics/catalog.json records profile rust-llvm-23.1.0-16696adc, version LLVM version 23.1.0-rust-1.100.0-nightly, and SHA-256 2e5bc688...f921. The nightly-2026-08-28 rustup llc hashes to 2e5bc688625ca7d9... and is byte-identical to the cataloged binary.

The Nix shell supplies the same nightly and LLVM version. Its llc symlinks into /nix/store/...-llvm-tools-preview-1.100.0-nightly-2026-08-28-x86_64-unknown-linux-gnu/... and reports LLVM version 23.1.0-rust-1.100.0-nightly. Nixpkgs rewrites its interpreter to /nix/store/fjkx1l5cnskzrqacf08z7i8z17256w0j-glibc-2.42-61/lib/ld-linux-x86-64.so.2 and adds an RPATH into /nix/store/..., producing ca7af83e... instead.

The compiler identity matches, but the bytes cannot. Every nix develop shell therefore fails this validation, and neither a lock nor toolchain bump can align the hashes. The failure is only reachable after the flake fix because the current main shell does not start. The diagnostic also reserves --llc for comparison probes, so another binary is not the intended escape.

The policy choice is whether validation should recognize a patched-but-identical toolchain or whether the recommended Nix environment should supply bytes matching the recorded artifact. The maintainers should decide which identity the probe must enforce.

Activity

  1. nihalpasham commented on Sep 3, 2026

    @nihalpasham
    Collaborator

    Confirmed on main: the probe hashes the whole llc file (probe.rs validate_backend_identity), and the rustup nightly-2026-08-28 llc here is your 2e5bc688 byte for byte. The bytes are the wrong identity, and not only for Nix.

    • That llc is a 281 KB driver. The NVPTX lowering lives in libLLVM.so.23.1-rust-1.100.0-nightly (208 MB), which nothing hashes. So the SHA records which binary produced the evidence; the real check is already the emitted PTX matching the catalog's expected instruction on every probe.
    • patchelf (the Nix step that rewrites where a binary finds its loader and libraries) leaves the code untouched. Same compiler, new hash.
    • Plain rustup on aarch64 Linux (the flake lists it) hits the same wall: same LLVM, different bytes.
    • Version string alone is too coarse: every nightly in the 1.100.0 cycle prints 23.1.0-rust-1.100.0-nightly, and Rust bumps its LLVM inside a cycle.
    enforced identity                  rustup x86_64  nix   aarch64  tells nightlies apart
    llc file SHA-256 (today)           ok             fail  fail     unreliably (driver bytes only)
    llc --version alone                ok             ok    ok       no
    llc --version + rustc commit-hash  ok             ok    ok       yes
    

    My lean, as one PR:

    • llvm_nvptx evidence gains backend_toolchain_commit = rustc -vV commit-hash; the resolver requires it for that kind (missing = loud failure, no silent downgrade). backend_sha256 stays recorded and printed as provenance.
    • validate_backend_identity checks version + commit in the default run (the one that validates committed evidence; --llc comparison runs stay unchecked as today). rust_toolchain_llc already parses rustc -vV, so this is one more line read.
    • tests: same commit + different bytes passes; different commit fails; different version fails; evidence without the field fails at resolve time.
    • before/after: the probe's first output line under rustup and under nix develop. catalog.json changes, so re-run bash scripts/check-book-catalog-stamp.sh after the final commit, and update the two comments that describe the gate (Justfile check-intrinsics, unit-tests.yml).
    • also fine: a structured [rust_toolchain] commit_hash in intrinsics/upstream.lock (the resolver already checks evidence against that file) compared by the probe, one field in one file, no catalog.json churn. Pick whichever you prefer and say so in the PR.
    • no Nix CI lane, per fix(nix): advance the rust-overlay pin to the toolchain's nightly, and gate the flake in CI #1210. Criteria: https://discord.com/channels/1515530041767759993/1515561621156663487/1540970771323551775

    I do not run Nix, so the Nix-side pass is yours to show. Of your three open asks with me, this one goes first (#1189 and #1213 follow, one series at a time). Do you want to send this PR?

  2. almightychang commented on Sep 3, 2026

    @almightychang
    ContributorAuthor

    Yes. Sent as #1227, taking the upstream.lock placement: a required [rust_toolchain] commit_hash compared by the probe, evidence and catalog.json untouched (backend_sha256 stays as printed provenance). The lock already pins what the evidence was built from and its [llvm] provenance line already named this commit in prose; rust-toolchain.toml pins one channel for the whole repository and the probe runs every record under it, so the commit is a repository-level fact rather than a per-evidence field. The PR body has the before/after first lines under rustup and nix develop, and just check run as one command inside nix develop passes.

  3. added a commit that references this issue on Sep 6, 2026
    ef48b17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions