Closed Bug 1791877 Opened 2 years ago Closed 2 years ago

Assertion failure: mSize > 0 (invalid size), at /ipc/glue/Shmem.cpp:251

Categories

(Core :: Graphics: WebGPU, defect)

x86_64
Linux
defect

Tracking

()

VERIFIED FIXED
107 Branch
Tracking Status
firefox107 --- verified

People

(Reporter: jkratzer, Assigned: nical)

References

(Blocks 2 open bugs)

Details

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

Attachments

(2 files)

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

Testcase can be reproduced using the following commands:

$ pip install fuzzfetch grizzly-framework
$ python -m fuzzfetch --build 5ad292b847e4 --debug --fuzzing -n firefox
$ python -m grizzly.replay ./firefox/firefox testcase.html
Assertion failure: mSize > 0 (invalid size), at /ipc/glue/Shmem.cpp:251

    ==2716452==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f8502c9da53 bp 0x7ffe8afea5c0 sp 0x7ffe8afea5b0 T2716452)
    ==2716452==The signal is caused by a WRITE memory access.
    ==2716452==Hint: address points to the zero page.
        #0 0x7f8502c9da53 in mozilla::ipc::Shmem::AssertInvariants() const /ipc/glue/Shmem.cpp:251:3
        #1 0x7f8502c9a384 in mozilla::ipc::Shmem::MkCreatedMessage(int) /ipc/glue/Shmem.cpp:411:3
        #2 0x7f8502c97b8a in mozilla::ipc::IToplevelProtocol::CreateSharedMemory(unsigned long, bool, int*) /ipc/glue/ProtocolUtils.cpp:691:41
        #3 0x7f8502c9876d in CreateSharedMemory /ipc/glue/ProtocolUtils.cpp:331:21
        #4 0x7f8502c9876d in mozilla::ipc::IProtocol::AllocShmem(unsigned long, mozilla::ipc::Shmem*) /ipc/glue/ProtocolUtils.cpp:413:31
        #5 0x7f850564e152 in mozilla::webgpu::Queue::WriteBuffer(mozilla::webgpu::Buffer const&, unsigned long, mozilla::dom::ArrayBufferViewOrArrayBuffer const&, unsigned long, mozilla::dom::Optional<unsigned long> const&, mozilla::ErrorResult&) /dom/webgpu/Queue.cpp:88:17
        #6 0x7f8504b3d6cd in mozilla::dom::GPUQueue_Binding::writeBuffer(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/WebGPUBinding.cpp:21003:24
        #7 0x7f85051ec02c in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /dom/bindings/BindingUtils.cpp:3287:13
        #8 0x7f850a89754c in CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) /js/src/vm/Interpreter.cpp:458:13
        #9 0x7f850a896e71 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:546:12
        #10 0x7f850a88e1a8 in CallFromStack /js/src/vm/Interpreter.cpp:618:10
        #11 0x7f850a88e1a8 in Interpret(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:3374:16
        #12 0x7f850a88524d in js::RunScript(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:430:13
        #13 0x7f850a896d6d in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:578:13
        #14 0x7f850a8982ac 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:645:8
        #15 0x7f8509754b57 in js::CallSelfHostedFunction(JSContext*, JS::Handle<js::PropertyName*>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>) /js/src/vm/SelfHosting.cpp:1498:10
        #16 0x7f85094eba49 in AsyncFunctionResume(JSContext*, JS::Handle<js::AsyncFunctionGeneratorObject*>, ResumeKind, JS::Handle<JS::Value>) /js/src/vm/AsyncFunction.cpp:154:8
        #17 0x7f85096d3b6f in AsyncFunctionPromiseReactionJob /js/src/builtin/Promise.cpp:2111:12
        #18 0x7f85096d3b6f in PromiseReactionJob(JSContext*, unsigned int, JS::Value*) /js/src/builtin/Promise.cpp:2174:12
        #19 0x7f850a89754c in CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) /js/src/vm/Interpreter.cpp:458:13
        #20 0x7f850a896e71 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:546:12
        #21 0x7f850a8982ac 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:645:8
        #22 0x7f85095173fc in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) /js/src/vm/CallAndConstruct.cpp:117:10
        #23 0x7f850441bd8d in mozilla::dom::PromiseJobCallback::Call(mozilla::dom::BindingCallContext&, JS::Handle<JS::Value>, mozilla::ErrorResult&) /builds/worker/workspace/obj-build/dom/bindings/PromiseBinding.cpp:35:8
        #24 0x7f8501f825b5 in mozilla::dom::PromiseJobCallback::Call(mozilla::ErrorResult&, char const*, mozilla::dom::CallbackObject::ExceptionHandling, JS::Realm*) /builds/worker/workspace/obj-build/dist/include/mozilla/dom/PromiseBinding.h:88:12
        #25 0x7f8501f81873 in Call /builds/worker/workspace/obj-build/dist/include/mozilla/dom/PromiseBinding.h:101:12
        #26 0x7f8501f81873 in mozilla::PromiseJobRunnable::Run(mozilla::AutoSlowOperation&) /xpcom/base/CycleCollectedJSContext.cpp:213:18
        #27 0x7f8501f6f518 in mozilla::CycleCollectedJSContext::PerformMicroTaskCheckPoint(bool) /xpcom/base/CycleCollectedJSContext.cpp:676:17
        #28 0x7f8501f7038c in mozilla::CycleCollectedJSContext::AfterProcessTask(unsigned int) /xpcom/base/CycleCollectedJSContext.cpp:463:3
        #29 0x7f8502e17cd5 in XPCJSContext::AfterProcessTask(unsigned int) /js/xpconnect/src/XPCJSContext.cpp:1480:28
        #30 0x7f850209367c in nsThread::ProcessNextEvent(bool, bool*) /xpcom/threads/nsThread.cpp:1242:24
        #31 0x7f85020998cd in NS_ProcessNextEvent(nsIThread*, bool) /xpcom/threads/nsThreadUtils.cpp:465:10
        #32 0x7f8502c79854 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:107:5
        #33 0x7f8502b9ef07 in MessageLoop::RunInternal() /ipc/chromium/src/base/message_loop.cc:381:10
        #34 0x7f8502b9ee12 in RunHandler /ipc/chromium/src/base/message_loop.cc:374:3
        #35 0x7f8502b9ee12 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:356:3
        #36 0x7f850705bd68 in nsBaseAppShell::Run() /widget/nsBaseAppShell.cpp:150:27
        #37 0x7f850925238b in XRE_RunAppShell() /toolkit/xre/nsEmbedFunctions.cpp:880:20
        #38 0x7f8502c7a79a in mozilla::ipc::MessagePumpForChildProcess::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:235:9
        #39 0x7f8502b9ef07 in MessageLoop::RunInternal() /ipc/chromium/src/base/message_loop.cc:381:10
        #40 0x7f8502b9ee12 in RunHandler /ipc/chromium/src/base/message_loop.cc:374:3
        #41 0x7f8502b9ee12 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:356:3
        #42 0x7f85092518a3 in XRE_InitChildProcess(int, char**, XREChildData const*) /toolkit/xre/nsEmbedFunctions.cpp:739:34
        #43 0x5609dab02b39 in content_process_main /browser/app/../../ipc/contentproc/plugin-container.cpp:57:28
        #44 0x5609dab02b39 in main /browser/app/nsBrowserApp.cpp:359:18
        #45 0x7f8518c55d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
        #46 0x7f8518c55e3f in __libc_start_main csu/../csu/libc-start.c:392:3
        #47 0x5609daad88dc in _start (/home/jkratzer/builds/mc-debug/firefox-bin+0x168dc) (BuildId: 2ebac32fd3db8e6d90b518677cea9c50777fa56a)
    
    UndefinedBehaviorSanitizer can not provide additional info.
    SUMMARY: UndefinedBehaviorSanitizer: SEGV /ipc/glue/Shmem.cpp:251:3 in mozilla::ipc::Shmem::AssertInvariants() const
    ==2716452==ABORTING
Attached file Testcase

Bugmon Analysis
Verified bug as reproducible on mozilla-central 20220921214338-7c0a787fe65a.
Unable to bisect testcase (Testcase reproduces on start build!):

Start: 56c35cc1a87ff4d45bb93c3329ced58b8925c21f (20210923034247)
End: 5ad292b847e44f0f00e351a05a7a4c4935db703a (20220921095211)
BuildFlags: BuildFlags(asan=False, tsan=False, debug=True, fuzzing=True, coverage=False, valgrind=False, no_opt=False, fuzzilli=False, nyx=False)

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

The severity field is not set for this bug.
:jimb, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jimb)

As opposed to only checking that the input buffer's size is not zero. Also validate that the size is a multiple of 4 bytes to match the spec.

Assignee: nobody → nical.bugzilla
Status: NEW → ASSIGNED
Attachment #9297847 - Attachment description: Bug 1791877 - Validate that the amount of data to write is not zero. r=jimb,jgilbert → Bug 1791877 - Work around zero-sized shmems in queue.writeBuffer. r=jimb,jgilbert
Pushed by nsilva@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5c54901b78a2 Work around zero-sized shmems in queue.writeBuffer. r=jimb,jgilbert
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 107 Branch

Bugmon Analysis
Verified bug as fixed on rev mozilla-central 20221013100028-3662e18e5c43.
Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.

Status: RESOLVED → VERIFIED
Keywords: bugmon
Flags: needinfo?(jimb)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: