Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drm_os_freebsd: Fix drm_fstub_ioctl return value sign #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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