Skip to content

stamped build-ID is per-commit, so all 7 released binaries share one ID — symbol upload still unsafe (follow-up to #651) #653

Closed

Description

@bpalermo

Summary

#651/#652 fixed build-to-build build-ID constancy, but introduced (or rather, left) a binary-to-binary collision: because the ID is stamped to the commit SHA, every binary produced by a given commit shares one build-ID. Verified against the artifacts published from 4aabff27ace47e82c0df2e637e99e253442dc5a8:

binary image GNU build-ID
agent (multi-call) agent@sha256:47fa37d8… 4aabff27ace47e82c0df2e637e99e253442dc5a8
mesh-dns mesh-dns@sha256:2e186f02… same
registrar registrar@sha256:b3fc0d97… same
controller controller@sha256:47a3383b… same
cni-install cni-install@sha256:bee97fb5… same
aether-cni (plugin) same image, /opt/cni/bin/ same
envoy (custom proxy) aether-proxy:4aabff27… same

Seven different ELFs, one ID.

Why this blocks the original goal

The whole point of #651 was Pyroscope symbol upload, which is keyed solely by GNU build-ID. With seven binaries sharing an ID, uploading debuginfo for any one of them makes the symbolizer resolve all seven against that binary's symbol table — six of them wrong, silently, with plausible-looking function names. That is strictly worse than no symbols.

Concretely: symbol upload is blocked today. I did not upload the 4aabff2 artifacts for this reason (the previously-poisoned 498919af… upload is already deleted; the still-valid 15e3b073… proxy upload predates the stamp and is unaffected).

Note this also means the pre-#652 collision was worse than #651 documented: 498919af… was shared by all Go binaries, not just successive builds of one.

Fix: make the ID per-binary, not per-commit

The GNU build-ID is specified as a unique identifier for a linked object, not for a source revision. Upstream Envoy's commit-SHA convention works for them only because they ship one binary per commit.

Options, best first:

  1. Content hash (--build-id=sha1 semantics). Canonical, self-verifying, matches debuginfod conventions, and unique by construction. For the proxy this is a one-word change to the ldscript approach (drop stamped=True, pass --build-id=sha1). For Go, tools/buildid already rewrites the note post-link — have it write sha1(binary bytes with the note zeroed) instead of the commit.
  2. Keep the stamp but namespace it per target: sha1(commit_sha || target_label). Preserves "derivable from the release commit" (nice for automation: you can compute the expected ID for a given release+binary without the artifact) at the cost of not being self-verifying.

Either satisfies the property CI should assert, which the current guard does not: no two released binaries from the same build may share a build-ID. //tools/buildid:release_build_ids currently checks each ID equals the stamp — which is exactly the condition that guarantees the collision. That assertion needs inverting to pairwise-distinctness (plus, under option 2, equality to the expected per-target derivation).

Acceptance

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