omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / seed / omc / om2 / s5 / scrub-ctl.om
| 1 | note S5 scrub negative control: scrub-mem.om with `scrub 4096` replaced by `long 0`; the same search must find |
| 2 | note the pattern (exit 10), showing the search can see a dead frame. |
| 3 | om2 |
| 4 | global buf uchar 1048576 |
| 5 | text mem "/proc/self/mem" |
| 6 | fn fill to ulong |
| 7 | a = new ulong 64 0 |
| 8 | for i ulong 64 |
| 9 | put a i 9833440827789222417 |
| 10 | end |
| 11 | s = ulong 0 |
| 12 | for i ulong 64 |
| 13 | s = add s get a i |
| 14 | end |
| 15 | ret s |
| 16 | end |
| 17 | fn main to int |
| 18 | s = fill |
| 19 | k = long 0 |
| 20 | if ne k 0 |
| 21 | ret 30 |
| 22 | end |
| 23 | fd = int fopen mem 0 len mem 0 0 |
| 24 | if lt fd 0 |
| 25 | ret 20 |
| 26 | end |
| 27 | hits = ulong 0 |
| 28 | for c ulong 8 |
| 29 | pos = long add 268435456 mul c 1048576 |
| 30 | r = pread fd buf 0 1048576 pos |
| 31 | if ne r 1048576 |
| 32 | ret 21 |
| 33 | end |
| 34 | i = ulong 0 |
| 35 | while lt i 1048576 |
| 36 | if eq get buf i 17 |
| 37 | if eq get buf add i 1 34 |
| 38 | if eq get buf add i 2 51 |
| 39 | if eq get buf add i 3 68 |
| 40 | if eq get buf add i 4 85 |
| 41 | if eq get buf add i 5 102 |
| 42 | if eq get buf add i 6 119 |
| 43 | if eq get buf add i 7 136 |
| 44 | hits = add hits 1 |
| 45 | end |
| 46 | end |
| 47 | end |
| 48 | end |
| 49 | end |
| 50 | end |
| 51 | end |
| 52 | end |
| 53 | i = add i 8 |
| 54 | end |
| 55 | end |
| 56 | r = fclose fd |
| 57 | if gt hits 0 |
| 58 | ret 10 |
| 59 | end |
| 60 | ret 0 |
| 61 | end |