Skip to content

Abla 0.2.67

Choose a tag to compare

@AndreBaltazar8 AndreBaltazar8 released this 23 Nov 09:15
· 975 commits to master since this release

Behaviour changes and migration (read first)

  • The working-directory fallback for compile-time paths is gone (6c99537, #1044, decision #91 A and #95 A). v0.2.66 still took a relative path from the working directory, with warning[W_BUILD_PATH_CWD], when it was not found beside the source file. Now:
    • Build calls (buildProgram, compilerBuildProgram, wasmBuildModule, an independent module's emit) and compile-time file access (#compilerWriteFile, abla/fs in # code) read every relative path against the source file's directory, always. A missing entry is E_SOURCE_NOT_FOUND.
    • W_BUILD_PATH_CWD, E_BUILD_PATH_CWD and ABLA_BUILD_PATH_CWD are removed.
    • Migration: a build that gave the warning on v0.2.66 now fails. Rewrite the path relative to the source file, as the warning said. The ./build/... spelling from v0.2.66 keeps working and means the same thing.
  • iOS XCFramework packaging follows the same rule (c82cad7). iosCreateXcframework(output, slices, headersDirectory) used to read all three from the working directory, unlike the buildProgram calls that make its slices. Its output and slices are now read and written against the calling source file, inside its project, and its headers directory is a read (an absolute one is used as given). A path outside the project is E_BUILD_PATH_OUTSIDE. On a host other than macOS, E_IOS_XCFRAMEWORK_HOST now names the resolved package path.
    • Migration: packaging paths that were spelled from the repository root become relative to the source file, the same paths its buildProgram calls use.
  • Release builds collect with a helper thread by default (2ece028, decision #107 B). A release (not --fast) executable for hosted x86-64 or AArch64 Linux is now built with background freeing: each collection hands what it found unreachable to a runtime helper thread, and a program that never asked for collection threads gets four (fewer on a machine with fewer CPUs) at its first collection. Results are the same; the process has the helper thread, and every release executable carries the parallel collector. The x86-64 Linux static toolchain ships that collector optimized once and links it (6e72e0e), so a cold release build of hello costs about what it did without the default (3.46G instructions, about 1% more than the 3.43G before the default, against 4.73G with the collector compiled into the program; nine paired runs); hello's .text is then 45,819 bytes (37,360 with the collector compiled in). Another toolchain, or a standard library that no longer matches the shipped digest, compiles the collector into each release program, at that higher cost. --fast builds, libraries, objects, Wasm and macOS are built as before, and so is a program that sets manual collection.
    • Opting out: memorySetBackgroundFree(false) or ABLA_GC_BACKGROUND=0 (which wins over the call) turns the helper off; memorySetGcWorkers(0) or ABLA_GC_WORKERS=0 keeps collection on one thread.
  • Known issue, not fixed in this release: a dependency inherits every compile-time capability the root grants. Compile-time grants are still computed for the whole program: if the root abla.toml authorizes, say, environment or filesystem.read for its own # code, a dependency's # code gets it too, whatever the dependency's own manifest declares (trusted.native included, when the root grants it). Until per-package grants land (#1142, planned for v0.2.68), grant compile-time capabilities only in projects whose dependencies you trust.
  • Known issue, to be fixed in v0.2.68: a vendored package is trusted by its marker files. vendor/<name>/ is used when its .abla-revision and .abla-digest markers match the lock, without hashing its files, so an edited vendored source builds without an error. Review changes under vendor/ as you would your own code until v0.2.68 checks the tree against the lock's digest.
  • Known issue: 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.
  • Known issue: 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=0 and have LLVM's opt and llc on PATH (or set ABLA_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.
  • Known issue: 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.
  • Known issue: On Windows, a program that starts another program by a bare name could run a file of that name from the current directory. 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.
  • Known issue: 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 when PATH has an empty, . or relative entry. Keep every PATH entry absolute and the tools installed when you build code you do not trust, or update to v0.2.71. Fixed in v0.2.71.

Highlights

  • Windows programs (W1c): sockets, processes, pipelines and crash reports.
    • Sockets (b3e310e): Winsock behind the same descriptors as Linux: socket, connect, bind, listen, accept, send/recv, sendto/recvfrom, shutdown, the name and option calls, fcntl, ioctl and poll over WSAPoll.
    • Processes (c4a52e2): the standard library launches a process with one CreateProcessW call, with redirects, an environment and a directory; wait, kill, pipes and descriptor duplication work over handles.
    • Pipelines (e65d586): each stage is spawned with its pipe ends as standard streams; a group's stages share a process group, and killing the group ends them all.
    • Crash reports (79be696, 3a5d1b9): a vectored exception handler prints the same lines as Linux: panic: stack overflow (status 101), fatal signal: a bad memory access at 0x…, or the exception code. A -g or --backtrace build then prints the stack, unwound by the system's unwind tables. The process ends with the exception's code without Windows Error Reporting. CI checks this on a real Windows runner.
  • The compiler itself, built for Windows (c40a4ec, 9fa734b, f61de18, 5523335, 179a41a, e0042d2, a4776d1, f6ddaf5, 2f49a32, baca762, 57f886f). First steps toward a native ablac.exe: built for x86_64-windows-hosted it finds its toolchain beside itself, gets the 128 MiB stack the Linux launcher gives the compiler, runs compile-time processes through the runtime's spawn (Windows has no fork or signals), and reads drive and UNC paths (Path gives them back /-separated, and module identity keeps their root). Under Wine, with a stub LLVM, it prints --version, formats a file and takes a program through a build up to the first LLVM call (tools/test-windows-compiler.sh); the real LLVM for Windows is built from the patched fork with the static MSVC runtime (14bc8b8, 6ae80ce, 9176002, f7b0215) and is not linked in yet. Its JIT side is designed (docs/design/windows-jit.md): ablac.exe exports its external definitions for the JIT, and the runtime has the unwind-free abla_setjmp/abla_longjmp pair. Its entry, src/orc_windows_main.ab, links lld in process with no Linux C library, and a preflight checks the native Windows compiler link (6c3c9ab, db35c47). The verified Windows LLVM and lld static SDK is pinned (3a3f74d, #1137). The runtime's C-library-named routines (memcpy, memset, __chkstk and the rest) are COFF weak externals, so the compiler can link against the static MSVC C runtime without a duplicate (db91557).
  • WASI commands (32acf5a, d01b8b9, ae7bf58). ablac build app.ab --target wasm32-wasi -o app.wasm builds a WASI Preview 1 command that runs under wasmtime run app.wasm: no WASI libc or SDK, the wasi_snapshot_preview1 ABI directly. Arguments, the environment, standard streams, the exit status, clocks and random bytes work, and files open through the working-directory preopen. Browser and hostless modules stay on wasm32-module (docs/targets.md). The browser playground runs WASI commands in a bounded Web Worker with a shared compiler stdlib bundle, and CI exercises both (71b8fec, 79833ec).
  • RISC-V 64 Linux programs (fa55c6c). --target riscv64-linux builds libc-free RV64GC (LP64D) executables: static PIE start-up and thread-local storage, system calls by ecall, threads, non-local jumps and signal stacks. CI runs hosted programs under QEMU and checks the Linux module programs in a job of their own. Raw RV64I object emission is unchanged.
  • Windows ARM64 programs (a318758). --target aarch64-windows cross-builds hosted, libc-free ARM64 Windows programs on Linux: ARM64 COFF linked into a console PE with the shared Windows runtime (stack probing, jumps, thread entry and native unwind data). CI runs the same images on a Windows 11 ARM runner (docs/targets.md).
  • The AArch64 static compiler runs on an empty PATH (4ec5efe, 246f6b3, 61c90c1, 89d9f0e, bdeba7b, #1124). It now carries the real in-process shim (lld, llc, opt, the archiver and llvm-mc for its generated libc data file), linked against AArch64 LLVM and lld archives built to match the x86-64 ones, so it builds programs on an AArch64 Linux machine with no LLVM installed. CI and the release build it this way, and a qemu test builds hello on an empty PATH. AArch64 tests can also run on an SSH board pool (48688db), and the hardware lane can self-build the compiler on a board with an empty PATH, pass 2 equal to pass 3, and checks that programs it builds there behave as the cross builds (bdeba7b, 9e0d9c0, c0d5e7c). LLVM, lld and the shim headers come from one pinned AArch64 set (5b0ae92).
  • The collector traces arrays exactly and paces more steadily (fc35928). A boxed array's storage is traced up to the array's length, so stale slots past it no longer keep objects alive (serial, parallel and Wasm marking). Adaptive pacing moves its growth estimate a quarter of the way toward each new sample (a change over twofold resets it), which steadies the collection interval on cyclic workloads such as JSON.
  • Compact object headers (f5b69a6, 489ec33, f582af1, 1864ef8, 68951ca). Small fixed-layout hosted objects carry a 16-byte header instead of 32 (a compact tree node: 64 native bytes plus an 8-byte registry slot, against 80 plus 8). Regions and frozen copies keep 32-byte headers.
  • Faster code (85b1343, def22dd, 7473217).
    • A counted loop that appends a fixed width each pass reserves its string builder once (fasta).
    • Object allocation is passed the class's known size (c981ee7; binary-trees -1.8%).
    • A guarded loop that copies a dense integer array element by element becomes a bulk copy (fd3b38a; fannkuch).
    • Linux release builds unroll short counted loop nests with literal bounds (nbody).
    • Byte-buffer appends return as soon as a byte fits.
    • Release builds promote the arguments of a recursive traversal of a private class with two self-calls (3e96c35).
  • --fast builds link a prebuilt runtime (6409fa4, b7e15f5, d72e99c, a5fa158, d41ea3b). Native x86-64 Linux ablac build --fast compiles the runtime once into an object cached per compiler, runtime sources and build options, and links it instead of compiling it into every program. Builds with compile-time code, the background collector, an explicit import of the runtime platform or an OpenSSL ABI module, or without a usable cache, use the ordinary runtime build. ABLA_FAST_RUNTIME_OBJECT=0 opts out (docs/toolchain.md).
  • --backtrace works on Windows and macOS (6b8048b, 1f9156a, b69a698). As on Linux, a --backtrace program is built with line tables and its DWARF is split out beside it: <output>.debug on Windows (named by a .gnu_debuglink), <output>.dSYM on macOS (tied by the image UUID). The program ships without debug info or symbols, and ablac symbolize turns its crash stack into file:line using the file beside it, including at an ASLR load address on Windows. docs/debugging.md now says --backtrace is opt-in at build time (there is no run-time switch) and what it costs. On macOS a release -g executable gets <output>.dSYM too (7432677).
  • The editor reanalyses less (d300af0, 7f3f45f, 3c20e28, 199cf36). Verified replay is on by default: inserting an unused binding, or editing an existing unused integer binding, shifts the previous analysis instead of rechecking, after checking the inputs and output bytes match; the full checker remains the fallback. Assembling an analysis also does less duplicate work. Editing an integer result in an explicitly typed function is replayed too (62b58b1).
  • Indented JSON (63f1edf, 7db6db5, e3f0351). jsonStringifyPretty(value, sortKeys = false, maxDepth = 128) writes a JSON tree with two-space indentation, optionally with object keys sorted, for stable files (docs/json.md).
  • Debugging (2d6e0b1). gdb and lldb show a value's words and an array's capacity as unsigned numbers (debuggers dropped them before), and universal values carry their Abla type name (string?, Map).
  • Smaller collections stay serial (fa714c9). The automatic collection threads start only once a collection kept 32 MiB or needs the page directory, so small programs don't pay for parallel setup. A release program loads the STM runtime only if it may use it (071758d).
  • Faster standard-library loading (accf21b). The toolchain ships relocatable discovery records for the standard library, checked against the compiler and the exact source bytes, so a build skips rediscovering it.

Fixes

  • A manifest's git source could inject git options (b2cd379). A dependency's git source or version selector in abla.toml was passed to git ls-remote checked only for quotes and line breaks, so a value starting with - (such as --upload-pack=<command>) ran that command when ablac package update resolved the dependency: anyone who cloned a repository and ran it executed what its manifest said. ablac build, run and test were not affected (they read only the lock, whose sources could not run a command). A source must now be an https, ssh, git or file URL, a path or an scp-style address, a selector a plain revision, tag or branch name, and a locked revision a full hash. Every git call clears the inherited git environment, turns off hooks and the ext transport, and passes the source, selector and revision after --. Fixed; every earlier release is affected.
  • Compile-time writes could follow a symbolic link out of the project (cdd4463, #1142). The project bound for compile-time file access was checked on the path as written, so with filesystem.write granted, a write through a symbolic link inside the project (#path("../escape/x").writeText(...) with escape -> /elsewhere) landed outside it. The bound now resolves each existing component's symbolic links (at most 40) before the check, for the project root too, and the operation uses the resolved path. Fixed; every earlier release is affected.
  • Huge sizes no longer overwrite the heap (0cd3be0, 4c01e72, 6d90c5d). A string built by repeating or doubling past 2^62 bytes no longer overwrites the heap: a length computation wrapped around, and the copy wrote past its allocation (for example "x".repeat(n) with a large n). The same held for filledArray(n, v) with n of 2^61 or more, a ByteBuffer past 2^62 bytes, and appendFixed with a huge decimal count. Each now panics instead. Fixed; every earlier release is affected.
  • A region can no longer store a value it built into a Map, a TVar or an outer ByteBuffer (411051a, 94f2076). Inside region { ... }, outerMap.set(k, v), tvar.setValue(v) and extension functions that keep their argument in an outer receiver (such as outerBuffer.appendText(s)) compiled with a region-allocated value, and the outer container pointed at freed memory once the region was reset. They are now refused at compile time (region.escape:map.set, map.set.key, setValue), like array appends and field stores; docs/regions.md lists the rules. Fixed; every earlier release is affected.
  • JWT base64url is strict (92d8241). abla/jwt refuses padding and non-zero trailing bits, so a token has one spelling.
  • A $regex(...) literal may start on the next line (0d5b07e, f028667). A token subparser that delegates an expression skips leading newlines, so $regex(\n "pattern"\n) parses.
  • Subparsers under a module alias (36357f3). import "abla/json" as j then $json {…} failed: the expansion named the library's helpers unqualified. Expansions of $json, $jsons, $jsonw, $regex, $xml, $sql and $html now resolve them through the alias.
  • TLS (ded07e8, 08ec787). A session-ticket key now seals a bounded number of tickets and is then rotated (before, the default never rotated it, and AES-GCM's random 96-bit nonces made a collision, and so a forged ticket, possible on a busy server over time). A certificate verdict that carries an alert or a reason is a refusal (a custom verifier that refused with an empty reason was treated as accepting).

Toolchain and docs

  • The compiler builds itself in less memory: IR blocks are reused when reachability prunes nothing (ce6fe0f; self-compile 71.8 to 68.5 bytes per source byte). Collections under scoped GC stress no longer hand sweeps between threads (3569b55).
  • The same bytes from any directory, everywhere (ed35e6f, 99193d0, #1090). A hosted Windows object built with -g, --fast or --backtrace named its temporary file in its CodeView, so two builds differed; it is now written under its published name, and Windows links run lld-link with one thread. tools/test-reproducible-paths.sh checks every file a build writes (release, --fast, -g, --backtrace, AArch64 and hosted Windows) from four directories, and the fuzzer's build-paths axis now requires byte-identical artifacts.
  • Crypto tests: Wycheproof ML-KEM-768, ECDSA with SHA-512 and P-384/SHA-256, and RSA decryption at 3072 and 4096 bits (8039ad5); ct-timing targets for P-384 signing and the RSA padding oracles, none of which leaks at 40,000 samples (be07044).
  • --warn-regex-construction (57cfc60): W_REGEX_CONSTRUCTION suggests $regex for regexCompile calls with a literal pattern.
  • BoGo's TLS shim builds again (e37b45d), and tools/gen-x509-limbo.sh takes BETTERTLS_STRIDE=1 for the full 9,491-case run (34155de). The packaged static compiler is tested linking Windows programs without external tools (68b3b16).
  • Exports test: a git archive export is bounded like its checkout when the project names its root in abla.toml (b65edbc, #1141; docs/compile-time.md).
  • Releases are signed from v0.2.67 (2769e59, 5947d7e, 30848b2, 28ef398, 2858922, 25dfd17, 615e7d5). The release workflow signs SHA256SUMS with the project's ed25519 key (ssh-keygen -Y sign -n abla-release); the public key is release-signing.pub at the repository root. setup-abla, tools/bootstrap-compiler.sh and tools/verify-release.sh check the signature with ssh-keygen -Y verify and refuse an unsigned or altered asset for v0.2.67 and later (v0.2.66 and earlier have no signature). Each release also has an SBOM. The workflows also got tighter token permissions, and the static nightly, whose pinned action was not a real commit, starts again. docs/ci-security.md and docs/reproducibility.md say what is and is not proven.
  • Bounded GC-stress for the compiler (af62ddb, #1128). ABLA_COMPILER_GC_STRESS=ct|analysis|analysis-edit[:stride] stresses the compiler heap only around a threaded compile-time call or editor requests, and reports each window's collections on standard error. memorySetStressStride(n) collects at every n-th safe point under stress, and memoryHeapStat(14) counts finished collections, serial or parallel. Two new lanes use them: tools/test-ct-threads-heap-stress.sh and tools/test-analysis-gc-stress.sh.
  • docs: the Linux toolchain archive is the static one from v0.2.66 (df2e81a).
  • Archive member names are tested with the per-push static compiler (f406f6a).
  • tools/test-static-compiler.sh gives both compilers the same sysroot for its LLVM text comparison (fac279e).

Known issue

  • await task { ... } or await thread { ... }, with the task or thread written directly after await, 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 a val first (val t = task { ... }; await t). Fixed in v0.2.77.
  • Reading a very long number as a floating-point value (parseFloat, JSON's asF64 or readNumber, 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.
  • Ordinary code can write fields that the standard library's native buffers and cells rely on (closed of a NativeByteBuffer, NativeI64Cell or NativePointerCell), 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 prepared copy in .abla/packages/ is trusted by its marker files without checking its contents against abla.lock in 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_SOURCE buffer checks did nothing, and realpath could 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 its printf family 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.