Skip to content

fix(tools/uci): phase3_tcp_echo blocked by MemoryPolicy on its own uci_host_buf write (#97) - #105

Merged
JC-000 merged 1 commit into
masterfrom
fix/issue-97
Aug 14, 2026
Merged

JC-000 merged 1 commit into
masterfrom
fix/issue-97

Conversation

@JC-000

@JC-000 JC-000 commented Aug 14, 2026

Copy link
Copy Markdown
Owner

tools/uci/phase3_tcp_echo.py cannot complete on any device. It dies on
its own DMA write, before reaching the TCP echo it exists to test:

MemoryPolicyError: write_memory($6760, 32 B) → $677F blocked: overlaps
reserved region $6000-$9FFF (segment:CRYPTO_HOT). Pass override="<reason>"
to bypass for a single call, or update the harness MemoryPolicy.

Reported by an outside contributor in #97, where it also blocked the
diagnostic baseline run we had asked them for.

Cause

The script pre-seeds uci_host_buf over DMA so the hostname is in place
regardless of what net_dns_resolve copies (deliberate belt-and-braces,
per the comment there). uci_host_buf is UCI_BSS, which the post-W1
UCI cfg packs inside CRYPTO_HOT — it resolves to $6760, verified
against a local make BACKEND=uci:

$ grep uci_host_buf build/labels.txt
al C:6760 .uci_host_buf

tools/uci/_memory_policy.py reserves CRYPTO_HOT as one coarse
$6000-$9FFF region and cannot tell a writable BSS byte from resident
code, so a legitimate write reads as a collision.

Fix

An override="<reason>" at the call site, mirroring the _OVR idiom
already in bench_ecdsa_u64e.py:186 — which has exactly the same
situation for ecdsa_* buffers inside CRYPTO_COLD_SHADOW. Not a policy
relaxation: the guard is doing its job everywhere else, and it is the
reason CRYPTO_OVERLAY collisions stopped being silent corruption.

Audit — this was the only one

$ grep -rn "write_memory(labels" tools/
tools/uci/bench_ecdsa_u64e.py:190:  ... override=_OVR
tools/uci/bench_ecdsa_u64e.py:196:  ... override=_OVR
tools/uci/bench_ecdsa_u64e.py:205:  ... override=_OVR
tools/uci/bench_ecdsa_u64e.py:206:  ... override=_OVR
tools/uci/bench_ecdsa_u64e.py:207:  ... override=_OVR
tools/uci/phase3_tcp_echo.py:439:  ← this one, no override

Every other write_memory under tools/uci/*.py targets an
arbiter.alloc() address, so it is inside the harness scratch window by
construction. Six label-address writes exist in the tree; five were
already overridden.

Refs #97.

`phase3_tcp_echo.py` pre-seeds `uci_host_buf` over DMA so the hostname is
in place regardless of what `net_dns_resolve` copies. That write has no
`override=`, and `uci_host_buf` resolves to $6760 — UCI_BSS, which the
post-W1 UCI cfg packs *inside* CRYPTO_HOT ($6000-$9FFF). The harness
MemoryPolicy reserves CRYPTO_HOT as one coarse region and cannot tell a
writable BSS byte from resident code, so a legitimate write raises

    MemoryPolicyError: write_memory($6760, 32 B) -> $677F blocked:
    overlaps reserved region $6000-$9FFF (segment:CRYPTO_HOT)

and the script cannot complete on any device. Reported by an outside
contributor in #97, where it also blocked the diagnostic baseline run
they had been asked for.

Fix is an `override="<reason>"` at the call site, mirroring the `_OVR`
idiom already in `bench_ecdsa_u64e.py:186` — not a policy relaxation,
since the guard is doing its job everywhere else.

Audited the rest of the tree for the same latent break:
`grep -rn 'write_memory(labels' tools/` returns six sites, the other
five in `bench_ecdsa_u64e.py` and all already overridden. Every other
`write_memory` under `tools/uci/` targets an `arbiter.alloc()` address.
This was the only one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@JC-000
JC-000 merged commit 94d93d7 into master Aug 14, 2026
@JC-000
JC-000 deleted the fix/issue-97 branch October 14, 2026 15:36
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