Issue #3484 has been updated by liweitianux. Status changed from New to Resolved
Merged. Thanks. ---------------------------------------- Bug #3484: drm: mmap(2) of /dev/dri/card0 at an offset that is not a GEM offset panics the kernel http://bugs.dragonflybsd.org/issues/3484#change-14992 * Author: sigttou * Status: Resolved * Priority: Normal * Category: Driver * Target version: 6.6 * Start date: 2026-11-26 ---------------------------------------- @mmap(NULL, 4096, PROT_READ, MAP_SHARED, fd, 0x1000000)@ on @/dev/dri/card0@ (also offset 0 or any page that is not a GEM mmap offset) panics the kernel: Fatal trap 12: page fault while in kernel mode fault virtual address = 0x78 fault code = supervisor read data, page not present panic: page fault trap_fatal() <- trap_pfault() <- trap() <- calltrap() <- drm_mmap()+0x24 <- dev_dmmap()+0x55 @drm_gem_mmap_single()@ returns @ENODEV@ when no GEM object has the offset. @vm_mmap()@ takes @ENODEV@ from @dev_dmmap_single()@ as "use the device pager", the pager calls @drm_mmap()@ without a file, and @drm_mmap()@ reads @filp->private_data@ (0x78 is its offset in struct file) with @filp == NULL@. Any user who can open the device node (group video) can crash the machine with one call. The attached patch makes @drm_mmap_single()@ fail the lookup with @EINVAL@, as Linux does, and makes @drm_mmap()@ refuse a call without a file. ---Files-------------------------------- 0001-drm-fix-a-panic-on-mmap-at-an-unknown-offset.patch (1.82 KB) -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
