Currently DRM_IOCTL_PRIME_HANDLE_TO_FD rejects all flags except (DRM|O)_CLOEXEC making it difficult (maybe impossible) for userspace to mmap() the resulting dma-buf even when this is supported by the DRM driver. It is trivial to relax the restriction and permit read/write access. This is safe because the flags are seldom touched by drm; mostly they are passed verbatim to dma_buf calls. v3 (Tiago): removed unused flags variable from drm_prime_handle_to_fd_ioctl.
Showing the changes to include/uapi (1 of 2 files). Show all
Unified · Split
| @@ -669,6 +669,7 @@ struct drm_set_client_cap { · 668 unmodified lines | ||
| 669 | 669 | __u64 value; |
| 670 | 670 | }; |
| 671 | 671 | |
| 672 | +#define DRM_RDWR O_RDWR | |
| 672 | 673 | #define DRM_CLOEXEC O_CLOEXEC |
| 673 | 674 | struct drm_prime_handle { |
| 674 | 675 | __u32 handle; |