Crash in [@ alloc::raw_vec::handle_error]
Categories
(Application Services :: General, defect)
Tracking
(firefox-esr153 unaffected, firefox158 fixed, firefox159 fixed, firefox160 fixed)
| Tracking | Status | |
|---|---|---|
| firefox-esr153 | --- | unaffected |
| firefox158 | --- | fixed |
| firefox159 | --- | fixed |
| firefox160 | --- | fixed |
People
(Reporter: clouseau-bot, Assigned: bdk)
References
(Blocks 1 open bug)
Details
(Keywords: crash, regression)
Crash Data
Crash report: https://crash-stats.mozilla.org/report/index/01038f86-3e0e-4244-b539-a97c30261020
Reports with a different stack in the same spike: https://crash-stats.mozilla.org/report/index/02a2a43b-b12e-43c1-8af2-3e9090261017, https://crash-stats.mozilla.org/report/index/00496e05-741b-48de-85d6-e5b9d0261019
Crash Reason:
SIGABRT / SI_TKILL at 0x0000278400004a88
Top 10 frames:
0 libc.so
1 libmegazord.so std::sys::pal::unix::abort_internal
2 libmegazord.so std::process::abort
3 libmegazord.so std::alloc::rust_oom::{{closure}}
4 libmegazord.so std::sys::backtrace::__rust_end_short_backtrace
5 libmegazord.so std::alloc::rust_oom
6 libmegazord.so __rustc::__rust_alloc_error_handler
7 libmegazord.so alloc::alloc::handle_alloc_error
8 libmegazord.so alloc::raw_vec::handle_error
9 libmegazord.so uniffi_core::ffi::callbackinterface::UnexpectedUniFFICallbackError::new
Filed because this signature's crash volume spiked. 214 reports from 198 distinct installations on the release build of 2026-10-07 (buildid 20261007201254); the preceding 1 build-day had 1 report, and the loudest of its 5 earlier builds in the 42 days before had 17. That is 12.6x the loudest of the preceding build-days and of this signature's builds over the 42 days before (Clouseau's bar is 3x, and the Poisson excess of the day against that baseline is z = 20.95, bar 3.62). This signature is not new: its first report is in build 20240618215959 (2024-06-18), 841 days before this build.
Clouseau analysis (automated -- nothing below was checked by a human; a claim it could not ground is deliberately absent):
Fenix 158.0 aborts in UnexpectedUniFFICallbackError::new (reason.to_string()) when Rust fails to allocate a copy of the error message lifted from the Kotlin viaduct HTTP backend's foreign-future result. Every crash goes through viaduct's UniFFICallbackHandlerBackend::send_request (from Nimbus, ads, push, FxA and Remote Settings), on the unexpected-error branch of lift_foreign_return. The String lift there takes the buffer's length without validating it. With seconds of uptime and over 1 GB of address space free, the most likely cause is a garbage error buffer rather than real memory exhaustion. The crash is new with 158.0 (about 3 per 1000 crashes, against 0.12 on 156.0.1, steady across 158.0's life). It arrived with the UniFFI 0.32 app-services update (bug 2068665), which Bugzilla records as the cause of a sibling corruption crash on the success path of the same viaduct lift (bug 2073758, 1,839 crashes, all on 158.0). Next step: check whether bug 2073758's fix also covers the unexpected-error branch, and look at the Kotlin/Rust ForeignFutureResult handling that changed in 0.32.
Suspected regressor (medium confidence): cd446226a364 (bug 2068665) by :bdk.
This change moved app-services to UniFFI 0.32. The crashing frames run uniffi_core-0.32.1, and the crash cohort shows up only from 158.0 on. Bugzilla records 2068665 as the cause of bug 2073758, a corruption crash in the success branch of the same viaduct foreign-future lift, also 100% on 158.0. That fits a corrupted ForeignFutureResult/RustCallStatus handed from Kotlin to Rust, which on the unexpected-error branch would give String::try_lift a garbage length. I read the diff only in part (truncated at 400 lines; it is mostly Cargo bumps and ads-client changes). I did not find the hunk that corrupts the result, so the link rests on version timing and the sibling regression, not on a located defect.
Possible path to the crash:
Mechanism (observed): alloc::raw_vec::handle_error -> handle_alloc_error -> rust_oom -> abort in libmegazord.so. The failing allocation is the Vec::with_capacity inside reason.to_string() at UnexpectedUniFFICallbackError::new (callbackinterface.rs:120), called from LiftReturn::lift_foreign_return (ffi_converter_traits.rs:371). No allocation size is recorded.
Path (observed in frames, source read at eb9a6e3a7368, which vendors uniffi_core 0.32.0 while the binary used 0.32.1; line numbers match):
- A Rust component (Nimbus
fetch_experiments, adsrequest_tile_ads, pushverify_connection, and others) callsviaduct::Request::send, whichpollster::block_onsforeign_async_callto the KotlinBackend::send_request. - The future completes with a
RustCallStatus.codethat is neitherSuccessnorError, solift_foreign_returntakes its_arm. <String as FfiConverter>::try_liftturnserror_bufinto aStringwithdestroy_into_vec+from_utf8_unchecked, so the length is never validated.UnexpectedUniFFICallbackError::newcopies that string, and the allocation oflenbytes fails, so the process aborts.
Trigger (inferred, medium): the length in error_buf is garbage, or the whole RustCallStatus is, rather than the device being out of memory. The sample report had 3 s uptime and 1.36 GB of available virtual memory, which makes a failed short-string copy unlikely. The same viaduct lift on its success path corrupts Response in 158.0 (bug 2073758). A genuinely huge Kotlin exception message is not excluded.
Checked:
UnexpectedUniFFICallbackError::newdoesreason.to_string()at line 120. (third_party/rust/uniffi_core/src/ffi/callbackinterface.rs@eb9a6e3a7368:117-122)- The
_arm oflift_foreign_returnliftscall_status.error_bufas aStringand passes it toUnexpectedUniFFICallbackError::newat line 371. (third_party/rust/uniffi_core/src/ffi_converter_traits.rs@eb9a6e3a7368:357-374) String::try_liftconverts theRustBufferwithfrom_utf8_unchecked, without checking the length or the UTF-8. (third_party/rust/uniffi_core/src/ffi_converter_impls.rs@eb9a6e3a7368:135-143)- The crashing binary is
libmegazord.sobuilt against crates.iouniffi_core-0.32.1. The in-tree vendored copy read here is 0.32.0, so the source is approximate, but the cited lines match. (report 01038f86-3e0e-4244-b539-a97c30261020 frames #9-#10; third_party/rust/uniffi_core/Cargo.toml@eb9a6e3a7368:15) - The sample report had 3 s uptime and 1,360,396,288 bytes of available virtual memory, with 104,976,384 bytes of physical memory free. (report 01038f86-3e0e-4244-b539-a97c30261020)
- On 158.0 the per-1000 rate is steady at about 2-5 from its first days (10-09: 1/278, 10-11: 3/758, 10-19: 50/14673), against 0.12 on 156.0.1. The rise in counts tracks adoption, not an event on 2026-10-13. [derived] (brief, CRASH RATE BY VERSION per-day rows)
- From build 20261007201254 on, all 218 crashes have Rust toolchain
4a4ef493…topmost files (libmegazord). Before it, the 81 crashes were mostly earlier toolchains andmfbt/assertions.h(Gecko OOM-hook path). (facets topmost_filenames, 60d, split_at_build 20261007201254) - Of the 319 release crashes in 90 days, 218 (68%) are on 158.0. No earlier version has more than 18. (facets version, 90d)
Alternatives considered:
- Genuine device memory exhaustion as the usual cause: disfavored -- the copy is normally a short
e.toString(), the sample had 3 s uptime and 1.36 GB of virtual memory free, and the rate jumped about 25x at a version boundary rather than tracking device memory. Not excluded without an allocation size. - A date-driven event (server or Remote Settings change on 2026-10-13), as the brief suggests: disfavored -- 158.0's per-1000 rate is steady from its first days, and only the counts rose with adoption.
- Failing hardware: not supported -- 0% bit-flip and 0% Raptor Lake share, and 40 CPU models seen.
- The pre-158 crashes under this signature being the same defect: disfavored -- they come mostly through Gecko's
mozalloc_handle_oomhook with other toolchains, a different cohort that only shares the generic signature. - 2f0bd86b184e (Merino client always on) as the cause: not supported -- the spike spans Nimbus, push, ads and FxA callers, not only Merino.
Worth checking first:
- Does the fix for bug 2073758 also cover the unexpected-error branch? Compare this signature's rate on the build that carries that fix (158.0.x) with 158.0.
- Which part of the UniFFI 0.32 update corrupts
ForeignFutureResult/RustCallStatus(Kotlin JNA struct by value againstextern "C" fn(u64, ForeignFutureResult<T>))? Diff the generated KotlinUniffiForeignFutureResultRustBufferand the callback-completion code between 0.31 and 0.32, and run a fixture test that completes a viaduct foreign future with an unexpected-error status on arm64 Android. - Is the error length garbage or real? A defensive fix would bound the length in
String::try_lifton the callback path (or log it in a crash annotation) beforeto_string(), which would turn this abort into a reported error and tell the two apart.
Filed as a new bug rather than a comment on bug 1919825 — which is open on this signature, but it was filed before the changeset above landed, so it cannot be about this regression. Please duplicate if that is wrong.
:bdk, can you have a look please?
Filed automatically by Clouseau, which analyses release crashes with an LLM. Nothing above was written or checked by a human. Please close it as INVALID if it is wrong — that is useful feedback, not a nuisance.
This is not an independent Mozilla discovery: the crash is known here only because somebody submitted the crash report linked at the top. If this duplicates an existing report, please resolve THIS bug as the duplicate and leave the credit with the earlier reporter.
Comment 1•1 month ago
|
||
This was mitigated by bug 2081454.
Description
•