Repository navigation
·
380 commits
to master
since this release
Behaviour changes and migration (read first)
- A dependency's
$syntax can't have its own code run with your
file's compile-time grants (high; fixes a known issue of v0.2.68 to
v0.2.78). Code that a dependency's$handler leaves for the compiler
to run later now runs only with grants that both your file and the
dependency allow, as the#sites a handler builds do since v0.2.78.
The standard library's handlers are unchanged. (afb1bb8, #1139 area 1) - Fields of restricted standard-library types can be written only from
trusted code (high; fixes a known issue of v0.2.60 to v0.2.78; decision
#161). Ordinary code could write fields that native buffers and cells
rely on, so safe code could reach memory it doesn't own. A field of a
class whose raw constructor is restricted (closedof a
NativeByteBuffer,NativeI64CellorNativePointerCell,errorof a
CudaKernelDevice) can still be read anywhere, but writing it outside a
trusted function is now the errornative.trust:<Class>.<field>.
This can break a build: code that sets such a field itself, for
examplebuffer.closed = trueto keep a drop from freeing memory it
doesn't own, must move the write into a trusted function or use the
type's own functions. docs/language.md describes the rule. (0586414) - The GPU kernel runtime keeps safe code inside its own memory (high;
experimental; fixes a known issue of v0.2.72 to v0.2.78). Three routes
let safe code makeabla/kernelorabla/kernel/cudaread or write
memory it doesn't own. The CPU backend's launch state (KernelCpuState)
is now private toabla/kernel. Every CUDA driver call makes its own
device's context current, so memory and launches go to the right device
when several are open. Upload and download refuse a closed host buffer.
A device record is also checked against both its context and its module
(low). (aa056c4, #1139 area 13) - Builds check a prepared package copy against the lock (medium; fixes
a known issue of v0.2.64 to v0.2.78). A single-file build, and a
project build that also had a vendored copy, trusted the copy in
.abla/packages/by its marker files, so a changed copy (from a
restored CI cache, or committed next to a reviewed lock) was built as
is. Every build now checks the copy's files againstabla.lock, and a
copy that differs is fetched again or set aside for the vendored tree.
The result is recorded with the copy's file sizes, inodes and change
times, so an unchanged copy isn't hashed again (about 240 ms saved per
build for four packages of 650 files). (6bf6d94, 7528d2a, #1139
area 2) - HTTP clients refuse a request that would split (medium; fixes a known
issue of v0.2.60 to v0.2.78).HttpClient.send,HttpAsyncClient
(also over HTTP/2) and the WebSocket TLS client's upgrade wrote the
method, target, host and header values they were given unchecked, so a
line break in user input could add headers or a second request. They
now refuse, before connecting, a method or header name that isn't a
token, a target with a space or control byte, a host with a space, comma
or control byte, and a header value with a control byte other than tab.
HttpClientResultgainserror, which names the refused part without
its value; the async completion carries the same error, and
H2Client.requestreturns -1. (ce912c5, #1139 area 4) - The static Linux compiler's own hardening works (medium; fixes a known
issue of v0.2.64 to v0.2.78). The compiler links LLVM and lld against
Abla's static libc, which weakened their protections: the stack canary
was one constant on AArch64 and RISC-V (now random per process; on
x86-64 its low byte is now zero, as with glibc), and the
_FORTIFY_SOURCEchecks did the plain copy instead of aborting. Four
libc functions are also fixed:realpathcould write past a PATH_MAX
buffer (low-medium),posix_memalignreturned a small block for a size
near the maximum (low-medium),qsortcould step outside the array with
an inconsistent comparator (low), andprintfnow follows C for%.0d
of zero and a NULL%sunder a short precision (low). None of these is
reachable alone; each made a separate overflow in LLVM or lld easier to
exploit when compiling untrusted code. (5453a30, 8a541e5, fe9865f,
985e8fd, c074fd0, c7f77e7) A second review fixed more: on AArch64
theprintffamily read its arguments from the wrong place, so text
LLVM formats could show stack contents or crash the compiler (medium;
8bb1b3e).errnoand pthread key values are each thread's own (they
could be shared by two threads; low-medium; fcba677, 6e1d5ee), and
atexit handlers registered from several threads at once are no longer
lost or written into a freed table (low-medium; 91e1942).sprintf
writes its text again, and bounded string functions givenSIZE_MAX
treat it as no limit (low-medium; c444285, 4e789a4).printf,
strftimeand__wctype_lno longer read past the end of their input
(low; 9ea376d, 9e3117c),sched_getaffinityclears the part of
the mask the kernel doesn't write (low; c26dec7), and the ctype tables
andlog2fare thread-safe (low hardening; 47f8bc8, 49f6e2e).
(#1139 area 14)
Fixes
- HTTP/2 server (low-medium): a request is held to the HTTP/1.1 rules.
An:authorityorhostthat isn't a host, a secondhost, a:path
with a space or control byte, and bad trailers on streaming routes now
reset the stream withPROTOCOL_ERROR. (6227428, #1139 area 4) - HTTP/1 servers (low-medium): a request in absolute form (
GET http://host/path) is served as/pathwith that host, as RFC 9112
requires, instead of keeping itsHostline; one with another scheme,
userinfo or no host is refused. The HTTPS event server's streaming
routes, the WebSocket event server and the WebSocket server's plain HTTP
path now check the request line and framing as the HTTP servers do: the
last one took the last of twoContent-Lengthvalues and accepted two
Hostlines. (2e666ec, #1139 area 4) - HTTP/2 client (low-medium): a response header or trailer whose name
isn't a token, or whose value has NUL, CR or LF, resets the stream, so
it can't reach an HTTP/1.1 peer a program forwards it to. (5da712d) - Async HTTP client URLs (low): userinfo (
http://token@host/) is
refused before any DNS lookup instead of going to the resolver, the host
ends at?and#, the fragment is no longer sent, and the scheme
matches in any case. IPv6 literals never worked and are now refused with
"invalid URL"; docs/networking.md says so. (3124783) - WebSocket TLS client (low): each frame gets a fresh masking key, as
RFC 6455 asks, instead of one key per connection, and a masked frame
from the server closes the connection. (c3de664) - Packages (low): a fetched package may not hold file names Windows
reads as other files or refuses (backslash, colon, device names, a
trailing dot or space,< > " | ? *), so a vendored project still
checks out on Windows, and itsabla.tomlmay not be a symbolic link
(7e2c2e9).ablac package info,addandoutdatedread a
repository under the same file limit, timeout and object checks as a
fetch (a7a973f). Package index and manifest text refuses C1 and
bidirectional control characters, which could make one package name
read as another (5f4ee36). (#1139 area 2) $json(low): an object whose computed key equals another key at
run time has that key once, with the later member's value, as
JSON.parsereads it. Before, both members were written. (715c606,
decision #154)- AES-GCM (low): a text over 2^36 - 32 bytes under one nonce is
refused, as NIST SP 800-38D requires. Past it the block counter would
wrap onto the block that masks the tag. (11986ef) - RSA key generation (low hardening): the primality test does all of
its squarings on the prime it keeps, so its timing no longer depends on
that prime. (918ce83) - Compile-time grants (low-medium): a file inside your project that
only a dependency imports now counts as that dependency's code, so its
compile-time code gets the dependency's grants, not yours. A file your
project imports anywhere stays yours. (199cedd, #1139 area 1) $regex(low hardening): a literal with named captures runs only the
standard library'sRegexconstructor at compile time; its capture
factory is called at run time. Its cost is unchanged. (3f619b2, #1139
area 1)- TLS 1.3 (low): data after a KeyUpdate in the same record is refused
withunexpected_message, as RFC 8446 requires, and a server that
ignores early data stops skipping records at the first one that
decrypts under the handshake key. (5f318a4) - Shared libraries with compile-time code: an uncached x86-64 Linux
shared-library build whose source runs compile-time code no longer
prints "JIT session error: Unexpected definitions" (the library was
written either way). (6cde5e7) - Import remap: a replacement module that doesn't parse is reported by
its parse errors, not as missing declarations, and the annotation error
says thatprivategoes before@inline. (def0417) - verify-release: the published v0.2.67 verifies as a whole
directory, and a missing SHA256SUMS is explained (a draft has none until
its publish job signs it). (1e39995) - Windows: the intermittent watchdog hang is fixed: the watched thread
could close the handle the watchdog was stopping it through and stay
suspended. A run stopped by the watchdog can also no longer leave a
newer watch without a deadline, which let a hung JIT loop or a long
sleep run on. (ccc7e51, 1212cee, 9b8f45e)
Improvements
- Reads into an exact-sized string are one memory copy. A read that
fills less than half its buffer (a socket read on an event server, a
file read under a large limit, pipes, process output, pure TLS) was
copied 8 bytes at a time with a check per step. An HTTP event server's
request with a 16 KB body takes 81% fewer instructions, a 1 KB body 18%
and small JSON requests 6 to 7%. (0b5fcac) - AArch64 Linux libraries: shared and static libraries for the
aarch64-linux target carry their own runtime, as Android's do: the
shared one links without libc (onlypthread_createandpthread_join
come from the host), and the static one no longer importsmalloc,
writeand the rest. The shared one failed to link before. (8f85a9b) - Regex:
findAllWithinandreplaceWithinbound the work of a whole
findAllorreplacewith one step budget, counted asfindWithin
counts.findAllWithin(text, maximumSteps, start = 0)gives
RegexFindAllDone(matches)orRegexFindAllExhausted(matches, resumeAt); passresumeAtasstartto continue.replaceWithin
givesRegexReplaceDone(text)orRegexReplaceExhausted(), never a
half-replaced text. Use these for text from untrusted clients: a pattern
likea+b|amadefindAlltake 12 million steps on 2,000 characters.
(73d4992, decision #153) - Editor: a repeated request on an unchanged project is answered
without reloading and re-parsing the project (120 to 150 ms saved per
request on a large project). (3d4f617) - Browser playground: the WebAssembly runtime's collector sweeps in
address order and merges free blocks with a bitmap instead of a sort.
Compiling the "Write JSON" example is about 3% and then 5 to 7% faster from
the two changes, and "Compile-time functions" about 10%. (38e730d,
66a3b07)
Bootstrap convergence
Two fresh Linux builders bootstrapped the source of v0.2.79 (ba5d6b7d5c26a65059ed7ca02c32a6780add41c7) from different seeds and reached the same compiler:
- route A: v0.2.78 (
ablac-x86_64-linuxsha256334959d4198a44871dfaf974f8b446be6ede5d4d0a929eb203665f933f5e608c) -> stage 1, 2, 3 - route B: v0.2.77 (sha256
3ec18350dc1c09f8d5d3920ed7a65d2a23a6f9f72c50a73f66f82366f84dd3d8) -> the sources of v0.2.78 (648cf072a454ae1f7d172cd9bc484976ac567054), twice -> stage 1, 2, 3 - canonical IR (raw, non-debug, pre-prune
--emit-llvm src/orc_main.abat/build/source): sha25664f6d203479005f3d8b2f92171dc324501904b7f649f7764ecc0f21cb0226e72 - stage 2 executable
d12a85450f4c0ae8461457006b5d49eb27a39a0634b3452347380071178d6cde, object14ceff55fc3635c5418395768d6dcbc6169d8eeef91d98761a47c57daa1bad36 - toolchain: environment
af5f2ced5b6bcfdab3d335ce55c899e0416169cfa683d20a5ba8712fca1b6474, closureb1872f918c677d4b376f11826949774047bafeac6c208592b89a05f2dc4640aa - run: https://github.com/AndreBaltazar8/ablac/actions/runs/46030062723
This is route convergence within one compiler lineage: it is not an independent implementation, and it does not exclude a seed compromise shared by both routes (docs/bootstrap.md).