Re: i915 driver fails on i686 userspace + x86_64 kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 15, 2013 at 02:00:50PM -0400, Pavel Roskin wrote:
> Hi Chris,
> 
> It's almost certainly stack corruption.  This "patch" fixes X for me.
> The first DRM_IOCTL_MODE_GETCONNECTOR in sna_output_init() must be
> overwriting the implied memory bounds.
> 
> diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
> index 28151ab..dac834f 100644
> --- a/src/sna/sna_display.c
> +++ b/src/sna/sna_display.c
> @@ -2588,6 +2588,7 @@ sna_output_init(ScrnInfoPtr scrn, struct sna_mode *mode, int num)
>  	struct sna *sna = to_sna(scrn);
>  	xf86OutputPtr output;
>  	struct drm_mode_get_connector conn;
> +	int enc_protect[16];

Yikes, that implies we have a size mismatch with the kernel - ideally we
construct the struct to have the same size when compiled with 32 or 64 bits.

Please try:

commit a63b4d5a0766a7e98efeff8dd520c58e9a1bea88
Author: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
Date:   Tue Oct 15 21:53:16 2013 +0100

    sna: Expand packed KMS structs for 64-bit alignment
    
    Pavel Roskin found that with a 32-bit build of the DDX with a 64-bit
    kernel that the call to GETCONNECTOR was overwriting the 4 bytes beyond
    the end of the drm_mode_get_connector structure. This would appear to be
    due to the surreptious padding inserted by the compiler so that the
    structure would be naturally aligned on a 64-bit system. To compenstate
    we need to insert padding between the adjacent 32-bit structures on the
    stack.
    
    As usual, be paranoid and make sure that all the adjacent KMS structs we
    use are padded out to an 64-bit boundary.
    
    Reported-by: Pavel Roskin <proski@xxxxxxx>
    Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>

Thanks,
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux