Closed Bug 2008380 Opened 3 months ago Closed 4 days ago

Hit MOZ_CRASH(attempt to add with overflow) at /third_party/rust/wgpu-core/src/resource.rs:1805

Categories

(Core :: Graphics: WebGPU, defect, P2)

x86_64
Linux
defect

Tracking

()

RESOLVED FIXED
151 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr140 --- unaffected
firefox146 --- wontfix
firefox147 --- wontfix
firefox148 --- wontfix
firefox149 --- wontfix
firefox150 --- wontfix
firefox151 --- fixed

People

(Reporter: jkratzer, Assigned: ErichDonGubler)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression, testcase, Whiteboard: [bugmon:bisected,confirmed])

Attachments

(1 file)

Testcase found while fuzzing mozilla-central rev bb84913df076 (built with: --enable-debug --enable-fuzzing).

Testcase can be reproduced using the following commands:

$ pip install fuzzfetch grizzly-framework pipx --upgrade
$ python -m pipx ensurepath
$ fuzzfetch --build bb84913df076 --debug --fuzzing  -n firefox
$ grizzly-replay-bugzilla ./firefox/firefox <bugid>
Hit MOZ_CRASH(attempt to add with overflow) at /third_party/rust/wgpu-core/src/resource.rs:1805

    ==2554985==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7d5087ad7d8a bp 0x7d500d765f10 sp 0x7d500d765f00 T2555210)
    ==2554985==The signal is caused by a WRITE memory access.
    ==2554985==Hint: address points to the zero page.
        #0 0x7d5087ad7d8a in MOZ_CrashSequence /builds/worker/workspace/obj-build/dist/include/mozilla/Assertions.h:237:3
        #1 0x7d5087ad7d8a in MOZ_Crash /builds/worker/workspace/obj-build/dist/include/mozilla/Assertions.h:375:3
        #2 0x7d5087ad7d8a in RustMozCrash /mozglue/static/rust/wrappers.cpp:18:3
        #3 0x7d5087ad773f in mozglue_static::panic_hook::h115882273e70490e /mozglue/static/rust/lib.rs:99:9
        #4 0x7d5087ad71ab in core::ops::function::Fn::call::hf3d7447041c87164 /builds/worker/fetches/rustc/lib/rustlib/src/rust/library/core/src/ops/function.rs:80:5
        #5 0x7d50893bda7d in _$LT$alloc..boxed..Box$LT$F$C$A$GT$$u20$as$u20$core..ops..function..Fn$LT$Args$GT$$GT$::call::h318e4efb8c1a5689 /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/alloc/src/boxed.rs:1985:9
        #6 0x7d50893bda7d in std::panicking::rust_panic_with_hook::h33ac55f64bbd807d /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panicking.rs:841:13
        #7 0x7d50893bd715 in std::panicking::begin_panic_handler::_$u7b$$u7b$closure$u7d$$u7d$::h30e7cb89678a57fe /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panicking.rs:699:13
        #8 0x7d50893bbdd8 in std::sys::backtrace::__rust_end_short_backtrace::hed60f27456c16ced /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/sys/backtrace.rs:174:18
        #9 0x7d50893bd3dc in __rustc::rust_begin_unwind /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panicking.rs:697:5
        #10 0x7d50893e3b9f in core::panicking::panic_fmt::h62f63d096dd276af /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/core/src/panicking.rs:75:14
        #11 0x7d50893ed786 in core::panicking::panic_const::panic_const_add_overflow::h3253708af8a8c611 /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/core/src/panicking.rs:175:17
        #12 0x7d5086b19c4e in _$LT$u32$u20$as$u20$core..ops..arith..Add$GT$::add::h2832efab8b87a31f /builds/worker/fetches/rustc/lib/rustlib/src/rust/library/core/src/ops/arith.rs:106:45
        #13 0x7d5086b19c4e in _$LT$$RF$u32$u20$as$u20$core..ops..arith..Add$GT$::add::h65fb641886e4853c /builds/worker/fetches/rustc/lib/rustlib/src/rust/library/core/src/internal_macros.rs:58:17
        #14 0x7d5086b19c4e in _$LT$wgpu_core..resource..CreateTextureViewError$u20$as$u20$core..fmt..Display$GT$::fmt::h201a1ae479803113 /third_party/rust/wgpu-core/src/resource.rs:1805:25
        #15 0x7d50893e6d52 in core::fmt::rt::Argument::fmt::h2c56b3114963061a /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/core/src/fmt/rt.rs:173:76
        #16 0x7d50893e6d52 in core::fmt::write::h8a494366950f23bb /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/core/src/fmt/mod.rs:1468:25
        #17 0x7d50893daea4 in _$LT$$RF$mut$u20$W$u20$as$u20$core..fmt..Write..write_fmt..SpecWriteFmt$GT$::spec_write_fmt::hc163e5b4dcf97a36 /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/core/src/fmt/mod.rs:233:21
        #18 0x7d50893daea4 in core::fmt::Write::write_fmt::h75cd3cfcdaf05518 /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/core/src/fmt/mod.rs:238:14
        #19 0x7d50893daea4 in alloc::fmt::format::format_inner::hcdf7615595699d8a /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/alloc/src/fmt.rs:649:14
        #20 0x7d508681bfcc in alloc::fmt::format::_$u7b$$u7b$closure$u7d$$u7d$::hca0930f78fed8da8 /builds/worker/fetches/rustc/lib/rustlib/src/rust/library/alloc/src/fmt.rs:654:34
        #21 0x7d508681bfcc in core::option::Option$LT$T$GT$::map_or_else::h07c57f998dc7596c /builds/worker/fetches/rustc/lib/rustlib/src/rust/library/core/src/option.rs:1271:21
        #22 0x7d508681bfcc in alloc::fmt::format::h9afc39a2677d4a2d /builds/worker/fetches/rustc/lib/rustlib/src/rust/library/alloc/src/fmt.rs:654:19
        #23 0x7d508681bfcc in wgpu_bindings::error::error_to_string::h7b6d07684e5e269c /gfx/wgpu_bindings/src/error.rs:139:23
        #24 0x7d508682faa2 in wgpu_bindings::error::OwnedErrorBuffer::init::h39a64a358fa989b1 /gfx/wgpu_bindings/src/error.rs:128:23
        #25 0x7d508682faa2 in wgpu_bindings::server::Global::texture_action::h7ffc0bef5c9e4649 /gfx/wgpu_bindings/src/server.rs:2238:31
        #26 0x7d508682faa2 in wgpu_bindings::server::process_message::hb42a7da3e4499c61 /gfx/wgpu_bindings/src/server.rs:2582:20
        #27 0x7d5086828368 in wgpu_server_messages /gfx/wgpu_bindings/src/server.rs:2420:9
        #28 0x7d5081363135 in mozilla::webgpu::WebGPUParent::RecvMessages(unsigned int, mozilla::ipc::ByteBuf&&, nsTArray<mozilla::ipc::ByteBuf>&&, nsTArray<mozilla::ipc::shared_memory::Handle<(mozilla::ipc::shared_memory::Type)0>>&&) /dom/webgpu/ipc/WebGPUParent.cpp:1604:3
        #29 0x7d5081364b72 in mozilla::webgpu::PWebGPUParent::OnMessageReceived(IPC::Message const&) /builds/worker/workspace/obj-build/ipc/ipdl/PWebGPUParent.cpp:306:80
        #30 0x7d507ef7205a in mozilla::gfx::PCanvasManagerParent::OnMessageReceived(IPC::Message const&) /builds/worker/workspace/obj-build/ipc/ipdl/PCanvasManagerParent.cpp:261:32
        #31 0x7d507e30978e in mozilla::ipc::MessageChannel::DispatchAsyncMessage(mozilla::ipc::ActorLifecycleProxy*, IPC::Message const&) /ipc/glue/MessageChannel.cpp:1793:25
        #32 0x7d507e306d10 in mozilla::ipc::MessageChannel::DispatchMessage(mozilla::ipc::ActorLifecycleProxy*, std::unique_ptr<IPC::Message, std::default_delete<IPC::Message>>) /ipc/glue/MessageChannel.cpp:1719:9
        #33 0x7d507e307717 in mozilla::ipc::MessageChannel::RunMessage(mozilla::ipc::ActorLifecycleProxy*, mozilla::ipc::MessageChannel::MessageTask&) /ipc/glue/MessageChannel.cpp:1508:3
        #34 0x7d507e3086f9 in mozilla::ipc::MessageChannel::MessageTask::Run() /ipc/glue/MessageChannel.cpp:1610:14
        #35 0x7d507d71fab2 in nsThread::ProcessNextEvent(bool, bool*) /xpcom/threads/nsThread.cpp:1158:16
        #36 0x7d507d7261df in NS_ProcessNextEvent(nsIThread*, bool) /xpcom/threads/nsThreadUtils.cpp:461:10
        #37 0x7d507e310239 in mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:329:5
        #38 0x7d507e268c81 in RunHandler /ipc/chromium/src/base/message_loop.cc:361:3
        #39 0x7d507e268c81 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:343:3
        #40 0x7d507d71b6ee in nsThread::ThreadFunc(void*) /xpcom/threads/nsThread.cpp:373:10
        #41 0x7d50933563ac in _pt_root /nsprpub/pr/src/pthreads/ptthread.c:191:3
        #42 0x7d5093c10aa3 in start_thread ./nptl/pthread_create.c:447:8
        #43 0x7d5093c9dc6b in clone3 ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0
    
    ==2554985==Register values:
    rax = 0x000000000000070d  rbx = 0x00007d500d765f2c  rcx = 0x0000000000000000  rdx = 0x00007d5093d78563
    rdi = 0x00007d5093d79700  rsi = 0x0000000000000000  rbp = 0x00007d500d765f10  rsp = 0x00007d500d765f00
     r8 = 0x0000000000000000   r9 = 0x0000000000000003  r10 = 0x0000000000000002  r11 = 0x0000000000000293
    r12 = 0x00007d500d765f2c  r13 = 0x00007d508bfff120  r14 = 0x000000000000070d  r15 = 0x00007d50899c1928
    UndefinedBehaviorSanitizer can not provide additional info.
    SUMMARY: UndefinedBehaviorSanitizer: SEGV (/home/jkratzer/builds/m-c-20260102083805-fuzzing-debug/libxul.so+0xee10d8a) (BuildId: 9d183a34b3523b7fb6693fb0d970dd4e3b65b384)
    ==2554985==ABORTING
Attached file Testcase

Verified bug as reproducible on mozilla-central 20260103085132-791d47406d61.
The bug appears to have been introduced in the following build range:

Start: 7b043f8a91bbde7b276beeeda16dfcdd208887b5 (20251020233406)
End: ce877b3bceb28f21dfda79f99ce663d88c878384 (20251021030350)
Pushlog: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=7b043f8a91bbde7b276beeeda16dfcdd208887b5&tochange=ce877b3bceb28f21dfda79f99ce663d88c878384

Keywords: regression
Whiteboard: [bugmon:confirm] → [bugmon:bisected,confirmed]

Definitely a regression of bug 1995050.

This points to a zero address, so this doesn't seem hugely problematic for security.

Severity: -- → S3
Regressions: 1995050

Bug 1995050 is only an integration point of upstream work. The upstream regressor is wgpu#8323, which I accepted in review. I'll take this on for resolution.

The issue is that the Display implementation of CreateTextureViewError::{TooManyMipLevels,TooManyArrayLayers} now attempts to naively add baseMipLevel and mipLevelCount, despite them being user-provided. Oops, rookie mistake!…that I approved and merged. 😅

Assignee: nobody → egubler
Status: NEW → ASSIGNED
Priority: -- → P2

I've started upstream work to resolve this at wgpu#8808.

Based on comment #2, this bug contains a bisection range found by bugmon. However, the Regressed by field is still not filled.

:ErichDonGubler, if possible, could you fill the Regressed by field and investigate this regression?

For more information, please visit BugBot documentation.

Flags: needinfo?(egubler)

This bug has been marked as a regression. Setting status flag for Nightly to affected.

Flags: needinfo?(egubler)
Regressed by: 1995050
No longer regressions: 1995050

Unable to reproduce bug 2008380 using build mozilla-central 20260102083805-bb84913df076. Without a baseline, bugmon is unable to analyze this bug.
Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.

Keywords: bugmon

:jkratzner: This did have a baseline from comment 2. Is there a bug with Bugmon, maybe?

Flags: needinfo?(jkratzer)

(In reply to Erich Gubler [:ErichDonGubler] (he/him) from comment #9)

:jkratzner: This did have a baseline from comment 2. Is there a bug with Bugmon, maybe?

Apologies Erich. Looks like this was a bug in Bugmon. I've fixed it and re-enabled the bot for this bug.

Flags: needinfo?(jkratzer)
Keywords: bugmon

Testcase crashes using the initial build (mozilla-central 20260102083805-bb84913df076) but not with tip (mozilla-central 20260410211335-be5d6cb74c0a.)

The bug appears to have been fixed in the following build range:

Start: cbe8c3e0a012d38e979ce96c97bca93f42a5aad4 (20260328203447)
End: ca7cf4cfe65627b9979e6fafc58cbd3367880141 (20260329021904)
Pushlog: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=cbe8c3e0a012d38e979ce96c97bca93f42a5aad4&tochange=ca7cf4cfe65627b9979e6fafc58cbd3367880141

ErichDonGubler, can you confirm that the above bisection range is responsible for fixing this issue?
Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.

Flags: needinfo?(egubler)
Keywords: bugmon

Yep! :aleiserson vendored in wgpu#8808 with bug 2025979.

Status: ASSIGNED → RESOLVED
Closed: 4 days ago
Depends on: 2025979
Flags: needinfo?(egubler)
Resolution: --- → FIXED
Target Milestone: --- → 151 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: