Repository navigation
Abla 0.2.70
Behaviour changes and migration (read first)
-
Dependencies need a grant to define
trustedorexterncode. A
dependency that defines atrustedfunction or declares anextern
function now fails the build withE_PACKAGE_TRUSTED_DENIEDunless your
rootabla.tomlnames it andabla.lockpins it by digest, for example
for abla-blockchain:[dependencyCompileCapabilities] abla-blockchain = ["trusted.native"]
The error names the package, the function and its file and line, and
prints the line to add. One line covers a package's sub-paths; a
dependency of a dependency needs its own line. Your own project and the
standard library are not affected. The same line does not let a
dependency run native code at compile time unless your project allows
that for itself. Before, any dependency could define trusted code and do
raw memory operations whatever the root allowed. Of the published
packages, only abla-blockchain (its wallet) needs the line; abla-mvc,
abla-nats and abla-redis no longer define trusted code, so run
ablac package updateif your lock pins an older version. (9086ec5,
decision #122) -
The TLS client checks OCSP staples by default. The standard library's
TLS clients (tlsConnectand its variants, the HTTPS clients, the
WebSocket TLS client) now ask the server for a stapled OCSP response and
check it when one comes: a revoked certificate fails with
certificate_revoked; a staple for another certificate, from the wrong
signer, out of date or valid for more than 10 days fails with
bad_certificate_status_response; a must-staple certificate without a
staple fails withbad_certificate. A server that sends no staple
connects as before.tlsLastError()reports these as "TLS failed at
certificate_verification". Setrevocation = 0inTlsClientConfigto
opt out. A configuration you build with your own verifier is unchanged,
and the OpenSSL-based hosted client has no revocation check. A handshake
with a staple costs about 0.6 ms more. (5f116ba, decision #120) -
Android:
libabla_app.soimports nothing from bionic. An arm64
Android library no longer nameslibc.so: the five pthread functions it
used (thread-local keys, and thread start and join) are now handed to it
by its host through a table,abla_android_host_install(table), declared
in the generatedabla-app.h. The generatedlibabla_jni.soinstalls the
table in itsJNI_OnLoad, so an app built the standard way needs no
change. A host that loadslibabla_app.sothrough its own bridge must
install the table before calling an export; without it, the first call
that needs one of those functions prints why and ends the process with
status 70. abla-mobile already does this. (b3f11cf, decision #121) -
WebSocketServerReadis renamedSocketReceiveResultand moves to
abla/sys/linux/net, next to the newlinuxTcpReceiveDescriptor: one
bounded, non-blocking read from a descriptor (status is the count, 0 at
end of file or a negative errno; the descriptor stays open).
webSocketServerReceiveis built on it. (e10ba6f)
Fixes
- Windows sockets (high; closes the known issue of v0.2.67 to v0.2.69):
in programs built for Windows, a socket read that failed (a connection
reset by the peer, a read that would block, or a read timeout) was taken
as a read of 4 GiB. Depending on the reader, the program crashed or read
memory past its buffer, and a remote peer could cause either. A failed
Winsock call is now a negative error, as on Linux.SO_RCVTIMEOand
SO_SNDTIMEOalso waited milliseconds where seconds were asked for; they
now wait as long as asked, and a timed-out send or receive isEAGAIN, as
on Linux. Rebuild Windows programs that use the network. (a2768a7) - Windows process start and paths (critical and high; closes the known
issue of v0.2.67 to v0.2.69): from a review of the Windows runtime.- Starting a program by a bare name (
git,lld-link) let Windows look
in the current directory, so building an untrusted checkout with the
Windows compiler, or any Windows program that starts another by name,
could run a file of that name from that directory. A bare name is now
looked up beside the running program and then onPATH, never in the
current directory. - Starting a
.bator.cmdfile with an argument containing",%,
^,&,|,<,>,(,),!or a line break could run other
commands, becausecmd.exereads the command line again. Such
arguments are now refused withEINVAL. - A directory path longer than about 2,040 characters, or a process
argument larger than the command-line buffer, wrote past a buffer. The
argument is now refused withE2BIG, and long paths work. - Also: two threads closing one descriptor no longer close a handle
twice, a link's target is read within the bytes Windows returned, a
negative descriptor inpollis ignored as on Linux, and a very long
socket timeout no longer overflows.
Rebuild Windows programs, and update the Windows compiler. (c2315ed)
- Starting a program by a bare name (
- Windows build cache (closes the known issue of v0.2.68 and v0.2.69):
ablac buildwith the cache on no longer stops with "unsupported Linux
system call 326"; you can drop--no-cache. A new check fails the build
of the compiler if any system call the compiler or the standard library
makes on Windows is neither translated nor listed with a reason.
(fd240f3, c217171, 738126a) - Compile-time paths on Windows (#1201): like Linux and macOS since
v0.2.69, a compile-time path is opened directory by directory from the
project, and a junction or symbolic link swapped in between the check and
the use is refused, so it can no longer lead a compile-time read or write
out of the project. (2bd2092) - Windows files and memory:
FileLockworks (it ended the program with
status 70:flockis nowLockFileEx), and so dochmod, hard links,
utimesand reads at an offset (f522fda, 49a67b0).mprotecton
memory reserved with no access (the frozen heap's window) now commits the
pages, so they become usable instead of failing on the first store
(de1a678).homePathfalls back toUSERPROFILEwhenHOMEis unset
(fccb746), and process metrics (working set, commit charge,
descriptors, creation time) are available as on Linux (bc6d952). - Windows crash reports: a crash inside
memmove,memcpyormemset
(for example a copy past the end of a buffer) now names the calling
function in a--backtracestack, instead of a meaningless address.
(81991fa) - WebSocket TLS client:
TlsWebSocketConnection.readFramecan now be
given a deadline for a whole frame (readFrame(maximumPayload, timeoutMilliseconds)), andsetReadTimeoutsets the limit for reads that
name none. A read that runs out reportstimedOut, keeps the connection
open and keeps the bytes it read, so the same call can be repeated. The
upgrade response must arrive within the connection timeout as a whole, not
per read. The default is unchanged: no limit. (cf48176) - Regions: a method call's region summary is now found for receivers
built by a unique constructor or returned by a call with a declared type,
and for typed module-level values. Before, these fell back to a
conservative answer. (c3782c5, cdb7a2c) - Playground: a browser run explains a capability the page denies and a
companion file it is missing, and ani64result ofmainbecomes the
exit status. (f1a8018, 8e0f296, 0f0a6a9)
Performance
- Portable compile-time code with maps: compile-time code that uses the
built-inMapwith scalar keys and values now runs in the portable
WebAssembly slice instead of falling back, with Map types checked at the
call; a WASI catalog build is 8.5× faster. (d31a5fb) - Compiler scaling: very wide
whenarms over literals, long chains of
member calls, very wide sums and functions with many regions no longer
slow compilation down out of proportion. Wide literal dispatch uses LLVM
switch lookups, literal keys and large block tables are indexed, type
queries are reused along a receiver chain, and wide additions are
reassociated before machine lowering. (3237a4a, 9372d95, c533b53,
d869ed1, 8b4a5b7)
Docs
- JSON: how to replace hand-built JSON with literals, with a diagnostic
that points there (2722372), and thenullfallbackjsonParse
already returns (8b2a7e0). The tour shows nullable early returns
(79e5cd4); arrays document the checked first-element idiom
(a9e428f); the compiler API shows how a build action reports a failure
with a compile-time panic (7284308).
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 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 onPATH, or whenPATHhas an empty,.or relative
entry. Until v0.2.71, keep everyPATHentry absolute and the tools
installed when you build code you do not trust. (Windows is fixed in this
release; see Fixes.) Fixed in v0.2.71. - A module brought in with
import contractwhose declarations include
trustedorexternfunctions fails to build with
E_PACKAGE_TRUSTED_DENIED, even in your own project. A
[dependencyCompileCapabilities]line does not help, because the
contract's copy of the module belongs to no package. Build such projects
with v0.2.69 until v0.2.71, which fixes it. - 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 runschmod -R go-w -- <dir>on it, and the system's BSD
chmodreads 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.
Bootstrap convergence
Two fresh Linux builders bootstrapped the source of v0.2.70 (93841eec824233d18cfa987bd1bb7d430deac016) from different seeds and reached the same compiler:
- route A: v0.2.69 (
ablac-x86_64-linuxsha256eeddb7c09e282df4b9b7c79714dac68d2ebb21f9a4e7e90c1211f110c7be8f61) -> stage 1, 2, 3 - route B: v0.2.68 (sha256
4f7dee2c7a16826705aa32e7ba5466b599cc1432274190007e4ea582883a3a09) -> the sources of v0.2.69 (150c711dffa00a28993196e4f3d24bc45525878a), twice -> stage 1, 2, 3 - canonical IR (raw, non-debug, pre-prune
--emit-llvm src/orc_main.abat/build/source): sha256611ac5536b27c378569b8a30fb000fff917179d04e764e4534044cdec4ad87dd - stage 2 executable
7c7a74514a345f425275ec1ea5e094e6e9e8c51170dc5f405a5be8f395b89d26, object55021130350e25452b466a23a2763bf2d6ef5cdd50605f934ea353e984b76066 - toolchain: environment
d00897b2d6cc51118a9495656126ec6b32b87504a2eb780e173bac4eec54f68b, closureb1872f918c677d4b376f11826949774047bafeac6c208592b89a05f2dc4640aa - run: https://github.com/AndreBaltazar8/ablac/actions/runs/45466124461
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).