Skip to content

Abla 0.2.74

Choose a tag to compare

@AndreBaltazar8 AndreBaltazar8 released this 25 Nov 22:30
· 559 commits to master since this release

Behaviour changes and migration (read first)

  • A dependency's compile-time code keeps its own grants (high; fixes the
    known issue of v0.2.68 to v0.2.73).
    Three ways in which code from a
    dependency ran with your project's compile-time grants (process,
    environment, file writes, network, native code) instead of its own are
    closed:

    • a dependency's compiler.transform that replaces a function in another
      package with a body containing compile-time code (# or $) is
      refused with E_COMPILER_TRANSFORM_GRANTS, unless the grants of the
      file the function is in are within those of the transform;
    • a dependency's custom $ syntax handler runs within the grants of the
      file that declares it, not those of the file that uses the syntax (the
      standard library's handlers, such as $json, are unchanged);
    • ablac package update runs a dependency's import-provider code with
      the dependency's own manifest capabilities, within yours, and never
      with process, network or native-code access before it is locked.

    A dependency that needs one of these capabilities must declare it in its
    manifest, and the named-only ones need your project's line as before.
    docs/compile-time.md now says exactly what trusted.native grants.
    (8aaa918, ab3420c)

  • A dependency's transform may change only its own package, unless you
    grant transform.program.
    A compile-time transform or # site of a
    dependency that changes a function of another package (yours, or another
    dependency's), or adds a conformance or an extension field to one, now
    fails with E_COMPILER_TRANSFORM_PROGRAM. Before, such a rewritten
    function could run with your grants when your own compile-time code
    called it. A framework package that rewrites your annotated functions
    (an ORM, a router) needs a named grant, like trusted.native:

    compileCapabilities = ["transform.program"]
    
    [dependencyCompileCapabilities]
    my-framework = ["transform.program"]

    and its transform's module requests it with
    #compilerGrant("transform.program"); abla.lock must pin the package.
    Your project's own transforms are unaffected. (996aaaa, decision #145)

Fixes

  • HTTP/2 server memory: a connection's open streams hold at most 1 MiB
    of decoded request headers by default (further streams get
    REFUSED_STREAM, which clients retry; raise it with
    HttpsEventServerOptions.maximumHeldHeaderBytes), and HPACK table
    entries no longer keep whole header blocks alive (about 6.8 MB down to
    1.0 MB on a busy connection). Before, one unauthenticated peer could make
    each connection hold about 12 MB of headers. (3fb089d)

Improvements

  • Editor: with abla-lsp's default unused-import warnings on, edits that
    don't change a declaration's interface are re-checked incrementally again
    (before, the warning turned the incremental path off). Time to the
    editor's answer after the first edit: abla-one 1.68 s to 0.23 s, abla-ui
    0.87 s to 0.40 s, with the same diagnostics and quick fixes as a full
    check. (210402e)

Known issue

  • GPU kernels (experimental): code that is not trusted can use abla/kernel to read or write memory it does not own, through the CUDA host types and kernel launches (since v0.2.72) and through workgroup shared memory on the CPU backend (since v0.2.73). Until v0.2.77, don't build dependencies you don't trust that import abla/kernel. Fixed in v0.2.77.
  • 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.
  • 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.
  • A dependency's compile-time transform can generate an extension function, an extension field or an extend for a type of another package without transform.program, and such generated code runs with your project's grants when your own compile-time code uses it. Until v0.2.78, don't authorize compile-time capabilities for your own project when you build with dependencies you don't trust. Fixed in v0.2.78.
  • 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.
  • Safe code can make the GPU kernel runtime (abla/kernel, abla/kernel/cuda) read or write memory it doesn't own. Until v0.2.79, don't run kernel code from dependencies you don't trust, open one CUDA device at a time, and don't upload to or download into a buffer you have closed. 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 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.

Bootstrap convergence

Two fresh Linux builders bootstrapped the source of v0.2.74 (e69fba5065dcf67b2c2758cc5ae8137c807898cb) from different seeds and reached the same compiler:

  • route A: v0.2.73 (ablac-x86_64-linux sha256 8a67ba0cf4e28af968e1b36899c87db2b77c48249674b017cfa7cda620dd23e2) -> stage 1, 2, 3
  • route B: v0.2.72 (sha256 a4f9c843f6cf4d00c914ff321d4abca1d82cff90d21f20839e9d50ad54c3f929) -> the sources of v0.2.73 (23156facdb6fdab28c5b230290fa9758be8578fa), twice -> stage 1, 2, 3
  • canonical IR (raw, non-debug, pre-prune --emit-llvm src/orc_main.ab at /build/source): sha256 4e6152b5258b7f23984c5e9d903878c7d5ef7b332e2b68735ea701fc8108e0d2
  • stage 2 executable 21aa63a6e5a85296b408cc9dfbf8cdfbe42e24588ae8fa053d642a21804a02c3, object d2b1046fc15a0587791ff8df70e0fe52fc854dbd76d3f9aa6624263f2dd22e4a
  • toolchain: environment d00897b2d6cc51118a9495656126ec6b32b87504a2eb780e173bac4eec54f68b, closure b1872f918c677d4b376f11826949774047bafeac6c208592b89a05f2dc4640aa
  • run: https://github.com/AndreBaltazar8/ablac/actions/runs/45694584156

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).