Skip to content

Check requirements for the build - #29

Merged
Jarred-Sumner merged 1 commit into
oven-sh:mainfrom
alexkuz:patch-1
Sep 26, 2021
Merged

Jarred-Sumner merged 1 commit into
oven-sh:mainfrom
alexkuz:patch-1

Conversation

@alexkuz

@alexkuz alexkuz commented Sep 26, 2021

Copy link
Copy Markdown
Contributor

(variables rearranged to avoid errors if package dirs don't exist yet)

@Jarred-Sumner
Jarred-Sumner merged commit a113603 into oven-sh:main Sep 26, 2021
@Jarred-Sumner
Jarred-Sumner deleted the patch-1 branch September 26, 2021 01:03
@Jarred-Sumner

Copy link
Copy Markdown
Collaborator

Thank you!

Jarred-Sumner pushed a commit that referenced this pull request Aug 8, 2025
<details>

<summary> observed in
https://buildkite.com/bun/bun/builds/22442#annotation-test/js/node/zlib/leak.test.ts
</summary>

```
==5045==ERROR: AddressSanitizer: heap-use-after-free on address 0x5220000243c0 at pc 0x00000dad671b bp 0x14f22d4a4990 sp 0x14f22d4a4988
READ of size 8 at 0x5220000243c0 thread T5 (HeapHelper)
======== Stack trace from GDB for HeapHelper-5045.core: ========
Program terminated with signal SIGABRT, Aborted.
#0  0x000014f2c3672eec in ?? () from /lib/x86_64-linux-gnu/libc.so.6
[Current thread is 1 (Thread 0x14f22d4f46c0 (LWP 5050))]
#0  0x000014f2c3672eec in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x000014f2c3623fb2 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x000014f2c360e472 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#3  0x000000000e3b2ae2 in uw_init_context_1[cold] ()
#4  0x000000000e3b29fc in _Unwind_Backtrace ()
#5  0x00000000046a6bab in __sanitizer::BufferedStackTrace::UnwindSlow(unsigned long, unsigned int) ()
#6  0x00000000046a181d in __sanitizer::BufferedStackTrace::Unwind(unsigned int, unsigned long, unsigned long, void*, unsigned long, unsigned long, bool) ()
#7  0x00000000046885bd in __sanitizer::BufferedStackTrace::UnwindImpl(unsigned long, unsigned long, void*, bool, unsigned int) ()
#8  0x0000000004601127 in __asan::ErrorGeneric::Print() ()
#9  0x0000000004683180 in __asan::ScopedInErrorReport::~ScopedInErrorReport() ()
#10 0x0000000004686567 in __asan::ReportGenericError(unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned long, unsigned int, bool) ()
#11 0x0000000004686d46 in __asan_report_load8 ()
#12 0x000000000dad671b in ZSTD_sizeof_CCtx (cctx=<optimized out>) at ./build/release-asan/zstd/vendor/zstd/lib/compress/zstd_compress.c:210
#13 0x0000000006d2284d in bun.js.node.zlib.NativeZstd.estimatedSize () at /var/lib/buildkite-agent/builds/ip-172-31-72-121/bun/bun/src/bun.js/node/zlib/NativeZstd.zig:57
#14 ZigGeneratedClasses.JSNativeZstd.JavaScriptCoreBindings.NativeZstd__estimatedSize (thisValue=<optimized out>) at /var/lib/buildkite-agent/builds/ip-172-31-72-121/bun/bun/build/release-asan/codegen/ZigGeneratedClasses.zig:11122
#15 0x000000000852803b in WebCore::JSNativeZstd::visitChildrenImpl<JSC::SlotVisitor> (cell=0x14f22e190840, visitor=...) at ./build/release-asan/./build/release-asan/codegen/ZigGeneratedClasses.cpp:30728
#16 WebCore::JSNativeZstd::visitChildren (cell=0x14f22e190840, visitor=...) at ./build/release-asan/./build/release-asan/codegen/ZigGeneratedClasses.cpp:30734
#17 0x000000000aa99d6c in JSC::MethodTable::visitChildren (this=<optimized out>, cell=<optimized out>, visitor=...) at vendor/WebKit/Source/JavaScriptCore/runtime/ClassInfo.h:115
#18 0x000000000aa99d6c in JSC::SlotVisitor::visitChildren (this=0x14f277028300, cell=0x14f22e190840)
#19 JSC::SlotVisitor::drain(WTF::MonotonicTime)::$_0::operator()(JSC::MarkStackArray&) const (this=<optimized out>, stack=...) at vendor/WebKit/Source/JavaScriptCore/heap/SlotVisitor.cpp:509
#20 0x000000000aa8f130 in JSC::SlotVisitor::forEachMarkStack<JSC::SlotVisitor::drain(WTF::MonotonicTime)::$_0>(JSC::SlotVisitor::drain(WTF::MonotonicTime)::$_0 const&) (this=0x14f277028300, func=...) at vendor/WebKit/Source/JavaScriptCore/heap/SlotVisitorInlines.h:193
#21 JSC::SlotVisitor::drain (this=this@entry=0x14f277028300, timeout=<error reading variable: That operation is not available on integers of more than 8 bytes.>, timeout@entry=...) at vendor/WebKit/Source/JavaScriptCore/heap/SlotVisitor.cpp:499
#22 0x000000000aa90590 in JSC::SlotVisitor::drainFromShared (this=0x14f277028300, sharedDrainMode=JSC::SlotVisitor::HelperDrain, timeout=<error reading variable: That operation is not available on integers of more than 8 bytes.>) at vendor/WebKit/Source/JavaScriptCore/heap/SlotVisitor.cpp:699
#23 0x000000000aa08726 in JSC::Heap::runBeginPhase(JSC::GCConductor)::$_1::operator()() const (this=<optimized out>) at vendor/WebKit/Source/JavaScriptCore/heap/Heap.cpp:1508
#24 WTF::SharedTaskFunctor<void (), JSC::Heap::runBeginPhase(JSC::GCConductor)::$_1>::run() (this=<optimized out>) at .WTF/Headers/wtf/SharedTask.h:91
#25 0x000000000aa3b596 in WTF::ParallelHelperClient::runTask(WTF::RefPtr<WTF::SharedTask<void ()>, WTF::RawPtrTraits<WTF::SharedTask<void ()> >, WTF::DefaultRefDerefTraits<WTF::SharedTask<void ()> > > const&) (this=0x14f22e000428, task=...) at vendor/WebKit/Source/WTF/wtf/ParallelHelperPool.cpp:110
#26 0x000000000aa3d976 in WTF::ParallelHelperPool::Thread::work (this=<optimized out>) at vendor/WebKit/Source/WTF/wtf/ParallelHelperPool.cpp:201
#27 0x000000000aa4210d in WTF::AutomaticThread::start(WTF::AbstractLocker const&)::$_0::operator()() const (this=<optimized out>) at vendor/WebKit/Source/WTF/wtf/AutomaticThread.cpp:225
#28 WTF::Detail::CallableWrapper<WTF::AutomaticThread::start(WTF::AbstractLocker const&)::$_0, void>::call() (this=<optimized out>) at vendor/WebKit/Source/WTF/wtf/Function.h:53
#29 0x0000000008958ada in WTF::Function<void ()>::operator()() const (this=<optimized out>) at vendor/WebKit/Source/WTF/wtf/Function.h:82
#30 WTF::Thread::entryPoint (newThreadContext=<optimized out>) at vendor/WebKit/Source/WTF/wtf/Threading.cpp:272
#31 0x0000000008a65689 in WTF::wtfThreadEntryPoint (context=0x13b5) at vendor/WebKit/Source/WTF/wtf/posix/ThreadingPOSIX.cpp:255
#32 0x000000000467d347 in asan_thread_start(void*) ()
#33 0x000014f2c36711f5 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#34 0x000014f2c36f189c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
```

</details>

`ZSTD_sizeof_CCtx` and `ZSTD_sizeof_DCtx` can not be relied upon to be
thread-safe and estimatedSize may be called from any thread
Jarred-Sumner pushed a commit that referenced this pull request May 3, 2026
…before write (#30155)

## Repro

```js
Bun.serve({
  port: 0,
  fetch: () =>
    new Response("hello", {
      headers: [
        ["Transfer-Encoding", "gzip"],
        ["Transfer-Encoding", "chunked"],
      ],
    }),
});
// HEAD / → ASAN heap-use-after-free in uWS::HttpResponse::writeHeader
```

The duplicate entries make `FetchHeaders` combine them via
`makeString()`, producing a `StringImpl` held only by the header map —
the minimal condition for the free to actually happen.

StringImpl is allocated via bmalloc which ASAN doesn't instrument by
default; with `Malloc=1` (bmalloc → system heap) the debug build
reports:

```
AddressSanitizer: heap-use-after-free
READ of size 13
  #2 uWS::HttpResponse<false>::writeHeader
  #5 doRenderHeadResponse  RequestContext.zig:1378
freed by:
  #23 HTTPHeaderMap::remove
  #28 doWriteHeaders       RequestContext.zig:2303
  #29 renderMetadata       RequestContext.zig:2209
  #30 doRenderHeadResponse RequestContext.zig:1377
```

## Cause

`doRenderHeadResponse()` calls `headers.fastGet(.TransferEncoding)`,
which returns a `ZigString` that **borrows** the header map entry's
`StringImpl` bytes (no ref taken). For an ASCII value, `toSlice()` also
borrows rather than copying. It then calls `this.renderMetadata()`,
whose `doWriteHeaders()` does `headers.fastRemove(.TransferEncoding)`
(and `renderMetadata` also `swapInitHeaders()` + `deref()`s the whole
`FetchHeaders`). When the map held the only reference to the
`StringImpl`, it's destroyed right there — and the very next line
`resp.writeHeader("transfer-encoding", transfer_encoding_str.slice())`
writes the freed bytes to the socket.

The adjacent `Content-Length` branch has the same bug:
`std.fmt.parseInt()` runs on the borrowed slice *after*
`renderMetadata()` has already `fastRemove(.ContentLength)`'d it.

## Fix

- **Transfer-Encoding**: use `toSliceClone()` instead of `toSlice()` so
the value is owned and survives `renderMetadata()`.
- **Content-Length**: parse the integer *before* `renderMetadata()` (and
drop the slice immediately), so the borrowed bytes are never touched
after the header entry is removed. No extra allocation needed since only
the parsed `usize` is used afterwards.

## Verification

New test in `test/js/bun/http/bun-server.test.ts` (inside the existing
`HEAD requests #15355` block) spawns a subprocess with `Malloc=1`
(non-Windows), serves HEAD responses whose Transfer-Encoding /
Content-Length values are `makeString()`-combined (sole-owner
StringImpl), and asserts the raw wire output.

```
git stash push -- src/   → test fails with "AddressSanitizer: heap-use-after-free" in stderr
git stash pop            → test passes
```

All other tests in the `HEAD requests #15355` describe block continue to
pass.

Co-authored-by: robobun <robobun@users.noreply.github.com>
xhjkl pushed a commit to xhjkl/bun that referenced this pull request May 14, 2026
…before write (oven-sh#30155)

## Repro

```js
Bun.serve({
  port: 0,
  fetch: () =>
    new Response("hello", {
      headers: [
        ["Transfer-Encoding", "gzip"],
        ["Transfer-Encoding", "chunked"],
      ],
    }),
});
// HEAD / → ASAN heap-use-after-free in uWS::HttpResponse::writeHeader
```

The duplicate entries make `FetchHeaders` combine them via
`makeString()`, producing a `StringImpl` held only by the header map —
the minimal condition for the free to actually happen.

StringImpl is allocated via bmalloc which ASAN doesn't instrument by
default; with `Malloc=1` (bmalloc → system heap) the debug build
reports:

```
AddressSanitizer: heap-use-after-free
READ of size 13
  oven-sh#2 uWS::HttpResponse<false>::writeHeader
  oven-sh#5 doRenderHeadResponse  RequestContext.zig:1378
freed by:
  oven-sh#23 HTTPHeaderMap::remove
  oven-sh#28 doWriteHeaders       RequestContext.zig:2303
  oven-sh#29 renderMetadata       RequestContext.zig:2209
  oven-sh#30 doRenderHeadResponse RequestContext.zig:1377
```

## Cause

`doRenderHeadResponse()` calls `headers.fastGet(.TransferEncoding)`,
which returns a `ZigString` that **borrows** the header map entry's
`StringImpl` bytes (no ref taken). For an ASCII value, `toSlice()` also
borrows rather than copying. It then calls `this.renderMetadata()`,
whose `doWriteHeaders()` does `headers.fastRemove(.TransferEncoding)`
(and `renderMetadata` also `swapInitHeaders()` + `deref()`s the whole
`FetchHeaders`). When the map held the only reference to the
`StringImpl`, it's destroyed right there — and the very next line
`resp.writeHeader("transfer-encoding", transfer_encoding_str.slice())`
writes the freed bytes to the socket.

The adjacent `Content-Length` branch has the same bug:
`std.fmt.parseInt()` runs on the borrowed slice *after*
`renderMetadata()` has already `fastRemove(.ContentLength)`'d it.

## Fix

- **Transfer-Encoding**: use `toSliceClone()` instead of `toSlice()` so
the value is owned and survives `renderMetadata()`.
- **Content-Length**: parse the integer *before* `renderMetadata()` (and
drop the slice immediately), so the borrowed bytes are never touched
after the header entry is removed. No extra allocation needed since only
the parsed `usize` is used afterwards.

## Verification

New test in `test/js/bun/http/bun-server.test.ts` (inside the existing
`HEAD requests oven-sh#15355` block) spawns a subprocess with `Malloc=1`
(non-Windows), serves HEAD responses whose Transfer-Encoding /
Content-Length values are `makeString()`-combined (sole-owner
StringImpl), and asserts the raw wire output.

```
git stash push -- src/   → test fails with "AddressSanitizer: heap-use-after-free" in stderr
git stash pop            → test passes
```

All other tests in the `HEAD requests oven-sh#15355` describe block continue to
pass.

Co-authored-by: robobun <robobun@users.noreply.github.com>
Jarred-Sumner pushed a commit that referenced this pull request May 25, 2026
## What

Moves the `Bun.stringWidth` implementation from Rust to C++ with
explicit SIMD, as requested.

- **New `src/jsc/bindings/stringWidth.cpp` / `stringWidth.h`** — the
full visible-width engine: codepoint classification (zero-width, East
Asian `W`/`F`, ambiguous), grapheme cluster break (UAX #29 incl. GB9c,
the uucode-derived 3-stage tables now live in the generated
`stringWidthTables.h`), the grapheme-cluster width accumulator (ZWJ
emoji, regional-indicator flags, keycaps, skin tones, VS15/VS16),
Latin-1 / UTF-8 / UTF-16 width functions with CSI/OSC handling,
`utf8IndexAtWidth`, and the `Bun.stringWidth` host function (same
`countAnsiEscapeCodes` / `ambiguousIsNarrow` options, same defaults,
same coercion semantics).
- **Explicit SIMD via highway** — five kernels in `highway_strings.cpp`
(`highway_visible_latin1_width`,
`highway_visible_latin1_width_exclude_ansi`,
`highway_count_printable_ascii16`, `highway_first_non_ascii8/16`) using
the existing dynamic-dispatch pattern. The default (ANSI-excluding)
Latin-1 path is a single-pass kernel: each chunk is classified once into
printable/ESC/CSI-final/OSC-terminator bitmasks and escape regions are
carved out with a few bit ops per escape, with in-CSI/in-OSC state
carried across chunks. The UTF-16 path's escape scanning still reuses
the `WTF::SIMD` helpers in `ANSIHelpers.h` shared with
stripANSI/wrapAnsi/sliceAnsi.
- **Registration** — `stringWidth` now points at
`jsFunctionBunStringWidth` in the BunObject LUT; the
`BunObject_callback_stringWidth` Rust callback and `macro(stringWidth)`
are gone. The readline / `util.inspect` / console.table builtins switch
from `$newZigFunction("string.zig", "String.jsGetStringWidth")` to
`$newCppFunction("stringWidth.cpp", "jsFunctionBunStringWidth")`.
- **Rust deletions** — `visible.rs` (1.6k lines) is now a ~70-line FFI
shim that preserves the
`bun.strings.visible::width::exclude_ansi_colors::{latin1,utf8,utf16,utf8_index_at_width}`
paths for the remaining Rust callers (console.table column sizing in
`ConsoleObject.rs`, the markdown ANSI renderer). `grapheme.rs`,
`grapheme_tables.rs`, the `.zig` porting references, the dead
`visible_fallback` module, `index_of_char16_usize`, and the
`icu_hasBinaryProperty` shim (all only existed to support the Rust width
code) are deleted. `String::visible_width` (include-ANSI variant) had no
remaining callers and is removed;
`String::visible_width_exclude_ansi_colors` keeps working through the
shim.
- **`sliceAnsi.cpp` / `wrapAnsi.cpp` are untouched** — they keep calling
`Bun__codepointWidth`, `Bun__graphemeBreak`, `Bun__isEmojiPresentation`,
`Bun__visibleWidthExcludeANSI_{latin1,utf16}`, which are now defined in
`stringWidth.cpp` instead of Rust.

## Why

The Rust implementation's `u8x16`/`u16x8` "vectors" are scalar `for`
loops that rely on LLVM's SLP autovectorizer to become SIMD — ~2.3×
slower than real vector code on the ASCII path, and much worse under
macOS LTO where `ld64.lld`'s pipeline doesn't run the SLP pass (see
#31348 / #31349 for the build-side workarounds). Explicit highway
kernels remove the dependency on the optimizer entirely and let x64 use
256/512-bit vectors via dynamic dispatch.

## SIMD choice: highway vs WTF::SIMD

Microbenchmark of the "count visible Latin-1 bytes" kernel (x64,
AVX-512-capable host, clang 21 `-O3 -march=haswell`, same flags as the
build):

| input | scalar (autovec, ≈ current Rust) | scalar no-vec (≈ macOS LTO
case) | 128-bit SSE2 (≈ WTF::SIMD / old Zig `@Vector`) | highway static
(AVX2) | highway dynamic (selects AVX3_DL) |
|---|---|---|---|---|---|
| 16 B | 8.1 ns | 45.6 ns | 3.2 ns | 2.0 ns | 6.0 ns |
| 64 B | 28.4 ns | 175 ns | 5.9 ns | 5.1 ns | **3.9 ns** |
| 256 B | 110 ns | 702 ns | 14.8 ns | 10.4 ns | **7.8 ns** |
| 1 KiB | 437 ns | 2843 ns | 61 ns | 37 ns | **14.2 ns** |
| 16 KiB | 7165 ns | 44987 ns | 959 ns | 588 ns | **128 ns** |

Highway dynamic dispatch (the existing `highway_strings.cpp` pattern)
wins from 64 B up — 2–7× over the 128-bit WTF::SIMD-style kernel and
14–56× over the scalar path — because it can use AVX2/AVX-512 vectors at
runtime. Only at ≤16 B does the dispatch indirection cost ~3 ns, which
is noise next to the JS→native call. On arm64 NEON both highway and
WTF::SIMD compile to 128-bit vectors, so expect parity with the old Zig
`@Vector(16, u8)` code there (not measured here — x64-only container).

## End-to-end numbers (mitata, `bench/snippets/string-width.mjs`)

> **Note:** the table below is from the initial version of this PR.
After the review, the dense-SGR regression was fixed and the
classification path tightened — see [the post-review benchmark
comment](#31351 (comment))
for current numbers (no input slower than the current canary at any
size).

Release build of this branch vs release build of main (`f161e0311`),
same machine:

| input (release builds, x64 AVX-512 host) | main (Rust) | this PR (C++
+ highway) | speedup |
|---|---|---|---|
| ascii, 11 chars | 33.4 ns | 24.9 ns | 1.3× |
| ascii, 46 chars | 56.3 ns | 27.8 ns | 2.0× |
| ascii, 460 chars | 262 ns | 28.8 ns | 9.1× |
| ascii, 4.6k chars | 2.33 µs | 106 ns | 22× |
| ansi-heavy (SGR + truecolor), 1× | 115 ns | 83.5 ns | 1.4× |
| ansi-heavy, 10× | 818 ns | 774 ns | 1.06× |
| ansi-heavy, 100× | 7.74 µs | 7.61 µs | 1.02× |
| OSC-8 hyperlinks, 10× | 1.75 µs | 1.20 µs | 1.5× |
| emoji (ZWJ/flags/keycaps), 1× | 506 ns | 316 ns | 1.6× |
| emoji, 20× | 9.36 µs | 6.28 µs | 1.5× |
| CJK, 1× | 606 ns | 347 ns | 1.7× |
| CJK, 20× | 11.8 µs | 6.93 µs | 1.7× |
| mixed unicode, 10× | 11.2 µs | 7.05 µs | 1.6× |
| ascii 460 chars, countAnsiEscapeCodes | 406 ns | 139 ns | 2.9× |
| ansi-heavy 10×, countAnsiEscapeCodes | 487 ns | 157 ns | 3.1× |
| emoji 20×, countAnsiEscapeCodes | 9.47 µs | 6.37 µs | 1.5× |

(mitata, `avg` column; "main" = release build of f161e03, "this PR" =
release build of this branch on the same machine. The short-string cases
are dominated by the JS→native call itself; the per-escape-sequence
structure of the ansi-heavy case limits it to parity-or-better — the win
there comes from the `countAnsiEscapeCodes: true` path and the OSC
scanning.)

## Behavior / tests

- The existing `Bun.stringWidth` suite passes unchanged (112 tests),
plus new cases for the ASCII fast path (SIMD chunk-boundary lengths,
Latin-1 high bytes, ASCII stored in 16-bit strings), ANSI sequences
mid-string (SGR + OSC-8 in both Latin-1 and UTF-16 strings,
`countAnsiEscapeCodes` both ways), emoji/ZWJ sequences, and East Asian
wide/ambiguous characters — 123 total.
- `sliceAnsi` (incl. fuzz), `wrapAnsi`, `stripANSI`, `console.table`
snapshot, `Bun.inspect.table`, markdown-renderer, node `readline`
`getStringWidth` suites all pass against the debug (ASAN) build.
- Edge-case coercion parity spot-checked against the previous
implementation (`undefined`/`null`/numbers/objects as input,
falsy-string vs falsy-number option values, Symbol throwing): identical
results.
- One pre-existing exception: `sliceAnsi adversarial > many SGR codes
don't overflow or quadratic-slow` exceeds its 5 s debug-build time bound
on this (heavily throttled) container — 20.6 ms/iter inside
`sliceAnsi.cpp`'s own SGR handling under ASAN, vs 0.07 ms/iter in
release. The code it times is untouched by this PR (`Bun.stringWidth` on
the same adversarial input takes 0.17 ms/iter on the same debug build).

## Related issues

- #8782 (switch from `@Vector`-style SIMD to Google Highway with runtime
dispatch) — this PR does that for the stringWidth / visible-width paths,
but not codebase-wide, so it is not closed by this PR.
- The find-issues bot also suggested #8329, #6776 and #30693; those are
behavior bugs/requests that a behavior-preserving port does not address,
so they are intentionally not auto-closed here.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
dylan-conway pushed a commit that referenced this pull request Aug 21, 2026
…g platform characters (#39801)

Merge after oven-sh/bun.report#32 is deployed. bun.report rejects the
new characters until then.

### Problem
- `Platform::CURRENT` (src/crash_handler/lib.rs) emits `'l'`/`'L'` for
every Linux build. The glibc, musl and android builds of a commit are
three binaries with three profile zips, and bun.report picks one by this
character. Every musl or android crash report is symbolicated against
the glibc binary and shows plausible but wrong frames.
- BUN-4MRJ is one: reported as a segfault in
`NestedRuleParser::parse_block` (`css_parser.rs:1738`), it is a
`VariableEnvironment` lookup on a bad `UniquedStringImpl*` against the
musl profile (notes).

### Fix
- musl builds emit `'u'`/`'U'`, android builds `'a'`/`'A'`, and
`'l'`/`'L'` mean glibc. Lowercase is x86_64, uppercase aarch64.
bun.report#32 decodes them.
- Shipped binaries keep emitting `'l'`/`'L'`, which bun.report keeps
decoding as glibc.
- The format is unchanged. #38838 (a debug id in a new format) verifies
the downloaded file instead. The two compose: here the first download is
right, and the URL says which build crashed.
- Verified: CI build 101799 ran an assertion on the Alpine x64 and
aarch64 lanes that the build emits `'u'`/`'U'`. It passed and was then
removed at review, since it only mirrored the table. Also `cargo check
-p bun_crash_handler` for gnu, musl and android, and clippy.

### Background
- Trace string: the `https://bun.report/<version>/<payload>` URL in a
crash report. The payload starts with the platform character, then
command character, format version and sha. bun.report maps the character
to an artifact name.
- The baseline characters (`'B'`, `'b'`, `'e'`) did the same for the old
baseline binaries until #34782 made x64 one binary.

<details><summary>Notes</summary>

The human-readable report header already says `musl` or `Android ...
bionic`; only the trace string lacked the distinction.

BUN-4MRJ, trace `1.4.0/L_134cbb9aEggggC+98pvDA2Dhggw6jC` (commit
`34cbb9a40`), one address `0x37a79df`, fault address
`0xFFFFFFFFBC2C0000`. `llvm-symbolizer --inlines --relative-address`
against the 1.4.0 release profiles:

- `bun-linux-aarch64-profile.zip` (what bun.report used):
`<NestedRuleParser<BundlerAtRuleParser> as AtRuleParser>::parse_block`,
`src/css/css_parser.rs:1738`.
- `bun-linux-aarch64-musl-profile.zip`, fault pc `0x37a79e0`:
`WTF::InlineMap<PackedRefPtr<UniquedStringImpl>,
JSC::VariableEnvironmentEntry, 9>::findKeyOrEmpty<const
UniquedStringImpl*>` (`InlineMap.h:725`) > `findKeyOrEmptyInStorage`
(`InlineMap.h:703`) > `JSC::IdentifierRepHash::hash`
(`Identifier.h:235`) > `SymbolImpl::existingSymbolAwareHash` >
`StringImpl::isSymbol` (`StringImpl.h:334`). That is the load of
`m_hashAndFlags` (offset 0x10) through the lookup key, so the key the
caller passed was `0xFFFFFFFFBC2BFFF0`: a user-space pointer truncated
to 32 bits and sign-extended. The scope had more than 9 variables
(out-of-line storage). The trace has no caller frame, so the report says
nothing more about the crash. It is not a CSS crash. It is almost
certainly a musl build: the musl reading accounts for the fault address
exactly (key + 0x10), the glibc reading needs a frame pointer that
changed between two adjacent loads, and in the android build the address
is data (`.text` ends at 0x32ea060).

Which byte values: `'u'`/`'U'` and `'a'`/`'A'` are unused in
bun.report's table (`w e W m b M l B L f F`). The reason and command
characters are separate positions, so they do not constrain the choice.

`scripts/ci-remap-server` pins `bun-tracestrings` at bun.report 912ca63,
which does not decode these characters (nor the `'a'`/`'b'` reasons or
FreeBSD from #29 and bun.report#29). A crash on the Alpine CI lanes
prints the raw trace string in the annotation instead of a remap until
the pin is bumped, as SIGABRT and SIGTRAP crashes do on every lane
today. #38838 bumps the pin as part of its landing.

</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants