WebGPU shader leading to stack-buffer-overflow in Mesa
Categories
(Core :: Graphics: WebGPU, defect, P1)
Tracking
()
People
(Reporter: ameenbasha111, Assigned: aleiserson)
References
Details
(Keywords: reporter-external, sec-vector, Whiteboard: [client-bounty-form])
Attachments
(2 files, 1 external file)
Hi team, Firefox asan build crashed with below details for the attached poc
AddressSanitizer:DEADLYSIGNAL
==5552==ERROR: AddressSanitizer: SEGV on unknown address 0x00000000001c (pc 0x7030c0f27ee1 bp 0x70312d69ffe0 sp 0x70312d69fa40 T45)
==5552==The signal is caused by a READ memory access.
==5552==Hint: address points to the zero page.
#0 0x7030c0f27ee1 (/usr/lib/x86_64-linux-gnu/libvulkan_intel.so+0x527ee1) (BuildId: 92a11138c387e41cd608b12bb872c5b493af61da)
#1 0x7030c0f296c9 (/usr/lib/x86_64-linux-gnu/libvulkan_intel.so+0x5296c9) (BuildId: 92a11138c387e41cd608b12bb872c5b493af61da)
#2 0x7030c0f2b98c (/usr/lib/x86_64-linux-gnu/libvulkan_intel.so+0x52b98c) (BuildId: 92a11138c387e41cd608b12bb872c5b493af61da)
#3 0x7030c10513d9 (/usr/lib/x86_64-linux-gnu/libvulkan_intel.so+0x6513d9) (BuildId: 92a11138c387e41cd608b12bb872c5b493af61da)
#4 0x7030c0fd4e37 (/usr/lib/x86_64-linux-gnu/libvulkan_intel.so+0x5d4e37) (BuildId: 92a11138c387e41cd608b12bb872c5b493af61da)
#5 0x7030c0a7ae16 (/usr/lib/x86_64-linux-gnu/libvulkan_intel.so+0x7ae16) (BuildId: 92a11138c387e41cd608b12bb872c5b493af61da)
#6 0x7030c0a7d6a1 (/usr/lib/x86_64-linux-gnu/libvulkan_intel.so+0x7d6a1) (BuildId: 92a11138c387e41cd608b12bb872c5b493af61da)
#7 0x70318575a015 in ash::device::Device::create_compute_pipelines::h51a764a0be76a93d /builds/worker/checkouts/gecko/third_party/rust/ash/src/device.rs:2185:24
#8 0x70318575a015 in wgpu_hal::vulkan::device::_$LT$impl$u20$wgpu_hal..Device$u20$for$u20$wgpu_hal..vulkan..Device$GT$::create_compute_pipeline::h6ac36cd45f05579a /builds/worker/checkouts/gecko/third_party/rust/wgpu-hal/src/vulkan/device.rs:2436:17
#9 0x7031852077d4 in $LT$D$u20$as$u20$wgpu_hal..dynamic..device..DynDevice$GT$::create_compute_pipeline::hbdb629675b8b95af /builds/worker/checkouts/gecko/third_party/rust/wgpu-hal/src/dynamic/device.rs:451:18
#10 0x703185694dc9 in wgpu_core::device::resource::Device::create_compute_pipeline::hf540d4647b7e84d3 /builds/worker/checkouts/gecko/third_party/rust/wgpu-core/src/device/resource.rs:3075:22
#11 0x703185694dc9 in wgpu_core::device::global::$LT$impl$u20$wgpu_core..global..Global$GT$::device_create_compute_pipeline::h18d20a634931dc49 /builds/worker/checkouts/gecko/third_party/rust/wgpu-core/src/device/global.rs:1541:34
#12 0x7031852e2d39 in wgpu_bindings::server::Global::device_action::hd96edf2300755bcf /builds/worker/checkouts/gecko/gfx/wgpu_bindings/src/server.rs:2174:21
#13 0x7031852e2d39 in wgpu_bindings::server::process_message::he0df84291d20c356 /builds/worker/checkouts/gecko/gfx/wgpu_bindings/src/server.rs:2638:13
#14 0x7031852bd043 in wgpu_server_messages /builds/worker/checkouts/gecko/gfx/wgpu_bindings/src/server.rs:2486:9
#15 0x7031794ef701 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>>&&) /builds/worker/checkouts/gecko/dom/webgpu/ipc/WebGPUParent.cpp:1554:3
#16 0x7031794f2719 in mozilla::webgpu::PWebGPUParent::OnMessageReceived(IPC::Message const&) /builds/worker/workspace/obj-build/ipc/ipdl/PWebGPUParent.cpp:306:80
#17 0x7031761b9de9 in mozilla::gfx::PCanvasManagerParent::OnMessageReceived(IPC::Message const&) /builds/worker/workspace/obj-build/ipc/ipdl/PCanvasManagerParent.cpp:261:32
#18 0x703174a6d93a in mozilla::ipc::MessageChannel::DispatchAsyncMessage(mozilla::ipc::ActorLifecycleProxy*, IPC::Message const&) /builds/worker/checkouts/gecko/ipc/glue/MessageChannel.cpp:1795:25
#19 0x703174a6af36 in mozilla::ipc::MessageChannel::DispatchMessage(mozilla::ipc::ActorLifecycleProxy*, std::unique_ptr<IPC::Message, mozilla::DefaultDelete<IPC::Message>>) /builds/worker/checkouts/gecko/ipc/glue/MessageChannel.cpp:1721:9
#20 0x703174a6bae4 in mozilla::ipc::MessageChannel::RunMessage(mozilla::ipc::ActorLifecycleProxy*, mozilla::ipc::MessageChannel::MessageTask&) /builds/worker/checkouts/gecko/ipc/glue/MessageChannel.cpp:1512:3
#21 0x703174a6c9f2 in mozilla::ipc::MessageChannel::MessageTask::Run() /builds/worker/checkouts/gecko/ipc/glue/MessageChannel.cpp:1612:14
#22 0x7031735cabdc in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:1153:16
#23 0x7031735d5138 in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.cpp:480:10
#24 0x703174a7560a in mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*) /builds/worker/checkouts/gecko/ipc/glue/MessagePump.cpp:329:5
#25 0x703174980f34 in RunInternal /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:369:10
#26 0x703174980f34 in RunHandler /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:362:3
#27 0x703174980f34 in MessageLoop::Run() /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:344:3
#28 0x7031735c3a1e in nsThread::ThreadFunc(void*) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:366:10
#29 0x70318eec38ab in _pt_root /builds/worker/checkouts/gecko/nsprpub/pr/src/pthreads/ptthread.c:191:3
#30 0x5ac7c7eb3986 in asan_thread_start(void*) /builds/worker/fetches/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:239:28
#31 0x70318ec9caa3 in start_thread nptl/pthread_create.c:447:8
#32 0x70318ed29c3b in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
==5552==Register values:
rax = 0x000070312d6a0110 rbx = 0x0000000000000020 rcx = 0x0000000000000001 rdx = 0x0000000000000020
rdi = 0x0000000000000020 rsi = 0x000070312d6a0100 rbp = 0x000070312d69ffe0 rsp = 0x000070312d69fa40
r8 = 0x0000000000000020 r9 = 0x00000000ffffffe8 r10 = 0x0000000000000001 r11 = 0x0000000000000020
r12 = 0x0000000000000020 r13 = 0x0000000000000000 r14 = 0x000070312d6a0108 r15 = 0x0000000000000002
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/usr/lib/x86_64-linux-gnu/libvulkan_intel.so+0x527ee1) (BuildId: 92a11138c387e41cd608b12bb872c5b493af61da)
Thread T45 created by T0 here:
#0 0x5ac7c7e9cf61 in pthread_create /builds/worker/fetches/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:250:3
#1 0x70318eeb4419 in _PR_CreateThread /builds/worker/checkouts/gecko/nsprpub/pr/src/pthreads/ptthread.c:429:10
#2 0x70318eea265e in PR_CreateThread /builds/worker/checkouts/gecko/nsprpub/pr/src/pthreads/ptthread.c:496:10
#3 0x7031735c6421 in nsThread::Init(nsTSubstring<char> const&) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:615:20
#4 0x7031735d3a30 in nsThreadManager::NewNamedThread(nsTSubstring<char> const&, nsIThreadManager::ThreadCreationOptions, nsIThread**) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadManager.cpp:619:22
#5 0x7031735de479 in NS_NewNamedThread(nsTSubstring<char> const&, nsIThread**, already_AddRefed<nsIRunnable>, nsIThreadManager::ThreadCreationOptions) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.cpp:176:57
#6 0x7031761817c0 in NS_NewNamedThread<15UL> /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.h:76:10
#7 0x7031761817c0 in mozilla::gfx::CanvasRenderThread::Start() /builds/worker/checkouts/gecko/gfx/ipc/CanvasRenderThread.cpp:115:17
#8 0x703175fe7d76 in gfxPlatform::Init() /builds/worker/checkouts/gecko/gfx/thebes/gfxPlatform.cpp:982:3
#9 0x70317d1de92f in GetPlatform /builds/worker/workspace/obj-build/dist/include/gfxPlatform.h:189:7
#10 0x70317d1de92f in nsWindow::Create(nsIWidget*, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel> const&, mozilla::widget::InitData*) /builds/worker/checkouts/gecko/widget/gtk/nsWindow.cpp:6161:13
#11 0x70317d03a9ae in nsIWidget::Create(nsIWidget*, mozilla::gfx::IntRectTyped<mozilla::DesktopPixel> const&, mozilla::widget::InitData*) /builds/worker/checkouts/gecko/widget/nsIWidget.h:444:12
#12 0x70317e3541ef in mozilla::AppWindow::Initialize(nsIAppWindow*, nsIAppWindow*, int, int, bool, mozilla::widget::InitData&) /builds/worker/checkouts/gecko/xpfe/appshell/AppWindow.cpp:215:17
#13 0x70317e36e607 in nsAppShellService::JustCreateTopWindow(nsIAppWindow*, nsIURI*, unsigned int, int, int, bool, mozilla::AppWindow**) /builds/worker/checkouts/gecko/xpfe/appshell/nsAppShellService.cpp:593:15
#14 0x70317e36dd84 in nsAppShellService::CreateTopLevelWindow(nsIAppWindow*, nsIURI*, unsigned int, int, int, nsIAppWindow**) /builds/worker/checkouts/gecko/xpfe/appshell/nsAppShellService.cpp:162:8
#15 0x70317ed78e1c in nsAppStartup::CreateChromeWindow(nsIWebBrowserChrome*, unsigned int, nsIOpenWindowInfo*, bool*, nsIWebBrowserChrome**) /builds/worker/checkouts/gecko/toolkit/components/startup/nsAppStartup.cpp:752:15
#16 0x70317eec576f in nsWindowWatcher::CreateChromeWindow(nsIWebBrowserChrome*, unsigned int, nsIOpenWindowInfo*, nsIWebBrowserChrome**) /builds/worker/checkouts/gecko/toolkit/components/windowwatcher/nsWindowWatcher.cpp:443:33
#17 0x70317eec3b62 in nsWindowWatcher::OpenWindowInternal(mozIDOMWindowProxy*, nsIURI*, nsTSubstring<char> const&, nsTSubstring<char> const&, mozilla::dom::UserActivation::Modifiers const&, bool, bool, bool, nsIArray*, bool, bool, bool, nsPIWindowWatcher::PrintKind, nsDocShellLoadState*, mozilla::dom::BrowsingContext**) /builds/worker/checkouts/gecko/toolkit/components/windowwatcher/nsWindowWatcher.cpp:1094:12
#18 0x70317eebf955 in nsWindowWatcher::OpenWindowInternal(mozIDOMWindowProxy*, nsTSubstring<char> const&, nsTSubstring<char> const&, nsTSubstring<char> const&, mozilla::dom::UserActivation::Modifiers const&, bool, bool, bool, nsIArray*, bool, bool, bool, nsPIWindowWatcher::PrintKind, nsDocShellLoadState*, mozilla::dom::BrowsingContext**) /builds/worker/checkouts/gecko/toolkit/components/windowwatcher/nsWindowWatcher.cpp:645:27
#19 0x70317eebf1b9 in nsWindowWatcher::OpenWindow(mozIDOMWindowProxy*, nsTSubstring<char> const&, nsTSubstring<char> const&, nsTSubstring<char> const&, nsISupports*, mozIDOMWindowProxy**) /builds/worker/checkouts/gecko/toolkit/components/windowwatcher/nsWindowWatcher.cpp:296:3
#20 0x70317361208d in NS_InvokeByIndex /builds/worker/checkouts/gecko/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_x86_64_unix.S:101
#21 0x703174ce26e4 in Invoke /builds/worker/checkouts/gecko/js/xpconnect/src/XPCWrappedNative.cpp:1620:10
#22 0x703174ce26e4 in Call /builds/worker/checkouts/gecko/js/xpconnect/src/XPCWrappedNative.cpp:1174:19
#23 0x703174ce26e4 in XPCWrappedNative::CallMethod(XPCCallContext&, XPCWrappedNative::CallMode) /builds/worker/checkouts/gecko/js/xpconnect/src/XPCWrappedNative.cpp:1120:23
#24 0x703174ce6ba3 in XPC_WN_CallMethod(JSContext*, unsigned int, JS::Value*) /builds/worker/checkouts/gecko/js/xpconnect/src/XPCWrappedNativeJSOps.cpp:966:10
#25 0x70317f20fd77 in CallJSNative /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:501:13
#26 0x70317f20fd77 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:597:12
#27 0x70317f22d94d in InternalCall /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:664:10
#28 0x70317f22d94d in CallFromStack /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:669:10
#29 0x70317f22d94d in js::Interpret(JSContext*, js::RunState&) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:3287:16
#30 0x70317f20eb59 in MaybeEnterInterpreterTrampoline /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:395:10
#31 0x70317f20eb59 in js::RunScript(JSContext*, js::RunState&) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:471:13
#32 0x70317f20feed in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:629:13
#33 0x70317f211bf1 in InternalCall /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:664:10
#34 0x70317f211bf1 in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:696:8
#35 0x70317f347016 in JS_CallFunctionValue(JSContext*, JS::Handle<JSObject*>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) /builds/worker/checkouts/gecko/js/src/vm/CallAndConstruct.cpp:55:10
#36 0x703174cd635e in nsXPCWrappedJS::CallMethod(unsigned short, nsXPTMethodInfo const*, nsXPTCMiniVariant*) /builds/worker/checkouts/gecko/js/xpconnect/src/XPCWrappedJSClass.cpp:918:17
#37 0x703173613909 in PrepareAndDispatch /builds/worker/checkouts/gecko/xpcom/reflect/xptcall/md/unix/xptcstubs_x86_64_linux.cpp:115:37
#38 0x7031736127be in SharedStub xptcstubs_x86_64_linux.cpp
#39 0x70317356bdce in NS_CreateServicesFromCategory(char const*, nsISupports*, char const*, char16_t const*) /builds/worker/checkouts/gecko/xpcom/components/nsCategoryManager.cpp:680:19
#40 0x70317efaa4d4 in XREMain::XRE_mainRun() /builds/worker/checkouts/gecko/toolkit/xre/nsAppRunner.cpp:5664:5
#41 0x70317efac5fb in XREMain::XRE_main(int, char**, mozilla::BootstrapConfig const&) /builds/worker/checkouts/gecko/toolkit/xre/nsAppRunner.cpp:6138:8
#42 0x70317efad6b3 in XRE_main(int, char**, mozilla::BootstrapConfig const&) /builds/worker/checkouts/gecko/toolkit/xre/nsAppRunner.cpp:6211:21
#43 0x5ac7c7efa415 in do_main /builds/worker/checkouts/gecko/browser/app/nsBrowserApp.cpp:232:22
#44 0x5ac7c7efa415 in main /builds/worker/checkouts/gecko/browser/app/nsBrowserApp.cpp:464:16
#45 0x70318ec2a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#46 0x70318ec2a28a in __libc_start_main csu/../csu/libc-start.c:360:3
#47 0x5ac7c7e19e28 in _start (/home/basha/Desktop/Asan/firefox-asan/firefox/firefox+0xbde28) (BuildId: 8fde2e1ebef9cf728b0d8728b3841f80ca93d854)
==5552==ABORTING
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Exiting due to channel error.
Ref: https://issues.chromium.org/issues/408364839
I have attched the poc file used
Note: Tested with firefox prebuilded asan downloaded on ubuntu latest 24
| Reporter | ||
Comment 1•1 year ago
|
||
Tested asan build version: NIghtly 142.0a1 (2025-07-19) (64-bit)
| Reporter | ||
Comment 2•1 year ago
|
||
Minimized version
| Reporter | ||
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Comment 3•1 year ago
|
||
Superb - thank you for the reduced test case! We'll see if we can reproduce.
| Reporter | ||
Comment 4•1 year ago
|
||
Hi Team, any update on initial validation?
Updated•1 year ago
|
| Assignee | ||
Comment 5•1 year ago
|
||
I can reproduce this. The crash appears to be at https://gitlab.freedesktop.org/mesa/mesa/-/blob/mesa-24.2.8/src/compiler/nir/nir_builder.h#L1308.
| Assignee | ||
Comment 6•1 year ago
|
||
This is reproducible by passing SPIR-V to the Vulkan APIs. I don't see any problem with the naga-generated SPIR-V, it appears to be a bug in the compiler. I suspect that the compiler is inlining f(g: u32) { e[g] = 0; } and then attempting to combine (vectorize) the stores corresponding to two of the function calls:
f(k[n]);
f(1);
f(l.y);
But these can't be vectorized, and something goes wrong in attempting to do so. The relevant code is nir_extract_bits, linked in the previous comment, and vectorize_stores, https://gitlab.freedesktop.org/mesa/mesa/-/blob/mesa-24.2.8/src/compiler/nir/nir_opt_load_store_vectorize.c#L814. Relevant snippets:
nir_def *high_val = high->intrin->src[high->info->value_src].ssa;
...
data_channels[i] = nir_extract_bits(b, &high_val, 1, offset, 1, new_bit_size);
...
nir_extract_bits(nir_builder *b, nir_def **srcs, unsigned num_srcs,
unsigned first_bit,
unsigned dest_num_components, unsigned dest_bit_size)
...
src_end_bit += srcs[src_idx]->bit_size *
srcs[src_idx]->num_components;
I don't see any reason that this is inherently limited to be a null pointer dereference in all circumstances, it depends on what is on the stack after high_val. However, it does appear to be explicitly zeroed in the build that I am looking at.
| Assignee | ||
Comment 7•1 year ago
|
||
I have forwarded this report, confidentially and with credit to the original reporter, along with my test case, to the Mesa project: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13623 (link not publicly accessible)
| Assignee | ||
Comment 8•1 year ago
|
||
Mesa project reports that they can reproduce this in version 24.2, but not in the latest version, and that it goes away in 24.2 after applying https://gitlab.freedesktop.org/mesa/mesa/-/commit/2ed79f80ba894bba0d340708c326ac9d59d5795e.
| Assignee | ||
Comment 9•1 year ago
|
||
This is the same as the Chromium issue linked in the description. When I initially looked at the Chromium issue, I thought that it was something different because it described a stack buffer overflow, and the symptom here is a null pointer dereference. But the Chromium report used an ASAN build of Mesa. We are seeing the same thing, but Mesa is not built with ASAN, so the out of bounds access is not detected directly. It happens to return a zero pointer which is immediately dereferenced.
| Reporter | ||
Comment 10•1 year ago
|
||
(In reply to Andy Leiserson from comment #9)
This is the same as the Chromium issue linked in the description.
Chrome assigned this is critical severity since it was a stack overflow and could possibly lead to code execution l
So can we assign the severity field as sec-crit and initiate the fix with priority?
Updated•1 year ago
|
Comment 11•1 year ago
|
||
I think the timeline goes like this (mostly derived from Chromium issue you linked):
- April 4: Somebody else reported this issue to Chromium.
- April 4: Chromium decided this was a problem with the Mesa driver (despite being accessed via WebGPU).
- April 11: Mesa patched the issue
- April 15: Chromium OS took the fix in their repository, because they ship Mesa to users.
- April 18: Chromium paid out a bounty.
- July 23: the Chromium issue got opened.
- July 24: Ameen reported the issue to us.
So, it sort of is sec-critical, because the issue is public, but the fix isn't in Firefox code, it is in Mesa, so it is also kind of sec-vector. The fix has already landed, so it is a matter of the Mesa driver releasing a new version, so I'll mark it "fixed". I'm not sure how this all should sort out for bounty purposes, but we should figure out how this should work as I don't think this will be the last time as WebGPU exposes Firefox more directly to driver bugs.
Updated•1 year ago
|
Updated•1 year ago
|
Comment 12•1 year ago
|
||
(In reply to Ameen Basha M K from comment #10)
Chrome assigned this is critical severity since it was a stack overflow and could possibly lead to code execution
The Chrome team changed it to S1, the equivalent to our sec-high. They use "S0" for critical. They also said it was partly because their GPU process was weakly sandboxed, whereas ours is sandboxed similarly to our content processes.
This earned a Chrome bounty because the Mesa driver was covered as part of ChromeOS, not because it was Chrome.
Comment 13•1 year ago
|
||
Andy: is there anything a browser could reasonably do to protect against this? I mean other than blocklisting all down-rev versions of the Mesa driver which isn't a practical answer. If there's nothing we could do we can close this again, but if there are defenses then we could be protecting a whole lot of people who won't get driver updates for quite a while depending on their distro.
| Assignee | ||
Comment 14•1 year ago
|
||
I don't think it is very feasible to protect against this. We could try and identify problematic structures in shaders, but it would be a significant undertaking to try and understand all the different ways this particular optimizer could get invoked and figure out how to suppress the pathological cases without hurting performance in any important cases.
There is already some protection in that the shader is translated from WGSL to SPIR-V and then from SPIR-V to the IR used by mesa. So malicious content can't directly feed things to the optimizer where the bug is.
There are also the mitigating factors that it's only an out-of-bounds read, the value isn't directly used for something like an indirect jump where the strategy to exploit is apparent, and in the vulnerable build that I looked at it appeared that the bug would deterministically produce a null pointer dereference. It's certainly a memory safety bug and should be taken seriously, but to me it's not evident that it is exploitable.
I did send a note to Ubuntu security since they appear to be distributing a vulnerable version in 24.04 still.
Comment 15•1 year ago
|
||
dveditz: Given that the Mesa bug led to Chrome paying a bug bounty, wouldn't Mesa treat it as something urgent to get out to others? Are there really Linux distributions that do not distribute security fixes?
Comment 16•1 year ago
|
||
I did send a note to Ubuntu security since they appear to be distributing a vulnerable version in 24.04 still.
Andy, if this results in any sort of issue or linkable artifact, please link it here.
Comment 17•1 year ago
|
||
They also said it was partly because their GPU process was weakly sandboxed, whereas ours is sandboxed similarly to our content processes.
dveditz: We do not use a GPU sandbox process on Linux. Mesa runs in the main process.
I've been insisting that we get a GPU process stood up on Linux before we ship WebGPU there on release, but unfortunately we have WebGPU enabled in Nightly on Linux without a GPU process.
I think we should consider blocklisting the broken Mesa drivers. Firefox release users don't have WebGPU at all on Linux, and Chrome hasn't enabled WebGPU on Linux in their release yet, so it's unlikely that there are people who can't cope with its absence.
Updated•1 year ago
|
| Assignee | ||
Comment 18•1 year ago
|
||
Ubuntu has shipped updated Mesa packages for 24.04. https://packages.ubuntu.com/noble-updates/mesa-vulkan-drivers now offers 25.0.7-0ubuntu0.24.04.1.
It appears they bumped the priority to critical on 7/28. (Comment #27 on https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/2111480.) This was one day before my report to Mesa and three days before my report to Ubuntu, so they were already on top of it (although ideally they would have had a heads-up before the Chrome report was made public).
Comment 19•1 year ago
|
||
(In reply to Jim Blandy :jimb from comment #15)
dveditz: Given that the Mesa bug led to Chrome paying a bug bounty, wouldn't Mesa treat it as something urgent to get out to others? Are there really Linux distributions that do not distribute security fixes?
One would hope so, but 4 months after the patch Ubuntu hadn't shipped an update on their LTS until after Andy pinged them about it. Did the Mesa team not get the word out (I don't see a CVE for it)? Did they think it was less serious than the ChromiumOS team did? Or did the word get out but the Ubuntu team missed it? The Ubuntu folks usually seem pretty good at that, but if they missed it I'm guessing other distros did, too.
We do not use a GPU sandbox process on Linux. Mesa runs in the main process.
Thanks. That's not great. Is this feature staying nightly-only until we get one?
Comment 20•1 year ago
•
|
||
We do not use a GPU sandbox process on Linux. Mesa runs in the main process.
That's not great.
I strongly agree.
Is this feature staying nightly-only until we get one?
Every time we discuss shipping WebGPU on Linux I reiterate that a GPU sandbox is a prerequisite. The graphics team has an engineer working on this. A GPU process is listed as a prerequisite on the Jira ticket.
Comment 21•1 year ago
|
||
The next step on this bug is to add a blocklist entry for the broken Mesa driver.
Updated•1 year ago
|
Updated•1 year ago
|
| Assignee | ||
Comment 22•1 year ago
|
||
SKIP_BMO_CHECK
Comment 23•1 year ago
|
||
Comment 24•1 year ago
|
||
Comment 25•1 year ago
|
||
Backed out for webgpu failures:
https://hg.mozilla.org/integration/autoland/rev/47ecf44d007510f9c96b5edaf2c84955382eedf0
TEST-UNEXPECTED-FAIL | dom/webgpu/tests/mochitest/test_rfp_clamp_limits_on.html | Unhandled exception NotSupportedError: WebGPU is disabled by blocklist
and more failures
| Assignee | ||
Updated•1 year ago
|
Comment 26•1 year ago
|
||
Comment 27•1 year ago
|
||
Updated•1 year ago
|
Updated•1 year ago
|
| Assignee | ||
Comment 28•1 year ago
|
||
:dveditz, is it appropriate to make this bug public at this point? It is already publicly disclosed via the Chromium issue. It only affects Linux, which means only nightly, so we don't need to wait for the fix to ride the trains. Having the bug public could help people who find the bug number in the WebGPU block reason.
And for anyone here because WebGPU is blocked in their Firefox and it references this bug: you need to update your Mesa packages to version 25.0.4 or newer to resolve a security issue.
Updated•1 year ago
|
Comment 29•1 year ago
|
||
is it appropriate to make this bug public at this point?
Yes, sounds good.
Description
•