feat(harden): alien-emit rethink — CFG dispatch lite + native MBA pads - #332
Merged
Merged
Conversation
Beyond #296: wrap eligible straight-line bodies in while-_pc dispatchers, rotate harden prologue/junk-pad/MBA constant shapes, and wire junk pads before calls. Docs honesty updated; smoke objdump metrics refreshed.
|
Capy couldn't review this pull request because Max's workspace is out of credits, add credits or enable auto-reload to resume automatic reviews. |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_b5449b70-908c-4381-b8be-85245c48103d) |
|
Tick the box to add this pull request to the merge queue (same as
|
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
while _pc < Nstate machine for eligible straight-line bodies; skips loops/try/match/throw; avoidsBreakbecause native lower treats it as a no-op).^m,±m, dual-mask), rotating junk pads wired before calls (junk_pad was previously unused).docs/emit-profiles.mdhonesty; refreshes objdump/nm smoke metrics (harden object 2689→3109 bytes). Ghidra headless section retained from prior run (this host lacked GHIDRA_INSTALL_DIR).Test plan
cargo fmt(in-cli)cargo test --lib harden_/antidecomp/emit_profile/lower_simple_default_and_harden/core_opt::bash scripts/ghidra-antidecomp-smoke.sh(objdump/nm; Ghidra skipped on this host)Do not merge until CI green and parent says so.
Note
Medium Risk
Harden-only IR restructuring and codegen shape changes can affect semantics or ABI if dispatch eligibility or no-op pads are wrong; default/lean paths are unchanged but harden output is larger and harder to debug.
Overview
Extends the
hardenemit profile with lite CFG dispatch on Core IR and rotating native anti-decomp shapes, plus doc/benchmark refresh.IR (
core_opt): After existing harden passes, eligible straight-line function bodies (≥3 stmts, no loops/Break/try/match/throw) are rewritten into awhile _pc < Nloop with chainedif _pc == istates; large bodies are chunked (2 stmts per state when >8 stmts). Dispatcher exits by advancing_pcpastN—not viaBreak, which native lower still treats as a no-op. A unit test asserts_pc+ dispatcher loop appear underEmitProfile::Harden.Native (
antidecomp+x86_64_lower): A thread-local tick rotates three prologue variants, four MBA constant-load patterns forweird_materialize_rax, and fourjunk_padsequences.junk_padis now emitted immediately before every call (internal and extern) when harden is active—previously unused at the lowering site.Docs:
emit-profiles.mddocuments CFG dispatch limits and native rotation;ghidra-antidecomp-smoke.mdmetrics reflect a larger harden object (2689 → 3109 bytes) and note Ghidra headless was skipped on the regenerating host.Reviewed by Cursor Bugbot for commit decb084. Configure here.