Skip to content

feat(mem): VCR-MEM-001 layer-1 — native-pointer shadow-stack reservation shrink (#383, #242)#409

Merged
avrabe merged 1 commit into
mainfrom
feat/vcr-mem-001-shadow-stack-shrink
Jun 21, 2026
Merged

feat(mem): VCR-MEM-001 layer-1 — native-pointer shadow-stack reservation shrink (#383, #242)#409
avrabe merged 1 commit into
mainfrom
feat/vcr-mem-001-shadow-stack-shrink

Conversation

@avrabe

@avrabe avrabe commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

What

Implements the --shadow-stack-size B shrink that PR#388 scaffolded as honest-Err. Under --native-pointer-abi, re-bases the SP global slot sp_init→B and resizes the NOBITS .bss reservation to B + static-tail — unblocking tiny-RAM targets (gale's gust kernel: declared (memory 17) ≈1 MiB → 8 KiB STM32F100). Opt-in: default unset reserves the full page.

Correctness model

Correct-by-construction for the verified gust geometry (stack-first): statics at/above sp_init are retargeted into the packed .data (#354), so the only static relocs still pointing into the .bss are addend-0 region-base pointers — stable because __synth_wasm_data stays at offset 0. Refuses honestly (typed Err) for any geometry it can't prove safe: one-PROGBITS fallback, B > sp_init, a non-zero inline static addend into the reservation (down-shift = deferred general case), a non-Abs32 reservation reloc, or an ambiguous SP global.

Verification

Gate

This is the link-fragile native-pointer flight path (#345/#354/#359 history). gale's on-silicon reflash on this exact gust_kernel.wasm is the final runtime gate — green CI here is necessary, not sufficient. The asserted-budget contract (B must cover everything live above address 0, incl. heap; safe for no-grow MCU images) is documented in the flag help text.

Implements VCR-MEM-001 layer-1. Refs: gale#383, gale#91, #242.

🤖 Generated with Claude Code

…ion shrink (#383, #242)

Implements the `--shadow-stack-size B` shrink that PR#388 scaffolded as honest-Err.
Under --native-pointer-abi, re-bases the SP global slot sp_init→B and resizes the
NOBITS .bss reservation to B + static-tail, unblocking tiny-RAM targets (gale's
gust kernel: declared (memory 17)≈1 MiB → 8 KiB STM32F100).

Correct-by-construction for the verified gust geometry (stack-first: statics
at/above sp_init are retargeted into the packed .data via #354, so the only static
relocs still pointing into the .bss are addend-0 region-base pointers, stable
because __synth_wasm_data stays at offset 0). REFUSES honestly (typed Err) for any
geometry it can't prove safe: one-PROGBITS fallback, budget > sp_init, a non-zero
inline static addend into the reservation (down-shift = deferred general case), a
non-Abs32 reservation reloc, or an ambiguous SP global. Opt-in: default unset
reserves the full page.

Measured on gust_kernel.wasm: --shadow-stack-size 4096 → bss 1048720 → 4240,
SP slot 1048576 → 4096, text/data + all 10 relocs unchanged. Frozen fixtures
(control_step/flight_seam/flight_seam_flat) byte-identical with the flag off
(verified by cmp vs clean main). gale on-silicon reflash on this fixture is the
final gate.

Tests (shadow_stack_shrink_383.rs, via the real binary + object .bss parse):
shrink→4240, no-flag→1048720, budget>sp_init→honest refuse.

Implements: VCR-MEM-001
Trace: VCR-MEM-001

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/synth-cli/src/main.rs 90.90% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

@avrabe avrabe merged commit 4341d46 into main Jun 21, 2026
15 checks passed
@avrabe avrabe deleted the feat/vcr-mem-001-shadow-stack-shrink branch June 21, 2026 17:07
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