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 / sites / found-mbind-2.om
| 1 | note sites: found by a one-token change of a tracked program (41 to 120 lines); reaches the omc error site in mbind (code 9) |
| 2 | note Owned low-address reservations and complete-span file binding. Host only. |
| 3 | text path "reserve.bin" |
| 4 | text mark "Z" |
| 5 | text msg "PASS owned reservations, collision refusal and failed-bind retirement\n" |
| 6 | global buf uchar 4 |
| 7 | global status uchar 4 |
| 8 | global fds int 2 |
| 9 | fn ck yes bool to void |
| 10 | if not yes |
| 11 | exit int 80 |
| 12 | end |
| 13 | end |
| 14 | fn bad k int to void |
| 15 | if eq k 0 |
| 16 | r = maphold 4096 4096 |
| 17 | ret |
| 18 | end |
| 19 | if eq k 1 |
| 20 | r = maphold 1099511627776 4096 |
| 21 | ret |
| 22 | end |
| 23 | if eq k 2 |
| 24 | r = maphold 68719476737 4096 |
| 25 | ret |
| 26 | end |
| 27 | if eq k 3 |
| 28 | r = maphold 68719476736 4097 |
| 29 | ret |
| 30 | end |
| 31 | if eq k 4 |
| 32 | r = maphold 18446744073709551615 4096 |
| 33 | ret |
| 34 | end |
| 35 | h = maphold 68719542272 4096 |
| 36 | ck gt h 0 |
| 37 | if eq k 5 |
| 38 | r = mapread h 0 buf 0 1 |
| 39 | ret |
| 40 | end |
| 41 | if eq k 6 |
| 42 | r = mapwrite h 0 mark 0 1 |
| 43 | ret |
| 44 | end |
| 45 | if eq k 7 |
| 46 | r = mapget h 0 4 |
| 47 | ret |
| 48 | end |
| 49 | if eq k 8 |
| 50 | r = mapset h 0 4 0 |
| 51 | ret |
| 52 | end |
| 53 | if eq k 9 |
| 54 | ck eq mapbind h neg int 1 0 3 neg long 9 |
| 55 | r = mapaddr h |
| 56 | ret |
| 57 | end |
| 58 | ck eq mapbind h get fds 0 0 not 0 |
| 59 | r = mapbind h get fds 0 0 3 |
| 60 | end |
| 61 | fn main to int |
| 62 | fd = fopen path 0 len path 524482 384 |
| 63 | ck ge fd 0 |
| 64 | put fds 0 int fd |
| 65 | ck eq fseek int fd 4095 0 4095 |
| 66 | ck eq write int fd mark 0 1 1 |
| 67 | ro = fopen path 0 len path 524288 0 |
| 68 | ck ge ro 0 |
| 69 | put fds 1 int ro |
| 70 | for i ulong 16 |
| 71 | h = maphold 68719476736 4096 |
| 72 | ck gt h 0 |
| 73 | ck eq mapaddr h 68719476736 |
| 74 | ck eq maphold 68719476736 4096 neg long 17 |
| 75 | ck eq mapbind h int fd 0 3 0 |
| 76 | ck eq mapread h 4095 buf 0 1 1 |
| 77 | ck eq get buf 0 90 |
| 78 | ck eq mapset h 0 4 add 123 i 0 |
| 79 | ck eq mapget h 0 4 add 123 i |
| 80 | ck eq mapdrop h 0 |
| 81 | end |
| 82 | h = maphold 68719476736 4096 |
| 83 | ck gt h 0 |
| 84 | ck eq mapbind h int ro 0 3 neg long 13 |
| 85 | j = maphold 68719476736 4096 |
| 86 | ck gt j 0 |
| 87 | ck ne j h |
| 88 | ck eq mapbind j int ro 0 1 0 |
| 89 | ck eq mapget j 0 4 138 |
| 90 | ck eq mapdrop j 0 |
| 91 | for k int 11 |
| 92 | p = fork |
| 93 | ck ge p 0 |
| 94 | if eq p 0 |
| 95 | bad k |
| 96 | exit int 80 |
| 97 | end |
| 98 | ck eq waitpid int p status 0 4 0 p |
| 99 | ck and eq get status 0 0 eq get status 1 103 |
| 100 | end |
| 101 | ck eq fclose int fd 0 |
| 102 | ck eq fclose int ro 0 |
| 103 | ck eq unlink path 0 len path 0 |
| 104 | ck eq write 1 msg 0 len msg long len msg |
| 105 | ret 0 |
| 106 | end |