Hit MOZ_CRASH(called `Result::unwrap()` on an `Err` value: Custom("Invalid bits for BufferUsages")) at gfx/wgpu_bindings/src/server.rs:500
Categories
(Core :: Graphics: WebGPU, defect, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr91 | --- | unaffected |
firefox100 | --- | disabled |
firefox101 | --- | disabled |
firefox102 | --- | disabled |
firefox103 | --- | wontfix |
People
(Reporter: jkratzer, Assigned: jimb, NeedInfo)
References
(Blocks 2 open bugs, Regression)
Details
(Keywords: regression, testcase, Whiteboard: [bugmon:bisected,confirmed])
Crash Data
Attachments
(3 files)
Testcase found while fuzzing mozilla-central rev 504105450146 (built with: --enable-address-sanitizer --enable-fuzzing).
Testcase can be reproduced using the following commands:
$ pip install fuzzfetch grizzly-framework
$ python -m fuzzfetch --build 504105450146 --asan --fuzzing -n firefox
$ python -m grizzly.replay ./firefox/firefox testcase.html
Hit MOZ_CRASH(called `Result::unwrap()` on an `Err` value: Custom("Invalid bits for BufferUsages")) at gfx/wgpu_bindings/src/server.rs:500
=================================================================
==461953==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000001 (pc 0x7fddd8c92620 bp 0x7fdd8edc2290 sp 0x7fdd8edc2280 T77)
==461953==The signal is caused by a WRITE memory access.
==461953==Hint: address points to the zero page.
#0 0x7fddd8c92620 in MOZ_Crash /builds/worker/workspace/obj-build/dist/include/mozilla/Assertions.h:261:3
#1 0x7fddd8c92620 in RustMozCrash /mozglue/static/rust/wrappers.cpp:18:3
#2 0x7fddd8c92546 in mozglue_static::panic_hook::h44aeb7ca04756874 /mozglue/static/rust/lib.rs:91:9
#3 0x7fddd8c91205 in core::ops::function::Fn::call::had720d134c14d3a8 /builds/worker/fetches/rust/library/core/src/ops/function.rs:70:5
#4 0x7fdddbc1c717 in std::panicking::rust_panic_with_hook::h213176a09718247f (/home/jkratzer/builds/mc-asan/libxul.so+0x1f406717)
#5 0x7fdddbc2a5df in std::panicking::begin_panic_handler::_$u7b$$u7b$closure$u7d$$u7d$::h3cfe49433456fe03 std.cd29c496-cgu.3
#6 0x7fdddbc2a053 in std::sys_common::backtrace::__rust_end_short_backtrace::hbf0fc5e1af0506eb crtstuff.c
#7 0x7fdddbc1c201 in rust_begin_unwind (/home/jkratzer/builds/mc-asan/libxul.so+0x1f406201)
#8 0x7fddc4f73ca0 in core::panicking::panic_fmt::hcb79d2bd962905f6 (/home/jkratzer/builds/mc-asan/libxul.so+0x875dca0)
#9 0x7fddc4f739d2 in core::result::unwrap_failed::h553888e414025bfc (/home/jkratzer/builds/mc-asan/libxul.so+0x875d9d2)
#10 0x7fddd5539921 in core::result::Result$LT$T$C$E$GT$::unwrap::h17f9576170ad03c8 /builds/worker/fetches/rust/library/core/src/result.rs:1295:23
#11 0x7fddd5539921 in wgpu_server_device_action /gfx/wgpu_bindings/src/server.rs:500:18
#12 0x7fddcbb5ad96 in mozilla::webgpu::WebGPUParent::RecvDeviceAction(unsigned long, mozilla::ipc::ByteBuf const&) /dom/webgpu/ipc/WebGPUParent.cpp:751:3
#13 0x7fddc7cf1e3e in mozilla::webgpu::PWebGPUParent::OnMessageReceived(IPC::Message const&) /builds/worker/workspace/obj-build/ipc/ipdl/PWebGPUParent.cpp:224:56
#14 0x7fddc745bddb in mozilla::layers::PCompositorManagerParent::OnMessageReceived(IPC::Message const&) /builds/worker/workspace/obj-build/ipc/ipdl/PCompositorManagerParent.cpp:204:32
#15 0x7fddc722c2e9 in mozilla::ipc::MessageChannel::DispatchAsyncMessage(mozilla::ipc::ActorLifecycleProxy*, IPC::Message const&) /ipc/glue/MessageChannel.cpp:2024:25
#16 0x7fddc72291d8 in mozilla::ipc::MessageChannel::DispatchMessage(IPC::Message&&) /ipc/glue/MessageChannel.cpp:1949:9
#17 0x7fddc722aa00 in mozilla::ipc::MessageChannel::RunMessage(mozilla::ipc::MessageChannel::MessageTask&) /ipc/glue/MessageChannel.cpp:1816:3
#18 0x7fddc722b417 in mozilla::ipc::MessageChannel::MessageTask::Run() /ipc/glue/MessageChannel.cpp:1844:14
#19 0x7fddc5d13beb in nsThread::ProcessNextEvent(bool, bool*) /xpcom/threads/nsThread.cpp:1189:16
#20 0x7fddc5d1e59c in NS_ProcessNextEvent(nsIThread*, bool) /xpcom/threads/nsThreadUtils.cpp:467:10
#21 0x7fddc723657b in mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:300:20
#22 0x7fddc70b4a81 in RunInternal /ipc/chromium/src/base/message_loop.cc:331:10
#23 0x7fddc70b4a81 in RunHandler /ipc/chromium/src/base/message_loop.cc:324:3
#24 0x7fddc70b4a81 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:306:3
#25 0x7fddc5d0c0ff in nsThread::ThreadFunc(void*) /xpcom/threads/nsThread.cpp:391:10
#26 0x7fdde895602e in _pt_root /nsprpub/pr/src/pthreads/ptthread.c:201:5
#27 0x7fddea26b608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477:8
#28 0x7fdde9e33292 in __clone /build/glibc-eX1tMB/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /builds/worker/workspace/obj-build/dist/include/mozilla/Assertions.h:261:3 in MOZ_Crash
Thread T77 (Compositor) created by T0 here:
#0 0x55677df2ee4c in __interceptor_pthread_create /builds/worker/fetches/llvm-project/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cpp:207:3
#1 0x7fdde89460b4 in _PR_CreateThread /nsprpub/pr/src/pthreads/ptthread.c:458:14
#2 0x7fdde893735e in PR_CreateThread /nsprpub/pr/src/pthreads/ptthread.c:533:12
#3 0x7fddc5d0f445 in nsThread::Init(nsTSubstring<char> const&) /xpcom/threads/nsThread.cpp:627:18
#4 0x7fddc5d1c37f in nsThreadManager::NewNamedThread(nsTSubstring<char> const&, unsigned int, nsIThread**) /xpcom/threads/nsThreadManager.cpp:581:12
#5 0x7fddc5d27911 in NS_NewNamedThread(nsTSubstring<char> const&, nsIThread**, already_AddRefed<nsIRunnable>, unsigned int) /xpcom/threads/nsThreadUtils.cpp:163:57
#6 0x7fddc8b1c502 in NS_NewNamedThread<11UL> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:74:10
#7 0x7fddc8b1c502 in mozilla::layers::CompositorThreadHolder::CreateCompositorThread() /gfx/layers/ipc/CompositorThread.cpp:62:17
#8 0x7fddc8b1c886 in CompositorThreadHolder /gfx/layers/ipc/CompositorThread.cpp:39:25
#9 0x7fddc8b1c886 in mozilla::layers::CompositorThreadHolder::Start() /gfx/layers/ipc/CompositorThread.cpp:103:33
#10 0x7fddc8cf4767 in InitLayersIPC /gfx/thebes/gfxPlatform.cpp:1301:5
#11 0x7fddc8cf4767 in gfxPlatform::Init() /gfx/thebes/gfxPlatform.cpp:963:3
#12 0x7fddc8cf78c0 in GetPlatform /gfx/thebes/gfxPlatform.cpp:467:5
#13 0x7fddc8cf78c0 in gfxPlatform::InitializeCMS() /gfx/thebes/gfxPlatform.cpp:2090:9
#14 0x7fddce09d32d in GetCMSMode /builds/worker/workspace/obj-build/dist/include/gfxPlatform.h:521:5
#15 0x7fddce09d32d in nsXPLookAndFeel::GetColorValue(mozilla::StyleSystemColor, mozilla::ColorScheme, mozilla::LookAndFeel::UseStandins, unsigned int&) /widget/nsXPLookAndFeel.cpp:868:9
#16 0x7fddce0a116e in mozilla::LookAndFeel::GetColor(mozilla::StyleSystemColor, mozilla::ColorScheme, mozilla::LookAndFeel::UseStandins) /widget/nsXPLookAndFeel.cpp:1252:47
#17 0x7fddce0151a8 in Color /builds/worker/workspace/obj-build/dist/include/mozilla/LookAndFeel.h:446:12
#18 0x7fddce0151a8 in ThemedAccentColor /widget/ThemeColors.cpp:89:37
#19 0x7fddce0151a8 in mozilla::widget::ThemeColors::RecomputeAccentColors() /widget/ThemeColors.cpp:170:20
#20 0x7fddce014deb in mozilla::widget::Theme::LookAndFeelChanged() /widget/Theme.cpp:169:3
#21 0x7fddce09b812 in nsXPLookAndFeel::GetInstance() /widget/nsXPLookAndFeel.cpp:359:3
#22 0x7fddce0a1b6d in mozilla::LookAndFeel::GetThemeInfo(nsTSubstring<char>&) /widget/nsXPLookAndFeel.cpp:1369:3
#23 0x7fddc5b68917 in nsSystemInfo::Init() /xpcom/base/nsSystemInfo.cpp:1047:5
#24 0x7fddc5c7077f in mozilla::xpcom::CreateInstanceImpl(mozilla::xpcom::ModuleID, nsISupports*, nsID const&, void**) /builds/worker/workspace/obj-build/xpcom/components/StaticComponents.cpp:9164:7
#25 0x7fddc5cbf587 in CreateInstance /xpcom/components/nsComponentManager.cpp:181:46
#26 0x7fddc5cbf587 in nsComponentManagerImpl::GetServiceLocked(mozilla::Maybe<mozilla::MonitorAutoLock>&, (anonymous namespace)::EntryWrapper&, nsID const&, void**) /xpcom/components/nsComponentManager.cpp:1288:17
#27 0x7fddc5cc0038 in nsComponentManagerImpl::GetService(mozilla::xpcom::ModuleID, nsID const&, void**) /xpcom/components/nsComponentManager.cpp:1378:10
#28 0x7fddc5c946dd in mozilla::xpcom::GetServiceHelper::operator()(nsID const&, void**) const /builds/worker/workspace/obj-build/xpcom/components/StaticComponents.cpp:12288:50
#29 0x7fddc5b1ed91 in nsCOMPtr_base::assign_from_helper(nsCOMPtr_helper const&, nsID const&) /xpcom/base/nsCOMPtr.cpp:109:7
#30 0x7fddc8138dfc in nsCOMPtr /builds/worker/workspace/obj-build/dist/include/nsCOMPtr.h:999:5
#31 0x7fddc8138dfc in GetServiceImpl /js/xpconnect/src/JSServices.cpp:84:32
#32 0x7fddc8138dfc in GetService /js/xpconnect/src/JSServices.cpp:131:8
#33 0x7fddc8138dfc in xpc::Services_Resolve(JSContext*, JS::Handle<JSObject*>, JS::Handle<JS::PropertyKey>, bool*) /js/xpconnect/src/JSServices.cpp:154:25
#34 0x7fddd35475b7 in CallResolveOp /js/src/vm/NativeObject-inl.h:640:8
#35 0x7fddd35475b7 in NativeLookupOwnPropertyInline<js::CanGC, js::LookupResolveMode::CheckResolve> /js/src/vm/NativeObject-inl.h:760:14
#36 0x7fddd35475b7 in NativeGetPropertyInline<js::CanGC> /js/src/vm/NativeObject.cpp:2127:10
#37 0x7fddd35475b7 in js::NativeGetProperty(JSContext*, JS::Handle<js::NativeObject*>, JS::Handle<JS::Value>, JS::Handle<JS::PropertyKey>, JS::MutableHandle<JS::Value>) /js/src/vm/NativeObject.cpp:2175:10
#38 0x7fddd3063849 in GetProperty /js/src/vm/ObjectOperations-inl.h:120:10
#39 0x7fddd3063849 in js::GetProperty(JSContext*, JS::Handle<JSObject*>, JS::Handle<JS::Value>, js::PropertyName*, JS::MutableHandle<JS::Value>) /js/src/vm/ObjectOperations-inl.h:127:10
#40 0x7fddd3062ea4 in js::GetProperty(JSContext*, JS::Handle<JS::Value>, JS::Handle<js::PropertyName*>, JS::MutableHandle<JS::Value>) /js/src/vm/Interpreter.cpp:4710:10
#41 0x7fddd3033c48 in GetPropertyOperation /js/src/vm/Interpreter.cpp:208:10
#42 0x7fddd3033c48 in Interpret(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:2973:12
#43 0x7fddd302b421 in js::RunScript(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:394:13
#44 0x7fddd305a2cf in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:544:13
#45 0x7fddd305c41b in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason) /js/src/vm/Interpreter.cpp:589:8
#46 0x7fddd32d906c in JS_CallFunctionValue(JSContext*, JS::Handle<JSObject*>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) /js/src/vm/CallAndConstruct.cpp:53:10
#47 0x7fddc8180d90 in nsXPCWrappedJS::CallMethod(unsigned short, nsXPTMethodInfo const*, nsXPTCMiniVariant*) /js/xpconnect/src/XPCWrappedJSClass.cpp:973:17
#48 0x7fddc5d65272 in PrepareAndDispatch /xpcom/reflect/xptcall/md/unix/xptcstubs_x86_64_linux.cpp:115:37
#49 0x7fddc5d63ffa in SharedStub xptcstubs_x86_64_linux.cpp
#50 0x7fddc5cb5912 in NS_CreateServicesFromCategory(char const*, nsISupports*, char const*, char16_t const*) /xpcom/components/nsCategoryManager.cpp:687:19
#51 0x7fddd2d92629 in nsXREDirProvider::DoStartup() /toolkit/xre/nsXREDirProvider.cpp:978:11
#52 0x7fddd2d6db13 in XREMain::XRE_mainRun() /toolkit/xre/nsAppRunner.cpp:5089:18
#53 0x7fddd2d70b99 in XREMain::XRE_main(int, char**, mozilla::BootstrapConfig const&) /toolkit/xre/nsAppRunner.cpp:5539:8
#54 0x7fddd2d718d3 in XRE_main(int, char**, mozilla::BootstrapConfig const&) /toolkit/xre/nsAppRunner.cpp:5598:21
#55 0x55677df79a99 in do_main /browser/app/nsBrowserApp.cpp:225:22
#56 0x55677df79a99 in main /browser/app/nsBrowserApp.cpp:395:16
#57 0x7fdde9d380b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
==461953==ABORTING
Reporter | ||
Comment 1•2 years ago
|
||
Comment 2•2 years ago
|
||
Bugmon Analysis
Verified bug as reproducible on mozilla-central 20220126163134-35652548842a.
The bug appears to have been introduced in the following build range:
Start: ede86e9e0fdb5162502ddf301e992800d6a84ea1 (20210910211800)
End: a2d4c087b7222581f7d996bf0b4fd7659dc2cbfe (20210910214815)
Pushlog: https://hg.mozilla.org/mozilla-unified/pushloghtml?fromchange=ede86e9e0fdb5162502ddf301e992800d6a84ea1&tochange=a2d4c087b7222581f7d996bf0b4fd7659dc2cbfe
Comment 3•2 years ago
|
||
Reporter | ||
Updated•2 years ago
|
Comment 4•2 years ago
|
||
The severity field is not set for this bug.
:kvark, could you have a look please?
For more information, please visit auto_nag documentation.
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 5•2 years ago
|
||
I can reproduce this.
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 6•2 years ago
|
||
The error message is generated by the deserialization code for BufferUsages
, which is automatically generated by the serde_shims
crate.
Assignee | ||
Comment 7•2 years ago
|
||
cbindgen translates Rust BufferUsages
, which is a bitflags!
-generated type with checked constructors, into C++ uint32_t
, which is unchecked. When WebGPUChild::DeviceCreateBuffer
creates a wgpu_core::resource::BufferDescriptor
from the WebIDL descriptor, nothing checks that the bits are legit.
Comment 8•2 years ago
|
||
:jimb, since this bug contains a bisection range, could you fill (if possible) the regressed_by field?
For more information, please visit auto_nag documentation.
Assignee | ||
Comment 9•2 years ago
|
||
Document various things. Spell out that the error messages are UTF-8.
Let server.rs
's ErrorBuffer
take a &str
instead of a String
.
Assignee | ||
Comment 10•2 years ago
•
|
||
Depends on wgpu#2673
.
WebGPU requires GPUBufferDescriptor
validation failure to:
-
generate an error on the Device timeline, and
-
mark the new buffer as invalid.
Satisfy 1) by moving most validation to the compositor process.
Requirement 2) is harder. wgpu_core::Global::device_create_buffer
already takes care of some validation for us, and marks the provided buffer id invalid when there's a problem. However, there are certain errors the spec requires us to detect which device_create_buffer
cannot even see, because they are caught by standard Rust validation steps in the process of creating the wgpu_types::BufferDescriptor
that one would pass to that function. For example, if there are bogus bits set in the usage
property, we can't even construct a Rust BufferUsages
value from that to include in the BufferDescriptor
that we must pass to device_create_buffer
.
This means that we need to do some validation ourselves, in the process of constructing that BufferDescriptor
, and use the Global::create_buffer_error
method added in wgpu#2673
to mark the new buffer as invalid.
Depends on D146767
Assignee | ||
Comment 11•2 years ago
|
||
I foresee a lot of this type of song-and-dance coming up whenever the Rust types are stricter than the WebIDL types. Not looking forward to it.
Comment 12•2 years ago
|
||
Set release status flags based on info from the regressing bug 1729751
Assignee | ||
Comment 13•2 years ago
•
|
||
Depends on wgpu#2673.
This has been merged upstream.
Comment 14•2 years ago
|
||
Set release status flags based on info from the regressing bug 1729751
Updated•2 years ago
|
Comment 15•2 years ago
|
||
Pushed by jblandy@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cc358a74b633 Error-handling cleanups. r=jgilbert https://hg.mozilla.org/integration/autoland/rev/ce577c1b5603 Move GPUBufferDescriptor validation to server. r=jgilbert
Comment 16•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/cc358a74b633
https://hg.mozilla.org/mozilla-central/rev/ce577c1b5603
Comment 17•2 years ago
|
||
The patch landed in nightly and beta is affected.
:jimb, is this bug important enough to require an uplift?
If not please set status_beta
to wontfix
.
For more information, please visit auto_nag documentation.
Updated•2 years ago
|
Comment 18•2 years ago
|
||
Bugmon Analysis
Verified bug as fixed on rev mozilla-central 20220606093709-6951cd731119.
Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.
Assignee | ||
Updated•2 years ago
|
Comment 19•2 years ago
|
||
:jimb could you check your last update - on the ticket, the fix landed in 103?
status-firefox103: verified → wontfix
Description
•