Skip to content

Conversation

jrtc27
Copy link

@jrtc27 jrtc27 commented Nov 16, 2022

This function is at the FreeBSD/Linux boundary, with unlocked_ioctl conforming to Linux's return value conventions, i.e. errors are negative, and drm_fstub_ioctl conforming to FreeBSD's, i.e. errors are positive. Thus, negate the return value here to translate between the two, otherwise userspace will see negated errno values that don't match any known value; in particular, libdrm's drmIsMaster will erroneously always return true, which breaks KWin leasing a DRM fd to Xwayland.

This also matches what linuxkpi does, as used by drm-kmod.

This function is at the FreeBSD/Linux boundary, with unlocked_ioctl
conforming to Linux's return value conventions, i.e. errors are
negative, and drm_fstub_ioctl conforming to FreeBSD's, i.e. errors are
positive. Thus, negate the return value here to translate between the
two, otherwise userspace will see negated errno values that don't match
any known value; in particular, libdrm's drmIsMaster will erroneously
always return true, which breaks KWin leasing a DRM fd to Xwayland.

This also matches what linuxkpi does, as used by drm-kmod.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant