nx_smoke_mmap.nx source
↩ module page · 22 lines · 693 B
1// smoke_mmap.nx -- verify sys_mmap works in our RV64 ELF chain.
2//
3// If this exits 7, sys_mmap returned a valid pointer + the
4// memory is writeable + readable. If it segfaults / exits
5// non-zero, the chain has a sys_mmap bug.
6
7// nx_safety_envelope:
8// intended_use: AUTO_APPLIED -- primitive-specific tuning queued
9// sil_target: SIL1
10// evidence: [bulk_applied_2026-05-16, see-file-comment-for-detail]
11// verdict: NOT_YET_EVALUATED
12
13import "nx_syscalls.nx"
14const K_MAGIC_4096: i64 = 4096
15
16func main() -> i64 {
17 let p: *u8 = sys_mmap(K_MAGIC_4096)
18 p[0] = 7
19 p[1] = 8
20 let v: i64 = p[0]
21 return __syscall(93, v, 0, 0, 0, 0, 0)
22}