gpu-dawn: Looks like ubsan catches an issue in dawn - crash in debug config (linux, vulkan) #221

Closed
opened 2022-04-13 18:07:53 +00:00 by michal-z · 10 comments
michal-z commented 2022-04-13 18:07:53 +00:00 (Migrated from github.com)

Works fine in release - I think we could consider disabling sanitizers when building dawn or spend some time debugging.

image

Works fine in release - I think we could consider disabling sanitizers when building dawn or spend some time debugging. ![image](https://user-images.githubusercontent.com/11540112/163242612-518ded15-fc97-43d9-9f70-51a6231a804f.png)
michal-z commented 2022-04-14 08:22:33 +00:00 (Migrated from github.com)

I can confirm that building dawn from source with sanitizers disabled (-fno-sanitize=undefined) fixes the crash.

github.com/michal-z/zig-gamedev@29d4f584ac

I can confirm that building dawn from source with sanitizers disabled (`-fno-sanitize=undefined`) fixes the crash. https://github.com/michal-z/zig-gamedev/commit/29d4f584ac4e731196aad3c607ba539734cb6971
michal-z commented 2022-04-14 08:48:32 +00:00 (Migrated from github.com)

Found the issue in dawn. ubsan is complaining about memcpy being called with size 0.

The fix is to check dynamicOffsetCount before calling SetDynamicOffsets.

In src/dawn/native/BindGroupTracker.h line 58:

Current code:

SetDynamicOffsets(mDynamicOffsets[index].data(), dynamicOffsetCount, dynamicOffsets);

Fixed code:

if (dynamicOffsetCount > 0) {
    SetDynamicOffsets(mDynamicOffsets[index].data(), dynamicOffsetCount, dynamicOffsets);
}
Found the issue in dawn. ubsan is complaining about memcpy being called with size 0. The fix is to check `dynamicOffsetCount` before calling `SetDynamicOffsets`. In `src/dawn/native/BindGroupTracker.h` line 58: Current code: ```cpp SetDynamicOffsets(mDynamicOffsets[index].data(), dynamicOffsetCount, dynamicOffsets); ``` Fixed code: ```cpp if (dynamicOffsetCount > 0) { SetDynamicOffsets(mDynamicOffsets[index].data(), dynamicOffsetCount, dynamicOffsets); } ```
Kangz commented 2022-04-14 11:47:31 +00:00 (Migrated from github.com)

Can you file an issue on crbug.com/dawn ? :)

Can you file an issue on crbug.com/dawn ? :)
michal-z commented 2022-04-14 12:01:11 +00:00 (Migrated from github.com)

Can you file an issue on crbug.com/dawn ? :)

https://bugs.chromium.org/p/dawn/issues/detail?id=1371

> Can you file an issue on crbug.com/dawn ? :) https://bugs.chromium.org/p/dawn/issues/detail?id=1371
silversquirl commented 2022-04-14 12:02:00 +00:00 (Migrated from github.com)
See hexops/dawn#9
michal-z commented 2022-04-14 12:24:50 +00:00 (Migrated from github.com)

@slimsag Can you please merge above PR? This issue affects zig-gamedev project -- all Linux users get a crash in WebGPU imgui renderer. Thanks!

@slimsag Can you please merge above PR? This issue affects zig-gamedev project -- all Linux users get a crash in WebGPU imgui renderer. Thanks!
emidoots commented 2022-04-15 17:19:00 +00:00 (Migrated from github.com)

Should be able to merge+release the temporary patch in the next few days (a bit swamped right now due to holiday)

Will also make sure we send a CL upstream to Dawn for this change.

Should be able to merge+release the temporary patch in the next few days (a bit swamped right now due to holiday) Will also make sure we send a CL upstream to Dawn for this change.
michal-z commented 2022-04-15 17:33:49 +00:00 (Migrated from github.com)

Sounds good, thanks! Do you also plan to fetch the latest code from Dawn and create another generated-* branch?

Sounds good, thanks! Do you also plan to fetch the latest code from Dawn and create another `generated-*` branch?
emidoots commented 2022-04-16 17:21:43 +00:00 (Migrated from github.com)

Yes

Yes
emidoots commented 2022-04-19 04:29:28 +00:00 (Migrated from github.com)

Should be fixed now (sorry for closing prematurely!) - fixed in github.com/hexops/mach@c9ac61c1c4

Feel free to file a new issue if you continue to run into issues.

Should be fixed now (sorry for closing prematurely!) - fixed in https://github.com/hexops/mach/commit/c9ac61c1c4093e4b4b524c6b5dd7ca4f2fc6e5b4 Feel free to file a new issue if you continue to run into issues.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hexops/mach#221
No description provided.