code wiki / _attic / _canary_stack_overflow.nx

_canary_stack_overflow.nx

buildroot/runtime/_attic/_canary_stack_overflow.nx

1083 B28 linesdepth 1pulls 1 transitivereach 0 importersview sourcekind archivedtopic canary
docsdependenciesstructsconstsfunctions

about

Canary: deliberate infinite recursion to trigger SIGSEGV from stack overflow. With SA_ONSTACK + sigaltstack(2) wired into _narr_install_traps the produced ELF should NOT die silently with "qemu: uncaught target signal 11"; instead the substrate trap handler runs on the alt stack and emits a structured [✗CHK] event naming WHO/WHAT/WHY/HOW before exiting 128+11=139. USAGE: _offc/nxc.elf bench/_canary_stack_overflow.nx 1>elf 3>asm gcc-riscv64-linux-gnu (whatever) elf -> a.out qemu-riscv64-static a.out 2>fd2 4>fd4 grep "received fatal signal 11" fd2 # MUST be present PRE-FIX: handler tries to push signal frame onto exhausted stack -> recursive SIGSEGV -> SIGKILL -> empty fd2. POST-FIX: handler runs on alt stack -> emits [✗CHK] -> rc=139.

dependencies 1 imports · 0 importers

nx_narr.nx _canary_stack_overflow.nx

imports: nx_narr.nx (unresolved)

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main recurse recurse ↻

structs

none

consts

none

functions

20func recurse(n: i64) -> i64 {
called by 2: recursemain calls 1: recurse
26func main(argc: i64, argv: *u8) -> i64 {
calls 1: recurse