Repository navigation
CI: the hardened Linux arm64 lanes are compiled without -mtune - #916
Conversation
clang emits its copies of glibc's always-inline _FORTIFY_SOURCE wrappers (memcpy.inline, ...) without a tune CPU, and LLVM 23 for AArch64 inlines no such function into one that has one. Out of line, a wrapper cannot see the size of the destination and calls the plain function, so nothing is checked. bun-webkit-linux-arm64-lto-hardened and -lto-hardened-aot lose -mtune=ampere1 and keep -march=armv8-a+crc. No other lane changes, and no toolchain image gets a new tag. A hardened lane now fails when its jsc holds a copy of such a wrapper. That jsc imports a checked function, which is what was looked at so far, says little: one caller is enough.
689e015 to
c8f5604
Compare
There was a problem hiding this comment.
I reviewed this PR and didn't find any bugs. Since .github/ is a CODEOWNERS path and the new Dockerfile check deliberately gates every hardened lane on a hypothesis this PR has not yet built, a human look alongside this PR's own CI run is still worthwhile.
What was reviewed:
- The
MARCH_FLAGconditional in lanes.mjs:-mtune=ampere1is dropped only whenv.hardenedis set, which on arm64 is exactlylto-hardenedandlto-hardened-aot(the arm64 lane list); the other arm64 platforms (musl, FreeBSD, Android) keep-mtunebut have no hardened lanes, so they are unaffected. - The toolchain image tag: it hashes the Dockerfile only up to the end of the
basestage (line 286), and both Dockerfile edits are in the WebKit stage, so no image is retagged. - The new
llvm-nm | grepcheck at Dockerfile:492: same! pipeline || { ...; exit 1; }shape as the existing ENABLE_FUZZILLI check at line 484, it runs on the unstrippedjsc(no-sat link;llvm-stripcomes later on the copy), and C++ mangled names (_Z...) cannot match[a-z_0-9]+. One gap: a copy renamed with a bare numeric suffix (e.g.memcpy.inline.2) would not match, so a pass is slightly weaker than "no copies", not a false failure.
Extended reasoning...
The change touches three files: a one-expression conditional in .github/scripts/lanes.mjs that omits -mtune=ampere1 from the Linux glibc arm64 hardened lanes, a new shell assertion in the Dockerfile's HARDENING_FLAGS block that fails a hardened lane when jsc defines any un-inlined fortify wrapper, and matching comment and CLAUDE.md wording. It touches no auth, crypto or injection surface; it strengthens the _FORTIFY_SOURCE hardening that ships and adds a CI gate for it. Deferral rather than approval rests on two facts: .github/ is covered by the repository's CODEOWNERS file (inherited from upstream), and the author states nothing was built for this PR, so whether the four amd64 hardened lanes pass the new check, and thus whether the release job still gets every asset, is decided by this PR's CI run rather than by reading the diff.
This review covers commit 689e015, which is no longer the latest commit on this pull request; later commits are not covered by it.
### What does this PR do? Moves `WEBKIT_VERSION` from `982277c9dd3e` to `191c6a41380b`, the head of oven-sh/WebKit `main`. > [!NOTE] > The release `autobuild-191c6a41380bb1e2e54be4b6e50ecda83b189f96` was published at 10:39 UTC on 2026-10-27, after this went up. Builds #133617 and #133628 ran before that and failed where they download WebKit (HTTP 404). They say nothing about the change. The PR needs one new build. What the range brings: | Fork PR | What it changes | | --- | --- | | oven-sh/WebKit#912 | The ahead-of-time compiler (890 of the 942 files). Bun does not use it. Outside `aot/`: B3, the marked block cage and its reserve, `Interpreter::getStackTrace`, `ProxyObject`, `JSObject::putDirect`. | | oven-sh/WebKit#916 | The hardened Linux arm64 lanes are compiled without `-mtune`, so that glibc's `_FORTIFY_SOURCE` wrappers are inlined. | | oven-sh/WebKit#917 | The buffer of an old `WeakMap` or `WeakSet` that has shrunk counts until the next full collection. | The pin is the only change Bun needs: - `Heap::didChangeVisitedExtraMemory` is gone. Nothing in Bun calls it. - `Interpreter::getStackTrace` has one more parameter, at the end and with a default. Bun's five callers compile as they are. - The empty table of built-ins in `RemovedFeature.cpp`, which the debug and ASAN builds link: the range adds or removes no `builtinTable*` symbol, no entry of the two list macros and no `extern "C"` hook for the embedder. `BuiltinTable::typedArrayTypeOf`, which is new, is defined in the engine. - No asset is renamed in `lanes.mjs`, and no toolchain pin moves. - `BytecodeList.rb` is unchanged. The one change in the bytecompiler is for private names in object literals, which only built-in code can write, so the hashes in `bundler_bytecode_portable.test.ts` should stay. ### How did you verify your code works? Nothing was built. The list above is from reading the diff of the two commits against Bun's sources. The release has the same 77 asset names as the one of the old pin, all uploaded, and among them the 13 that the `build-bun` jobs of #133628 asked for. All 85 jobs of the fork's build of this commit passed, its JavaScriptCore tests on Linux x64 and arm64 included. `test/js/bun/jsc/webkit-upgrade-191c6a4138.test.ts` covers oven-sh/WebKit#917: | Binary | Result | | --- | --- | | `main`'s CI build (92e819d, linux x64, the old pin) | 0 pass, 2 fail: the heap is 262,032 bytes (`WeakMap`) and 129,498 bytes (`WeakSet`) smaller after the eden collection | | Bun 1.4.4 (an engine from before the bug) | 2 pass | Both the same with `BUN_GARBAGE_COLLECTOR_LEVEL` 0, 1 and 2. It has not run on the new engine yet: CI is the first run. `bun test test/internal/source-lints/` passes (186). --- _Generated by [Claude Code](https://claude.ai/code/session_01YF5TQxMfo4rBWHbttbVAhn)_ --------- Co-authored-by: Claude <[email protected]>
The two hardened Linux arm64 lanes lose
-mtune=ampere1, so that glibc's_FORTIFY_SOURCEwrappers are inlined again. A hardened lane now also fails when they are not.What was wrong
Seen with
autobuild-982277c9dd3ee8177ca578e6d871428faeb5021f/bun-webkit-linux-arm64-lto-hardened.tar.gz, linked into a Linux aarch64 glibc release LTO build of Bun with--hardened=on, LLVM 23. The linked binary defines 187 local symbols that are out-of-line copies of glibc's always-inline fortify wrappers:The same build against
bun-webkit-linux-arm64-lto.tar.gzhas 0, and so has a Linux x64 build againstbun-webkit-linux-amd64-lto-hardened.tar.gz. Out of line, a wrapper cannot see the size of the destination, so it calls the plain function: no__memcpy_chkand so on.Likely cause
clang emits its copies of the wrappers (
memcpy.inline, ...) without a tune CPU, and LLVM 23's AArch64 inliner does not inline them into functions that have one ("conflicting target features"). clang 22 does.The change
MARCH_FLAGbeforebun-webkit-linux-arm64-lto-hardened--target=aarch64-unknown-linux-gnu -march=armv8-a+crc -mtune=ampere1--target=aarch64-unknown-linux-gnu -march=armv8-a+crcbun-webkit-linux-arm64-lto-hardened-aotCompared with
lanes.mjs --jsonbefore and after: of the 76 lanes these two change, inMARCH_FLAGalone. The four hardened amd64 lanes and the other arm64 lanes are as they were, and no toolchain image gets a new tag.A check, so that CI says whether this is the cause
That this is the cause has not been confirmed on the WebKit side, and nothing was built for this pull request. So
Dockerfilenow runs thellvm-nmline above on thejscof every hardened lane and fails the lane when it prints anything.What was checked so far is that
jscimports some__*_chkfunction. That passed on the broken lanes: one caller anywhere is enough.-mtunewas the cause, and it is fixed.jschas copies that the Bun build above did not show, which is worth knowing too.The shell logic of the new line was tried on stand-in symbol tables (
memcpy.inlineandvsnprintf.inline.llvm.123are caught;foo.inlinedand_ZN3WTF6inlineEvare not).Not measured
What the hardened arm64 lanes lose in speed without
-mtune=ampere1. The lanes that are not hardened keep it.To check a tarball from this pull request
Link Bun against it. The
llvm-nmline should print nothing, and the disassembly should show calls to__memcpy_chkfromJSC::andWTF::functions.Generated by Claude Code