i915 driver fails on i686 userspace + x86_64 kernel
Pavel Roskin
proski at gnu.org
Sat Oct 12 04:37:25 CEST 2013
Hello!
I'm running 32-bit Ubuntu 12.04 on the latest x86_64 kernel (mainline
git). I'm using the latest X from the x-edgers PPA
(2.99.904+git20131009.b9ad5b62-0ubuntu0sarvatt~precise).
The Intel Xorg driver fails with:
(EE) intel(0): No outputs and no modes.
Xorg works with the i386 kernel in the same configuration.
This is my understanding of what is happening.
sna_output_init() in the userspace driver calls
DRM_IOCTL_MODE_GETCONNECTOR. It sets conn.encoders_ptr to a 32-bit
pointer (an address of enc.encoder_id in the process memory). That
pointer is never converted to a 64-bit pointer.
drm_mode_getconnector() in the kernel simply calls put_user() on that
pointer to write the encoder IDs. Debug printing shows that the
pointer is indeed a 32-bit value. The encoder ID goes to a wrong
place in the memory.
Then sna_output_init() calls DRM_IOCTL_MODE_GETENCODER with the
enc.encoder_id that wasn't written to by the kernel, so it's 0.
drm_mode_getencoder() in the kernel returns -EINVAL.
sna_output_init() fails. Xorg assumes there are no valid screens and
exits.
I believe the error is on the kernel side. The kernel should convert
the pointer. compat_ptr() doesn't convert the value, only the type.
The comment in arch/x86/include/asm/compat.h says:
/*
* A pointer passed in from user mode. This should not
* be used for syscall parameters, just declare them
* as pointers because the syscall entry code will have
* appropriately converted them already.
*/
I cannot find that conversion code. Maybe it's in
arch/x86/ia32/ia32entry.S, but we want architecture independent code
in drivers/gpu/drm.
Or maybe the API for DRM_IOCTL_MODE_GETCONNECTOR is fundamentally wrong?
--
Regards,
Pavel Roskin
More information about the dri-devel
mailing list