[Intel-gfx] sna: buffer overrun

Chris Wilson chris at chris-wilson.co.uk
Mon Nov 4 10:39:04 CET 2013


On Sun, Nov 03, 2013 at 11:06:55PM +0100, Mark Kettenis wrote:
> Fixed it the same way here, and things seem stable enough.  So I guess
> that's a:
> 
> Tested-by: Mark Kettenis <kettenis at openbsd.org>
> Reviewed-by: Mark Kettenis <kettenis at openbsd.org>

Thanks very much,

commit 7050c8da56676b60a602dce9abbdb61a7c4fa61e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Nov 4 09:31:05 2013 +0000

    sna: Use the unoptimized pwrite for general buffers
    
    When we call kgem_bo_write() we have less control over the allocation of
    the buffer, and do not ensure it meets the alignment criteria required
    for the cacheline optimisation. So use the simple pwrite routine to
    avoid reading beyond the end of the allocation.
    
    Reported-and-tested-by: Mark Kettenis <mark.kettenis at xs4all.nl>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

commit 8d067e961920e19fda7e9990440ac2be1a2e1760
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Nov 4 09:34:25 2013 +0000

    sna: Rename the two variants of pwrite so their relative dangers are obvious
    
    Since we extend the write in the cache-aligned routine, it runs the risk
    of reading from beyond the end of the allocation. As such, callers
    should be carefully vetted to make sure that their allocations are
    already cache-aligned (typically page-aligned). To make it obvious that
    this complexity exists, rename the routine.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list