freebsd / drm-kmod

drm driver for FreeBSD
155 stars 69 forks source link

drm_os_freebsd.h: Define CONFIG_COMPAT #260

Closed amshafer closed 12 months ago

amshafer commented 12 months ago

This adds a definition of CONFIG_COMPAT, which controls whether or not 32-bit compatibility gets enabled during compilation. This unbreaks steam on nvidia-drm.

nvidia-drm declares its compat_ioctl file operation todrm_compat_ioctl, but drm_compat_ioctl is macro'd away as NULL when CONFIG_COMPAT is not defined. This causes 32-bit linux programs to go through the 64-bit ioctl functions, which makes them all segfault. An easy test program is /compat/linux/bin/glxinfo32, but steam is the real motivation here.

CONFIG_COMPAT is declared on amd64, I tried to use COMPAT_FREEBSD32 but that doesn't seem to be present unless you're in the main FreeBSD source tree's build.

amshafer commented 12 months ago

We probably also want this in 5.15-lts and the like since people on Discord have noticed the steam breakage. I'm not sure why nobody has run into this on intel or AMD and reported it so maybe there's another way they handle things?

evadot commented 12 months ago

Mhm, weird, yes if I read the code correctly this is needed. But we handle CONFIG_* option in kconfig.mk, can you modify it ? (Does nvidia-drm source this ? if not it should).

amshafer commented 12 months ago

You're right about kconfig.mk, I somehow missed that when I was searching for CONFIG_COMPAT. I can include that from nvidia-drm and that solves the problem, abandoning this MR.