Skip to content

[AUTOMATED] Suggest Rust signature profiles from stable compiler metadata - #1748

Merged
mahaloz merged 1 commit into
mainfrom
fix/rust-comment-profile-hint-2228
Nov 19, 2026
Merged

mahaloz merged 1 commit into
mainfrom
fix/rust-comment-profile-hint-2228

Conversation

@mahaloz

@mahaloz mahaloz commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

[AUTOMATED] Kuna’s opt-in Rust signature report omits a profile suggestion based on the ELF compiler metadata.

Download the two pinned ELF samples and four O3 signature banks
work=$(mktemp -d)
samples=https://raw.githubusercontent.com/angr/binaries/76ad9e296dde8f82b8ede93ce06a578cd1933639/tests/x86_64/rust/fmt_arguments
for v in 1.93.1 1.98.1; do
  curl -fsSL "$samples/fmtdemo-$v" -o "$work/fmtdemo-$v"
done
chmod 0444 "$work"/fmtdemo-*
(cd "$work" && sha256sum --check --status <<'SHA256'
d0fa5f85392912679e5c38216ffc5382119eeb6fbf8de27ac95fb33b24e7fdfb  fmtdemo-1.93.1
1632b9f559c6a9c20bea2f3231ec45e1fda335f60a6e0938c27c4302a6798222  fmtdemo-1.98.1
SHA256
) || exit 1

pin=eaf9234448ced5800497d8ec2c565b186c9f65e4
banks=https://raw.githubusercontent.com/angr/flirt_signatures/$pin/x86_64/linux/rust
for bank in inline no-inline; do
  mkdir "$work/$bank"
  for v in 1.92.0 1.93.0; do
    curl -fsSL "$banks/$bank/$v-O3.sig" -o "$work/$bank/$v-O3.sig"
  done
done
cat > "$work/profiles.json" <<'JSON'
{
  "corpus": {
    "identity": "angr/flirt_signatures",
    "pin": "eaf9234448ced5800497d8ec2c565b186c9f65e4"
  },
  "candidates": [
    {"version": "1.92.0", "optimization": 3},
    {"version": "1.93.0", "optimization": 3}
  ],
  "signatures": [
    {"path": "inline/1.92.0-O3.sig", "version": "1.92.0", "optimization": 3, "bank": "inline",
     "sha256": "ebf8b73439e77e292fa0d4e085347a942761750c16e1001b93f09145deac4d23"},
    {"path": "no-inline/1.92.0-O3.sig", "version": "1.92.0", "optimization": 3, "bank": "no-inline",
     "sha256": "17ac475207ad89132c13cd287f3ee93dabca5e0652c8d4ae0698be927c0bc78f"},
    {"path": "inline/1.93.0-O3.sig", "version": "1.93.0", "optimization": 3, "bank": "inline",
     "sha256": "fc1deeecaa9928dcd92c929eb6265b8d440fa46eb5a4b04d8ecd246acad6f463"},
    {"path": "no-inline/1.93.0-O3.sig", "version": "1.93.0", "optimization": 3, "bank": "no-inline",
     "sha256": "0e5851432f6f34885ce3fb721b47dbb7371c827bbe46cd7abb12025696017635"}
  ]
}
JSON
for v in 1.93.1 1.98.1; do
  SLEIGHHOME="${SPECS:-specs}"     "${KUNA:-decompiler/target/release/kuna}" functions "$work/fmtdemo-$v" \
    --summary --json --jobs 1 --option flirt off --rust-signature-manifest "$work/profiles.json" |
    jq -c '
      (.summary.runtime[] | select(.id == "rust").version) as $rustc |
      .rust_signature_profile |
      {rustc:$rustc, status, selected:.selected_profile.version,
       ties:[.tied_profiles[].version], scores:[.candidates[].score]} +
      (if has("comment_profile_hint") then {comment_profile_hint} else {} end)'
done
{"rustc":"1.93.1","status":"unique","selected":"1.93.0","ties":[],"scores":[32,36]}
{"rustc":"1.98.1","status":"ambiguous","selected":null,"ties":["1.92.0","1.93.0"],"scores":[23,23]}

Fix

  • Suggest a complete O3 profile from consistent stable ELF .comment records. Use the closest same-minor patch at or below rustc, or the newest complete same-major profile when the compiler minor is newer than the requested range.
  • Signature scores still determine the selection and ties. Compiler identity continues to come from the ELF.
{"rustc":"1.93.1","status":"unique","selected":"1.93.0","ties":[],"scores":[32,36],"comment_profile_hint":{"basis":"same_minor","profile":{"optimization":3,"version":"1.93.0"}}}
{"rustc":"1.98.1","status":"ambiguous","selected":null,"ties":["1.92.0","1.93.0"],"scores":[23,23],"comment_profile_hint":{"basis":"newer_than_available","profile":{"optimization":3,"version":"1.93.0"}}}

Tests

The two pinned samples retain their unique match and 23–23 tie. Authored controls cover exact matches, incomplete banks, gaps, prereleases, conflicting records and a different major.

@mahaloz
mahaloz merged commit 87c6864 into main Nov 19, 2026
9 checks passed
@mahaloz
mahaloz deleted the fix/rust-comment-profile-hint-2228 branch November 19, 2026 07:35
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