Closed Bug 1618325 Opened 4 years ago Closed 4 years ago

Non-ASAN crash and AddressSanitizer: SEGV /build/glibc-OTsEL5/glibc-2.27/string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:134 in memcpy

Categories

(Core :: Graphics: CanvasWebGL, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox-esr68 --- unaffected
firefox73 --- unaffected
firefox74 --- unaffected
firefox75 --- fixed

People

(Reporter: jkratzer, Assigned: jgilbert)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: crash, regression, testcase, Whiteboard: [jsbugmon:confirmed][fuzzblocker])

Crash Data

Attachments

(3 files)

Attached file testcase.html

Testcase found while fuzzing mozilla-central rev 7f41334e1044 (built with --enable-address-sanitizer).

==3340==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000244 (pc 0x7fb4681e1477 bp 0x7ffeeaa463d0 sp 0x7ffeeaa45b88 T0)
==3340==The signal is caused by a READ memory access.
==3340==Hint: address points to the zero page.
    #0 0x7fb4681e1476 in memcpy /build/glibc-OTsEL5/glibc-2.27/string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:134
    #1 0x563326d8b257 in __asan_memcpy /builds/worker/fetches/llvm-project/llvm/projects/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cc:22:3
    #2 0x7fb44b261ef9 in mozilla::ClientWebGLContext::ReadPixels(int, int, int, int, unsigned int, unsigned int, mozilla::dom::ArrayBufferView_base<&(js::UnwrapArrayBufferView(JSObject*)), &(js::GetArrayBufferViewLengthAndData(JSObject*, unsigned int*, bool*, unsigned char**)), &(JS_GetArrayBufferViewType(JSObject*))> const&, unsigned int, mozilla::dom::CallerType, mozilla::ErrorResult&) const /builds/worker/workspace/build/src/dom/canvas/ClientWebGLContext.cpp:3960:43
    #3 0x7fb44a87f364 in mozilla::ClientWebGLContext::ReadPixels(int, int, int, int, unsigned int, unsigned int, mozilla::dom::Nullable<mozilla::dom::ArrayBufferView_base<&(js::UnwrapArrayBufferView(JSObject*)), &(js::GetArrayBufferViewLengthAndData(JSObject*, unsigned int*, bool*, unsigned char**)), &(JS_GetArrayBufferViewType(JSObject*))> > const&, mozilla::dom::CallerType, mozilla::ErrorResult&) const /builds/worker/workspace/build/src/dom/canvas/ClientWebGLContext.h:1946:5
    #4 0x7fb44a9041bf in mozilla::dom::WebGLRenderingContext_Binding::readPixels(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/WebGLRenderingContextBinding.cpp:13567:24
    #5 0x7fb44b114138 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/build/src/dom/bindings/BindingUtils.cpp:3171:13
    #6 0x7fb4515f4473 in CallJSNative /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:477:13
    #7 0x7fb4515f4473 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:569:12
    #8 0x7fb4515f626a in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:632:10
    #9 0x7fb4515daca7 in CallFromStack /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:636:10
    #10 0x7fb4515daca7 in Interpret(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:3049:16
    #11 0x7fb4515be191 in js::RunScript(JSContext*, js::RunState&) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:449:10
    #12 0x7fb4515f4555 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:604:13
    #13 0x7fb4515f626a in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:632:10
    #14 0x7fb4515f6546 in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason) /builds/worker/workspace/build/src/js/src/vm/Interpreter.cpp:649:8
    #15 0x7fb451792be2 in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) /builds/worker/workspace/build/src/js/src/jsapi.cpp:2797:10
    #16 0x7fb44ad2d140 in mozilla::dom::EventListener::HandleEvent(JSContext*, JS::Handle<JS::Value>, mozilla::dom::Event&, mozilla::ErrorResult&) /builds/worker/workspace/build/src/obj-firefox/dom/bindings/EventListenerBinding.cpp:52:8
    #17 0x7fb44b7ddfcb in void mozilla::dom::EventListener::HandleEvent<mozilla::dom::EventTarget*>(mozilla::dom::EventTarget* const&, mozilla::dom::Event&, mozilla::ErrorResult&, char const*, mozilla::dom::CallbackObject::ExceptionHandling, JS::Realm*) /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/dom/EventListenerBinding.h:66:12
    #18 0x7fb44b7dda04 in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1073:43
    #19 0x7fb44b7df066 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) /builds/worker/workspace/build/src/dom/events/EventListenerManager.cpp:1271:17
    #20 0x7fb44b7ccd4f in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:356:17
    #21 0x7fb44b7cb2a1 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:558:16
    #22 0x7fb44b7cfd5b in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /builds/worker/workspace/build/src/dom/events/EventDispatcher.cpp:1055:11
    #23 0x7fb44de1722e in nsDocumentViewer::LoadComplete(nsresult) /builds/worker/workspace/build/src/layout/base/nsDocumentViewer.cpp:1144:7
    #24 0x7fb450955f07 in nsDocShell::EndPageLoad(nsIWebProgress*, nsIChannel*, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp:6084:20
    #25 0x7fb4509550b5 in nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp:5867:7
    #26 0x7fb450959b1f in non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /builds/worker/workspace/build/src/docshell/base/nsDocShell.cpp
    #27 0x7fb447f6fde0 in nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:1348:3
    #28 0x7fb447f6ed6c in nsDocLoader::doStopDocumentLoad(nsIRequest*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:907:14
    #29 0x7fb447f6b040 in nsDocLoader::DocLoaderIsEmpty(bool) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:727:9
    #30 0x7fb447f6d873 in nsDocLoader::OnStopRequest(nsIRequest*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp:615:5
    #31 0x7fb447f6e8fc in non-virtual thunk to nsDocLoader::OnStopRequest(nsIRequest*, nsresult) /builds/worker/workspace/build/src/uriloader/base/nsDocLoader.cpp
    #32 0x7fb4457fc6f7 in mozilla::net::nsLoadGroup::NotifyRemovalObservers(nsIRequest*, nsresult) /builds/worker/workspace/build/src/netwerk/base/nsLoadGroup.cpp:604:22
    #33 0x7fb4457ff907 in mozilla::net::nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, nsresult) /builds/worker/workspace/build/src/netwerk/base/nsLoadGroup.cpp:511:10
    #34 0x7fb4495102ff in mozilla::dom::Document::DoUnblockOnload() /builds/worker/workspace/build/src/dom/base/Document.cpp:10746:18
    #35 0x7fb4494c5eac in mozilla::dom::Document::UnblockOnload(bool) /builds/worker/workspace/build/src/dom/base/Document.cpp:10678:9
    #36 0x7fb4494eadfc in mozilla::dom::Document::DispatchContentLoadedEvents() /builds/worker/workspace/build/src/dom/base/Document.cpp:7349:3
    #37 0x7fb4495b6bd4 in applyImpl<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/build/src/obj-firefox/dist/include/nsThreadUtils.h:1160:12
    #38 0x7fb4495b6bd4 in apply<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/build/src/obj-firefox/dist/include/nsThreadUtils.h:1166:12
    #39 0x7fb4495b6bd4 in mozilla::detail::RunnableMethodImpl<mozilla::dom::Document*, void (mozilla::dom::Document::*)(), true, (mozilla::RunnableKind)0>::Run() /builds/worker/workspace/build/src/obj-firefox/dist/include/nsThreadUtils.h:1212:13
    #40 0x7fb44553e68d in mozilla::SchedulerGroup::Runnable::Run() /builds/worker/workspace/build/src/xpcom/threads/SchedulerGroup.cpp:282:20
    #41 0x7fb445572c98 in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1220:14
    #42 0x7fb44557dafc in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:481:10
    #43 0x7fb4467d3e9f in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/worker/workspace/build/src/ipc/glue/MessagePump.cpp:87:21
    #44 0x7fb4466c70c7 in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10
    #45 0x7fb4466c70c7 in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308:3
    #46 0x7fb4466c70c7 in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290:3
    #47 0x7fb44d85b3d8 in nsBaseAppShell::Run() /builds/worker/workspace/build/src/widget/nsBaseAppShell.cpp:137:27
    #48 0x7fb45138e3c6 in XRE_RunAppShell() /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:944:20
    #49 0x7fb4466c70c7 in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10
    #50 0x7fb4466c70c7 in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308:3
    #51 0x7fb4466c70c7 in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290:3
    #52 0x7fb45138d989 in XRE_InitChildProcess(int, char**, XREChildData const*) /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:779:34
    #53 0x563326dbe433 in content_process_main /builds/worker/workspace/build/src/browser/app/../../ipc/contentproc/plugin-container.cpp:56:28
    #54 0x563326dbe433 in main /builds/worker/workspace/build/src/browser/app/nsBrowserApp.cpp:303:18
    #55 0x7fb468147b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /build/glibc-OTsEL5/glibc-2.27/string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:134 in memcpy
Flags: in-testsuite?
Attached file prefs.js
Whiteboard: [jsbugmon:confirm] → [jsbugmon:confirm][fuzzblocker]
BugMon: Verified bug as reproducible on 94c8f28a15e8a051aeaad4722deb3fcc8125dab2
BugMon: Reduced build range to...
> Start: 0cec40c582f0e90b3690dc3c9fcf8a098d49ca2d (20200221055631)
> End: acc0c8327c266ac0b0c61eecdba6d625957ecf81 (20200221095110)
> Pushlog: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=0cec40c582f0e90b3690dc3c9fcf8a098d49ca2d&tochange=acc0c8327c266ac0b0c61eecdba6d625957ecf81
Whiteboard: [jsbugmon:confirm][fuzzblocker] → [jsbugmon:confirmed][fuzzblocker]
Flags: needinfo?(jgilbert)
Priority: -- → P3
Assignee: nobody → jgilbert
Flags: needinfo?(jgilbert)
Priority: P3 → P2

Hi Jeff, are you planning to come to this for 75 ? Thank you!

Flags: needinfo?(jgilbert)

Oops, ReadPixels_SharedPrecheck was supposed to check IsContextLost.

Flags: needinfo?(jgilbert)
Priority: P2 → P1
Pushed by jgilbert@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/63670a1a8495
Check IsContextLost in ReadPixels. r=lsalzman

Comment on attachment 9130963 [details]
Bug 1618325 - Check IsContextLost in ReadPixels.

Beta/Release Uplift Approval Request

  • User impact if declined: UAF/crash in a plausible scenario.
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Basically no risk here, just one extra line of validation
  • String changes made/needed: none
Attachment #9130963 - Flags: approval-mozilla-beta?
Summary: AddressSanitizer: SEGV /build/glibc-OTsEL5/glibc-2.27/string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:134 in memcpy → Non-ASAN crash and AddressSanitizer: SEGV /build/glibc-OTsEL5/glibc-2.27/string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:134 in memcpy

Comment on attachment 9130963 [details]
Bug 1618325 - Check IsContextLost in ReadPixels.

I think this is unaffected in 74.

Attachment #9130963 - Flags: approval-mozilla-beta?
Regressed by: 1616715
No longer regressed by: webgl-ipc-refactor
Has Regression Range: --- → yes
Crash Signature: [@ mozilla::ClientWebGLContext::ReadPixels]
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: