Bug 96865

Summary: [swrast] egl-create-pbuffer-surface regression
Product: Mesa Reporter: Vinson Lee <vlee>
Component: Drivers/DRI/swrastAssignee: mesa-dev
Status: RESOLVED MOVED QA Contact: mesa-dev
Severity: normal    
Priority: medium CC: chadversary
Version: 13.0Keywords: bisected, regression
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Vinson Lee 2016-07-08 20:04:49 UTC
mesa: a0bf1768c7131a5d9a23c5177e7b9d7a0267ef6c (12.1.0-devel)

$ ./bin/egl-create-pbuffer-surface -auto
Segmentation fault (core dumped)

(gdb) bt
#0  __memcpy_avx_unaligned () at ../sysdeps/x86_64/multiarch/memcpy-avx-unaligned.S:238
#1  0x00007ff000483961 in memcpy (__len=262144, __src=<optimized out>, __dest=0x0) at /usr/include/x86_64-linux-gnu/bits/string3.h:53
#2  swrastGetImage (read=<optimized out>, x=<optimized out>, y=<optimized out>, w=<optimized out>, h=<optimized out>, data=0x0, 
    loaderPrivate=0x1b00a60) at drivers/dri2/platform_x11.c:179
#3  0x00007feffb11e65c in swrastSetTexBuffer2 (pDRICtx=<optimized out>, target=<optimized out>, texture_format=8410, dPriv=0x1aef960)
    at swrast.c:110
#4  0x00007ff00047feb2 in dri2_bind_tex_image (drv=0x1937c10, disp=0x19375d0, surf=0x1b00a60, buffer=12420) at drivers/dri2/egl_dri2.c:1452
#5  0x00007ff000475dff in eglBindTexImage (dpy=0x19375d0, surface=<optimized out>, buffer=12420) at main/eglapi.c:944
#6  0x00000000004024d2 in draw (state=0x7fff00df85c0) at piglit/tests/egl/egl-create-pbuffer-surface.c:64
#7  0x0000000000401d12 in event_loop (state=0x7fff00df85c0, test=0x7fff00df8650) at piglit/tests/egl/egl-util.c:158
#8  0x00000000004022ae in egl_util_run (test=0x7fff00df8650, argc=2, argv=0x7fff00df8788)
    at piglit/tests/egl/egl-util.c:299
#9  0x00000000004026b1 in main (argc=2, argv=0x7fff00df8788) at piglit/tests/egl/egl-create-pbuffer-surface.c:100
(gdb) frame 2
#2  swrastGetImage (read=<optimized out>, x=<optimized out>, y=<optimized out>, w=<optimized out>, h=<optimized out>, data=0x0, 
    loaderPrivate=0x1b00a60) at drivers/dri2/platform_x11.c:179
179	      memcpy(data, idata, bytes);
(gdb) print data
$1 = 0x0
(gdb) print idata
$2 = <optimized out>
(gdb) print bytes
$3 = 262144



9fea9d6f8e862a8b3f569d37d06d1ff69c6e18f5 is the first bad commit
commit 9fea9d6f8e862a8b3f569d37d06d1ff69c6e18f5
Author: Guillaume Charifi <guillaume.charifi@sfr.fr>
Date:   Mon Jun 20 15:27:33 2016 +0200

    egl: Fix the bad surface attributes combination checking for pbuffers. (v3)
    
    Fixes a regression induced by commit a0674ce5c41903ccd161e89abb149621bfbc40d2:
    When EGL_TEXTURE_FORMAT and EGL_TEXTURE_TARGET were both specified (and
    both != EGL_NO_TEXTURE), an error was instantly triggered, before the
    other one had even a chance to be checked, which is obviously not the
    intended behaviour.
    
    v2: Full commit hash, remove useless variables.
    v3: [chadv] Add Fixes footers.
    
    Fixes: piglit "spec/egl 1.4/eglcreatepbuffersurface and then glclear"
    Fixes: piglit "spec/egl 1.4/largest possible eglcreatepbuffersurface and then glclear"
    Signed-off-by: Guillaume Charifi <guillaume.charifi@sfr.fr>
    Reviewed-by: Frank Binns <frank.binns@imgtec.com>
    Reviewed-by: Chad Versace <chad.versace@intel.com>

:040000 040000 3c833d0cdcb72af089cc2a777d4e782db0f51646 a851d5bcedb1fe8dd95b0a173cfaacdf19ea1025 M	src
bisect run success
Comment 1 Emil Velikov 2016-11-03 17:44:23 UTC
The commit only moves the validation around. The underlying issue has been long existing and isn't caused by the commit in question.

Namely there's no buffer attached to the swrast_texture_image (swImage->Buffer) which we then crashed within the loader. A simple malloc might do it, but I'm not familiar with the classic swrast so I'm not sure how smart/stupid that is.
Comment 2 GitLab Migration User 2019-09-18 18:45:44 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/323.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.