Repository navigation
webgpu: Fix potential UaF in GPUBuffer - #45484
Conversation
We can't destroy the buffer since it might still be used. Instead, we should send `DropBuffer`, so the buffer can be destroyed once nothing references it. Signed-off-by: Jonathan Schwender <[email protected]>
|
Can you do |
Yes. |
|
Oh, this should make it easy to fix #44640. |
sagudev
left a comment
There was a problem hiding this comment.
I am willing to approve this as we should not be touching any SM objects in finalizers (read drop) anyway. But this is also is not proper solution as we should still do the cleanup (so detaching the buffer) as FF is doing: https://searchfox.org/firefox-main/source/dom/webgpu/Buffer.cpp#146.
I thought maybe we could have trait LazyFinalize: Drop that would cause all such objects to be stored in some array and then dropped from outside. But the problem are subobjects (they might be dead) and realm might also be dead, so we might need to something else (prefinalizer hooks ideally -- are they equal to FinalizeRegistery?)
We can't destroy the buffer since it might still be used. Instead, we should send `DropBuffer`, so the buffer can be destroyed once nothing references it (as all the surrounding webgpu code seems to do). Fixes a crash (racy) with spookyball on macos. Testing: Unclear Fixes: Part of servo#45474 Signed-off-by: Jonathan Schwender <[email protected]>
We can't destroy the buffer since it might still be used. Instead, we should send `DropBuffer`, so the buffer can be destroyed once nothing references it (as all the surrounding webgpu code seems to do). Fixes a crash (racy) with spookyball on macos. Testing: Unclear Fixes: Part of servo#45474 Signed-off-by: Jonathan Schwender <[email protected]> (cherry picked from commit cd23c72)
We can't destroy the buffer since it might still be used. Instead, we should send `DropBuffer`, so the buffer can be destroyed once nothing references it (as all the surrounding webgpu code seems to do). Fixes a crash (racy) with spookyball on macos. Testing: Unclear Fixes: Part of #45474 Signed-off-by: Jonathan Schwender <[email protected]> (cherry picked from commit cd23c72)
We can't destroy the buffer since it might still be used. Instead, we should send
DropBuffer, so the buffer can be destroyed once nothing references it (as all the surrounding webgpu code seems to do).Fixes a crash (racy) with spookyball on macos.
Testing: Unclear
Fixes: Part of #45474