Skip to content
64 changes: 59 additions & 5 deletions compiler/analysis/typechecker.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion docs/containment-sandbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,9 @@ it reveals or changes, on the path as it resolves:
`mtime`, `is_symlink`, `is_socket`, `readlink`, `realpath`, `statvfs`),
which are refused as reads: a stat tells whether something is there, which
is what a grant list hides. A refused metadata call reads as absent (0) or
as an error. **A listing is a read of the directory listed**:
as an error. `os.which` checks each candidate it looks at on PATH (a
refused one is skipped, as if it were not there), and `os.getcwd` the
working directory (refused, it gives ""). **A listing is a read of the directory listed**:
`fs.list_dir(d)` needs a grant matching `d` itself (`"/data"` or
`"/data*"`; `"/data/*"` covers what is in it, not the directory). `fs.glob`
checks the directory it starts from, refusing the glob when that is
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- **A call that returns several values, passed where a parameter takes one,
is the checker's error.** `takes(list.get(xs, 0))` or
`spec.expect_str(pair())`, with the multi-value call written straight into
the argument, passed `ae check` and failed in the C compiler ("passing
'_tuple_ptr_string' to parameter of incompatible type 'const char *'").
The same mistake through a name bound to the tuple was already refused; the
call form, including a UFCS receiver (`pair().takes()`), now is too (E0200),
naming the call and the fix: destructure it first.
10 changes: 10 additions & 0 deletions new_changelogs/20261126T071641Z-fixed-return-value-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- **A multi-value `return` with a different count than the function's result
is the checker's error.** A function whose first `return` gives one value
and a later one two (`return 0` ... `return v, 1`), or two and then three,
or three and then two, was let through and lowered to the first
`return`'s shape: a tuple returned into an int result reached the C
compiler, a longer tuple silently lost its extra values (a C "excess
elements" warning only), and a shorter one left the rest zero. Each is now
E0200 at the `return`, naming the result type and how many values the
`return` gives; the same for a written result type (`-> (int, string)`
returning three values).
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- **`os.which` and `os.getcwd` are checked against the sandbox.** `os.which`
checked only `env PATH` and then looked at every candidate on it
unchecked, so a sandboxed caller with no file-system grant could learn
where any program was installed; `os.getcwd` checked nothing. Each
candidate `os.which` looks at is now an `fs_read` of its path (a refused
one reads as absent and the search goes on), and `os.getcwd` needs
`fs_read` on the working directory (refused, it gives ""), as
`fs.exists` and `fs.realpath` do. A sandbox that runs a program found
with `os.which` now grants `fs_read` on its directory as well.
37 changes: 32 additions & 5 deletions std/os/aether_os.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions tests/integration/crypto_tls13_external_psk/test_external_psk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,21 @@ if command -v openssl >/dev/null 2>&1 && openssl s_server -help 2>&1 | grep -q -
sc_want="$3"
shift 3
SP=""
# Port 0: the kernel picks a free port and s_server prints it
# ("ACCEPT 0.0.0.0:54321"). A port computed here could be one another
# test held on 127.0.0.1, which s_server's wildcard bind (it sets
# SO_REUSEADDR) does not refuse on FreeBSD: the client then reached
# the other listener and the case failed as "connect failed".
for try in 1 2 3 4 5; do
P=$(( 20000 + ($$ * 7 + try * 1009 + $(printf '%s' "$sc_name" | wc -c)) % 40000 ))
openssl s_server -4 -www -accept "$P" -naccept 1 "$@" >"$TMP/s.log" 2>&1 </dev/null &
openssl s_server -4 -www -accept 0 -naccept 1 "$@" >"$TMP/s.log" 2>&1 </dev/null &
spid=$!
PIDS="$PIDS $spid"
w=0
while [ "$w" -lt 100 ] && server_alive "$spid" && ! grep -q ACCEPT "$TMP/s.log" 2>/dev/null; do sleep 0.1; w=$((w + 1)); done
if server_alive "$spid" && grep -q ACCEPT "$TMP/s.log" 2>/dev/null; then
SP=$P
break
SP=$(sed -n 's/^ACCEPT .*:\([0-9][0-9]*\)[^0-9]*$/\1/p' "$TMP/s.log" | head -1)
[ -n "$SP" ] && [ "$SP" != 0 ] && break
SP=""
fi
kill_server "$spid"
done
Expand Down
60 changes: 52 additions & 8 deletions tests/integration/http_server_slow_clients/shim.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading