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 / research / atemporal / at0 / integration / isolation_check.sh
| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # AT-0 Agent 5: symbol isolation check (charter section 6, gate AT0-G2), written independently of |
| 18 | # the evaluator's gates/isolation.sh and of the oracle's isolation.sh. Works on C objects and on |
| 19 | # the members of a Rust rlib: any undefined symbol that names a clock, timer, random source, |
| 20 | # environment, file, socket, process, thread or dynamic loader fails the object. |
| 21 | # [ALLOW=<regex of exempt symbol names>] sh isolation_check.sh <object.o>... prints one line per hit; exit 0 clean, 1 hit, 2 unreadable |
| 22 | BAN='clock_gettime|clock_getres|clock_nanosleep|gettimeofday|^time$|timespec_get|^times$|localtime|gmtime|mktime|nanosleep|usleep|^sleep$|^alarm$|setitimer|^rand$|^random$|srand|drand48|arc4random|getrandom|getentropy|getenv|setenv|putenv|fopen|freopen|^open$|open64|openat|^creat|^read$|^write$|^fread$|^fwrite$|socket|^connect$|^accept|^bind$|^listen$|^send|^recv|getaddrinfo|dlopen|dlsym|^system$|popen|fork|^exec|posix_spawn|pthread_|thrd_|^clone$|^syscall$|3std4time|3std3env|3std2fs|3std3net|3std7process|3std6thread|3std2io5stdio|SystemTime|Instant' |
| 23 | rc=0 |
| 24 | ALLOW=${ALLOW:-^$} |
| 25 | for o in "$@"; do |
| 26 | [ -f "$o" ] || { echo "UNREADABLE $o"; rc=2; continue; } |
| 27 | syms=$(nm -u "$o" 2>/dev/null) || { echo "UNREADABLE $o (nm failed)"; rc=2; continue; } |
| 28 | hits=$(printf '%s\n' "$syms" | awk 'NF{print $NF}' | sed 's/@.*$//; s/^__//; s/_chk$//' | grep -E "$BAN" | grep -vE "$ALLOW" | sort -u | tr '\n' ' ') |
| 29 | if [ -n "$hits" ]; then echo "HIT $o: $hits"; [ $rc -eq 0 ] && rc=1; fi |
| 30 | done |
| 31 | exit $rc |