Repository navigation
Abla 0.2.69
·
725 commits
to master
since this release
Behaviour changes and migration (read first)
- HTTP/1 servers refuse duplicate or invalid Host headers. A request with
more than oneHostline, or aHostvalue containing a space, a comma or
a control byte, is answered with 400 by the event servers, the blocking
reader and the WebSocket handshake. Before,request.header("Host")
returned the last of several lines, so an application routing by Host
behind a proxy that read another line could be given a host the proxy's
rules never saw. A missing or emptyHostis still accepted (a documented
difference from RFC 9112). Other repeated headers are not refused;
request.header(name)returns the last line of that name. (e142100) - HTTP event servers close a request head that takes over 30 seconds.
HttpEventServerOptions.requestHeadTimeoutMilliseconds(default 30000)
closes a connection whose request head is still incomplete that long after
its first byte; before, the idle timeout restarted on every byte, so about a
thousand clients trickling bytes could use every connection slot. Two
opt-in limits join it:requestTimeoutMillisecondsfor a whole request and
responseTimeoutMillisecondsfor a queued response nobody reads (both off by
default). They apply to the plain and the HTTPS event server; the HTTPS
server's HTTP/2 connections end with GOAWAY when the peer's flow-control
windows hold a response back pastresponseTimeoutMilliseconds. Run the
servers behind a proxy that limits connections per address.
(97477d4, 4e0b5de) - The blocking HTTP server has deadlines (medium).
serveHttp,
serveHttpOnListenerandserveHttpOnceserve one connection at a time and
had no deadline, so one connection that sent nothing, or did not read its
response, held every other client indefinitely. They now close, without an
answer, a connection that sends no byte within 10 seconds, has not finished
its head 30 seconds after its first byte, has not finished its request in
120 seconds, or does not take its response within 30 seconds; heads are
limited to 64 KiB and bodies to 1 MiB.httpReadRequestuses the same
defaults. Set your own withhttpServeOptions()and theserveHttpWith,
serveHttpOnListenerWith,serveHttpOnceWithandhttpReadRequestWithin
variants (0 turns a deadline off). A chunked body is decoded as its chunks
arrive, instead of being decoded again on every read (5.8 s of CPU for a
1 MiB body of one-byte chunks before, 0.33 s for 80,000 now). A deadline
bounds one connection, not the server: for a service open to the network,
use the event server or a proxy that limits connections per address
(docs/networking.md). (9999177) - The blocking WebSocket server has deadlines (medium).
serveWebSockets
andserveWebSocketOncerun each session on the thread that accepts, with
no deadline, so a client that sent nothing before the upgrade, trickled a
frame after it, or did not read what the handler wrote held every other
client indefinitely. The upgrade request is read with the blocking HTTP
server's deadlines. After the upgrade, a connection is closed after 30
seconds without a byte, a frame must finish within 120 seconds of its first
byte, and every write, the 101 response included, must finish within 30
seconds.readFrameandreadMessagedefault to the connection's idle
timeout. Set your own withwebSocketServeOptions()and the
serveWebSocketsWith,serveWebSocketOnceWithand
serveWebSocketsOnListenerWithvariants (0 turns a deadline off). The
server still runs one session at a time: for a service open to the network,
usewebSocketServerorwebSocketEventServer. (bacc37b) - WebAssembly: randomness without
cryptoSetRandom.cryptoRandomBytes
andsecureRandomBytesused to fail on WebAssembly unless the program set a
provider. They now use the host's source:abla_host.randomon the
abla_hostABI,random_geton WASI. A module that draws random bytes
therefore importsabla_host.random; a custom host must supply it (the ABI
already lists it). A host call that fails or makes no progress fails the
draw, so key generation and the rest still never see zeros. (8cbebcb,
ba38ec8) abla.tomlandabla.lockare checked against a grammar (medium). The
compiler's line-based manifest readers took a key from any table and from
inside multi-line strings, so a dependency's manifest could hide a
dependency, a capability line or (in a lock) a fetch URL inside what TOML
and any reviewer read as an inert string or another table. Every manifest
and lock the compiler reads, a dependency's at fetch time included, must
now fit the grammar its readers understand (src/manifest_grammar.ab, listed
in docs/packages.md): blank and comment lines,[table]headers,key = valuewith a string, an array of strings, an integer, a boolean or a
dependency's inline table; the name, version, entry, visibility and list
keys only at the top (or in[project]/[package]), once. Anything else
fails withE_PACKAGE_MANIFESTand its line: multi-line strings, dotted
keys, a known key in another table, duplicate keys or tables, arrays of
tables, a BOM, NUL or a bare CR. Comments after values and TOML escapes are
read as TOML reads them. All 652 manifests and locks in the project's
sibling repositories pass. (cf1d31d, 2b02607, 27ab23a, 52f823b)- Fetched dependencies are checked before checkout (medium). A fetched
git dependency is now checked out as exactly the blobs its locked digest
covers: the repository's own.gitattributes(line endings,ident,
filters, working-tree encoding) and yourcore.autocrlfno longer rewrite
the files the build reads, and git's object checks run on fetch. Its tree is
inspected first and refused withE_PACKAGE_TREEorE_PACKAGE_SIZE, before
anything is written, for a submodule, a mode other than a file, executable
or link, a control character in a path, a path over 1024 bytes or 64
levels, over 50,000 files or over 128 MiB of content; a download is capped
at 1 GiB. A compile-time import resolver's files follow the same path and
count rules (no backslash, colon, control characters or case-only
duplicates). (b82a0b2, 9d77c3b, aa346c7)
Known issue
await task { ... }orawait thread { ... }, with the task or thread written directly afterawait, doesn't keep it alive while it runs: a garbage collection inside its body can free it, and the program crashes or uses freed memory. Until v0.2.77, bind the task or thread to avalfirst (val t = task { ... }; await t). Fixed in v0.2.77.- Reading a very long number as a floating-point value (
parseFloat, JSON'sasF64orreadNumber,strtod) takes time quadratic in its digits, so one request carrying a JSON number of about a megabyte can keep a server busy for minutes. Until v0.2.77, reject or truncate numbers longer than a few hundred digits before converting them, or keep request bodies small. Fixed in v0.2.77. - A dependency's compile-time transform, or its custom
$syntax handler, can run compile-time code with your project's own compile-time grants (process, environment, file writes, network, native code), not the dependency's. Until v0.2.74, don't authorize those capabilities for your own project when you build with dependencies you don't trust. Fixed in v0.2.74, except for the case below. - A compile-time
#site that a dependency's custom$syntax handler builds into your file runs with your project's own compile-time grants (process, environment, file writes, network, native code), not the dependency's. Until v0.2.78, don't authorize those capabilities in a file that uses$syntax from a dependency you don't trust. Fixed in v0.2.78. ablac package updatecan run a dependency's compile-time import-provider code with your project's own compile-time grants (process, file writes, network), before the dependency is locked. Until v0.2.74, don't authorize those capabilities for your own project while you update dependencies you don't trust. Fixed in v0.2.74.- On Windows (x64 and ARM64),
ablac buildwith the build cache on (the default) can stop with "unsupported Linux system call 326" (exit status 70) when it copies a cached object. Workaround: pass--no-cache. Fixed in v0.2.70. - Programs built for Windows that use network sockets can crash, or read memory past a buffer, when a connection is reset or a socket read fails or times out. A remote peer can cause this. There is no workaround; rebuild with v0.2.70.
- On Windows, a program (including the Windows compiler) that starts another program by a bare name could run a file of that name from the current directory, so building an untrusted project with the Windows compiler could run code from it. Starting a .bat or .cmd file with untrusted arguments could run other commands, and very long directory paths or process arguments could corrupt memory. Fixed in v0.2.70.
- On Linux and macOS, building an untrusted project can run a program from that project when a tool the compiler starts (a linker, a C compiler or an LLVM tool) is not on
PATH, or whenPATHhas an empty,.or relative entry. Keep everyPATHentry absolute and the tools installed when you build code you do not trust, or update to v0.2.71. Fixed in v0.2.71. - Android libraries built with the release (static) Linux compiler are generated as if for plain Linux on arm64, not for Android. They use native ELF thread-local storage instead of emulated TLS, so on Android 7 to 9 (API levels below 29) loading such a library can fail. They also use register x18, which Android reserves (on Android 9 and later it holds the shadow call stack), so a library may crash on any Android version. To work around it, set
ABLA_CODEGEN_INPROCESS=0and have LLVM'soptandllconPATH(or setABLA_LLVM_TOOLS): the compiler then runs them instead of its own code generation, and the library is built for Android. This affects v0.2.66 and later. Fixed in v0.2.71. - On Windows on ARM64 (aarch64-windows) only, a program that uses AES-GCM ends on its first call with "fatal signal: Windows exception 0xc000001d". That includes every TLS client and server, and anything using abla/crypto/aes: the CPU feature check reads a register Windows does not let programs read. There is no workaround in the program. Rebuild with v0.2.72. x86-64 Windows, Linux and macOS are not affected. (Found by the Windows ARM64 CI lane; no user has reported it.) Fixed in v0.2.72.
- On macOS, adding a new entry to the package cache fails (a freshly fetched git dependency, or new content from a content provider): the compiler runs
chmod -R go-w -- <dir>on it, and the system's BSDchmodreads the--as a file name. Entries already in the cache, vendored dependencies whose digest matches and local path imports are not affected. Until v0.2.71, put a GNUchmodfirst onPATH(Homebrew's coreutils installs it asgchmod; link it aschmodin a directory ahead of/bin). Fixed in v0.2.71. - Ordinary code can write fields that the standard library's native buffers and cells rely on (
closedof aNativeByteBuffer,NativeI64CellorNativePointerCell), so safe code can reach memory it doesn't own. Until v0.2.79, don't write those fields outside the standard library, and check that your dependencies don't. Fixed in v0.2.79. - A dependency's custom
$syntax handler can have code of its own run at compile time with the grants of your file that uses the syntax (process, environment, file writes, network, native code). Until v0.2.79, don't authorize those capabilities in a file that uses$syntax from a dependency you don't trust. Fixed in v0.2.79. - A dependency's prepared copy in
.abla/packages/is trusted by its marker files without checking its contents againstabla.lockin single-file builds, and in project builds that also have a vendored copy, so a changed copy (from a restored CI cache, or committed next to a reviewed lock) is built as is. Until v0.2.79, delete.abla/packages/before building when it may come from somewhere you don't control (it is fetched again and checked), and don't cache or commit it. Fixed in v0.2.79. - The HTTP clients (
HttpClient.send,HttpAsyncClient, and the WebSocket TLS client's upgrade request) write the method, path and header values they are given without checking them, so a line break in a value that came from user input can add headers or a second request. Until v0.2.79, percent-encode user input in paths and queries (percentEncode) and refuse CR, LF and other control bytes in header values before passing them to a client. Fixed in v0.2.79. - The static Linux compiler's own hardening was weaker than a glibc build's: its stack-protector canary was a fixed value on AArch64, its
_FORTIFY_SOURCEbuffer checks did nothing, andrealpathcould overrun its caller's buffer with a very deep working directory plus a long relative path. None of these is reachable alone; each makes a separate overflow bug in LLVM or lld easier to exploit when compiling code you don't trust. On AArch64 itsprintffamily also read arguments from the wrong place, so text that LLVM formats could show stack contents or crash the compiler. Until v0.2.79, on x86-64 Linux the dynamic compiler asset (ablac-dynamic-x86_64-linux, built on glibc) avoids them; elsewhere, build code you don't trust from a shallow directory. Fixed in v0.2.79.
Highlights
- Windows. The Windows ARM64 toolchain ships in releases beside x86-64
(414dbef). Hosted Windows programs get the event poller,sendmsg, TLS
with the system's trusted roots (loaded from the user's ROOT store, crypt32
loaded only when TLS needs it), and the system's DNS servers, search suffix
and hosts file (847d111, 9d6d3b8). Native compile-time sites run
natively in the Windows compiler instead of falling back to the
interpreter (4880a4e), and Windows links run lld in the compiler's own
process (9157b3c). A native compile-time call that makes a bad memory
access or overflows its stack returns to its guard and reports, as on
Linux, instead of ending the build. CI runs the hosted Windows programs and
63 standard-library programs natively onwindows-latestand on the ARM64
runner. (e1b87b6, eeb7abe, 83b8cea, 17fd723) - Authenticated encryption with a random nonce.
aesGcmSealRandom/
aesGcmOpenRandomandchaCha20Poly1305SealRandom/
chaCha20Poly1305OpenRandomdraw a fresh 12-byte nonce per call and return
nonce, ciphertext and tag in one value. The docs give the limit for random
nonces (at most 2^32 messages per key) and say never to reuse a nonce.
(8cbebcb)
Fixes
- Package cache (medium): checking a cached entry ran git inside it, so a
core.fsmonitorin the entry's own git config was executed, and a file
marked "assume unchanged" could pass while changed. Entries are now checked
by the digest of their files in a scratch repository of the compiler's own,
no git runs inside an entry, andcore.fsmonitoris off for every git call.
Parallel installs into one empty cache no longer fail each other (four of
eight did), and entries are not left writable by group or others under a
permissive umask. The copy made for a build is hashed after copying and
must match the locked tree, so an entry swapped between the check and the
copy fails the build instead of being read; docs/packages.md says the cache
directory should be writable only by its user. (620b6ac, 91e95f1) - Deep nesting no longer crashes the compiler or the editor. A file with
thousands of open parentheses, nested blocks orelse iflinks ended the
compiler with a stack overflow, and an editor's analysis service crashed on
every restart while that file was open. It is now oneE_PARSE_NESTING
error at the point where the limit is hit: 2,400 levels, where an
expression and a block each count one (so 1,200 nested blocks), and 2,500
links in anelse ifchain. The browser playground's compiler is now
linked with a 4 MiB WebAssembly stack wherever it is built, and stops at
128 levels (50 nested blocks compile). (4417106, 9586c32, e46ecf3,
9d80ed5) - Release workflow (medium, for forks that run it):
source_ref, which
builds a branch or commit to test the workflow, is refused when
publish_releaseis on, so a release can no longer sign a tree other than
its tag. The Nix installer is checked against a pinned sha256 in every job
that builds a release asset, and the SBOM records it. Build jobs hold
read-only permissions, and the publish job refuses two artifacts that share
a file name instead of letting one overwrite the other. docs/ci-security.md
explains why the apt and Homebrew inputs stay unpinned. (16f9f56,
ef56cef) - Hosted Windows: a send or receive with
MSG_DONTWAITno longer blocks,
and a peer's orderly close is readable, so the WebSocket server reports the
close code it sent instead of 1006; plussymlink,readlink,getrusage,
signal masks, user ids andSO_REUSEADDRon UDP. (08cca1d, 4f13ee4,
6eed723). The handler that turns a fault or a stack overflow into a
report no longer runs inside the system-call dispatcher's growing frame, so
it keeps working on an overflowed stack (f6890eb). The compile-time
watchdog no longer hangs when the thread it stops holds the loader lock
(419edff). - macOS (closes v0.2.68's second known issue):
ablac analyze --stdio,
as abla-lsp and editors drive it, no longer ends with SIGBUS. The macOS
runtime had no translation formprotect, so the frozen heap's memory
never became writable; this affected v0.2.62 through v0.2.68, and programs
that callFrozen(x)the same way. Two more calls had no translation: a
TLS session's close never shut down its side of the connection, and the
compiler's in-process read of ELF relocations fell back tollvm-readelf.
The garbage collector now uses more than one thread on a Mac (it counted
one CPU). A check now fails the build on any system call the macOS runtime
does not translate unless it is listed with a reason. You can drop the
ABLA_ANALYSIS_FREEZE=0workaround. (9a00881, 3c9a368, dc5d26b,
d9ae199) - Compile-time file operations on links (closes v0.2.68's known issue):
p.remove(),p.moveTo()andp.isSymbolicLink()in compile-time code act
on a symbolic link itself again, not on its target. (ffeddb9) - Compile-time paths: a path is checked and then used without following a
link in between, so a directory swapped for a link during the build can no
longer lead a compile-time read or write out of the project. Every directory
of the path is opened from the project root without following links
(Linux and macOS; absolute paths and Windows are unchanged, see
docs/compile-time.md). (725113d) - Crypto: a random source that returns no bytes fails instead of looping,
and on Windows a failingProcessPrngcall is an error instead of handing
on zeroed bytes. (91dbb25) - Thread stacks (medium): a thread's stack has a one-page guard, and
generated code did not probe its stack, so a function whose frame is larger
than a page could step over the guard into the next thread's memory instead
of stopping with a stack overflow. Two standard-library network reads keep a
64 KiB buffer on the stack, so on a thread close to its stack limit, bytes a
peer sent could land in another thread's memory. Every function on hosted
targets (Linux on x86-64, AArch64 and RISC-V 64, and macOS) now probes each
page of a large frame, so the guard is always hit and the overflow panics.
Programs without large frames compile to the same code; the compiler grew
by 0.013%. Freestanding and embedded targets have no guard page and are not
probed. (dc868b9) - HTTP async client:
HttpAsyncClientno longer returns a connection to
its pool when the server sent bytes after the end of a response (a second
response, a body longer than its framing, bytes after a HEAD, 204 or 304
head); such a connection is closed, so a peer that disagrees about where a
response ends cannot have its leftover output read as the answer to the
next request. (293013c) - TLS client: a
server_nameacknowledgement with a body, in TLS 1.3
EncryptedExtensions or a TLS 1.2 ServerHello, is a decode error (RFC 6066
requires it empty), and a ChangeCipherSpec that arrives before a ServerHello
choosing TLS 1.2 is an unexpected message, as OpenSSL and Go treat them.
(2afb3d6, ab9cdd4, 7aa6377) - TLS server: early data that the server does not accept is skipped until
the client's Finished (RFC 8446 4.2.10), up to 32 KiB, instead of ending the
handshake withbad_record_mac; clients that try 0-RTT now fall back to a
full handshake. (6e423ff) - Docs:
request.pathand route parameters (:name) are raw text: not
percent-decoded, with.,..and empty segments kept. docs/networking.md
says what to check before using a parameter as a file name. (75ffa93) - Regions: a method call through an indexed field receiver
(this.items[i].method()) resolves its region summary by the element's
type instead of by method name alone, so a colliding method name elsewhere
no longer decides it; typed parameters, annotated locals and aliases are
resolved the same way. (fe5c5c3, cd164cb, 67945bc, b0e6769,
#1193, #1196) - XML:
XmlElement.text()walks the tree with a stack of its own, so a
very deep tree (withmaxDepthraised) no longer overflows the call stack.
(d94726c) - Compile-time evaluation: a built-in
Mapcall no longer pulls every
user method of the same name into a native compile-time slice (in one app it
dragged the database and TLS in; those sites now run natively); bridged
Path.readTextreads are modelled, and class method signatures keep their
types in native slices; portable Wasm compile-time slices keep the standard
panic provider, so a panic there reports the same message as native and
WASI programs. (5686263, b5a7448, a1046fb, 605062b, 614d9e6,
f868a96, #1195) - Android: libraries no longer declare an unused dependency on bionic's
libc, and arm64 shared libraries are aligned for 16 KiB pages (required
by Android 15+ devices that use them). (04a22a1, ce80823). When two
threads first used thread-local storage at the same moment, one of them
could read a key that was not ready yet; it now waits for it (in releases
since v0.2.61). (d10953f) - Reproducible builds: the runtime identity of a private standard-library
class (such as those inside gzip, X.509, HPACK and TLS) was derived from
the absolute path of the installed standard library. Two release builds of
the same program, or of the compiler, made against standard libraries
installed in different places therefore differed. Class identities now use
the same portable spelling as the rest of the build. (de8cfab)
Performance
- A function with thousands of locals no longer takes minutes to compile:
checked reads stay out of line in functions with 768 or more local slots,
and long operator chains are typed and emitted without recursing (a fast
compiler now handles 6,000 locals in an 8 MiB stack). The test holds compile
time under 3x across 1,000, 2,000 and 4,000 locals, a ratio the old compiler
failed at 2,000. (7222bc5, #1197)
Toolchain
AndreBaltazar8/setup-abla@v1installs this release's Windows x64 toolchain on Windows x64 runners, and checks every download against the release's signed SHA256SUMS (releases from 0.2.67 on); a missing or bad signature fails the step. Windows ARM64 runners are not supported by the action yet. This release also ships a Windows ARM64 toolchain, which setup-abla will install once its next version is tagged; until then download it from the release.- The compiler reproduces itself natively on RISC-V 64 and AArch64
Linux. Built on the target itself, its stage 2 and stage 3 are
byte-identical: RISC-V 64 withrv64-static-convergence.yml(run
45302710345), and AArch64 Linux onubuntu-24.04-armwith
aarch64-native-fixpoint.yml(run 45317919082). The AArch64 build also
runs hello with an emptyPATH, and its release JWT matches the x86-64
cross build. Both workflows can be dispatched by anyone checking a
release. (f3b9499, 638ae91) - Windows releases require native fixed points. A release is built only
after the Windows compiler has reproduced itself natively, so this
release's own run produces them. (2db908f)
Bootstrap convergence
Two fresh Linux builders bootstrapped the source of v0.2.69 (150c711dffa00a28993196e4f3d24bc45525878a) from different seeds and reached the same compiler:
- route A: v0.2.68 (
ablac-x86_64-linuxsha2564f7dee2c7a16826705aa32e7ba5466b599cc1432274190007e4ea582883a3a09) -> stage 1, 2, 3 - route B: v0.2.67 (sha256
1ad0c494de77596139c052b778bbafc3bfed329b801ef90a75b0a7f64808bc27) -> the sources of v0.2.68 (f9ec0852bfe3690a042ee9c95dfd00f5dbeab1d5), twice -> stage 1, 2, 3 - canonical IR (raw, non-debug, pre-prune
--emit-llvm src/orc_main.abat/build/source): sha2568f5e9e9495aa15964c46eb6ef0f52003a8cef00c144e5e44df18dec06c85cd4b - stage 2 executable
ce6b74fdbaf6487e55485a400abcebd5693817e33b01c5dbde4cda5d7fc18d4c, object6d06b5fc917729dbf3697d9e15f5b5df52c96e5925aeafa61e23d5b6786292f9 - toolchain: environment
d00897b2d6cc51118a9495656126ec6b32b87504a2eb780e173bac4eec54f68b, closureb1872f918c677d4b376f11826949774047bafeac6c208592b89a05f2dc4640aa - run: https://github.com/AndreBaltazar8/ablac/actions/runs/45361024311
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).