https://bugs.kde.org/show_bug.cgi?id=492422
Bug ID: 492422
Summary: Please support DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD
Classification: Developer tools
Product: valgrind
Version: 3.23.0
Platform: Fedora RPMs
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
SUMMARY
It's hard to use valgrind to debug file descriptor errors in GTK applications
because valgrind doesn't understand that DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD may
allocate a file descriptor.
STEPS TO REPRODUCE
1. GSK_RENDERER=vulkan valgrind --tool=none --track-fds=yes gnome-calculator
OBSERVED RESULT
valgrind will print some actual fd bugs in GTK, but it will be very hard to
tell what is a real bug and what is not, because valgrind will also print a
bunch of false positive complaints that look like this:
==34793== File descriptor 27: /dmabuf: is already closed
==34793== at 0x63C7F9C: close (close.c:27)
==34793== by 0x397D1542: wsi_create_sync_for_image_syncobj
(wsi_common_drm.c:410)
==34793== by 0x397CEE67: wsi_common_acquire_next_image2 (wsi_common.c:1205)
==34793== by 0x397CEC92: wsi_AcquireNextImageKHR (wsi_common.c:1186)
==34793== by 0x4EEA265: gdk_vulkan_context_begin_frame
(gdkvulkancontext.c:652)
==34793== by 0x4EBAA46: gdk_draw_context_begin_frame_full
(gdkdrawcontext.c:399)
==34793== by 0x4F9D169: gsk_gpu_frame_default_begin (gskgpuframe.c:87)
==34793== by 0x4FB8B4F: gsk_vulkan_frame_begin (gskvulkanframe.c:160)
==34793== by 0x4F9D4C8: gsk_gpu_frame_begin (gskgpuframe.c:209)
==34793== by 0x4FB0AC1: gsk_gpu_renderer_render (gskgpurenderer.c:446)
==34793== by 0x4F0CC24: gsk_renderer_render (gskrenderer.c:495)
==34793== by 0x4BCC5C4: gtk_widget_render (gtkwidget.c:12012)
It will also print the backtrace to where the fd was previously allocated and
previously closed, but this is irrelevant. wsi_create_sync_for_image_syncobj()
is getting the fds via the DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD ioctl before closing
them, so they're coming straight from the kernel. valgrind just doesn't know
about this.
EXPECTED RESULT
No bogus complaints
SOFTWARE/OS VERSIONS
Fedora 40: gtk4-4.14.4-2.fc40, valgrind-1:3.23.0-4.fc40
ADDITIONAL INFORMATION
I've figured out that we need to add VKI_DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD and
struct vki_drm_syncobj_handle in vki-linux-drm.h, and then add
ML_(record_fd_open_nameless) somewhere in syswrap-linux.c. But that looks a
little complicated.
--
You are receiving this mail because:
You are watching all bug changes.