Bug 111009 - Segmentation fault when running shader on Intel Mesa
Summary: Segmentation fault when running shader on Intel Mesa
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Intel 3D Bugs Mailing List
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-26 22:58 UTC by jiradet.jd
Modified: 2019-08-02 07:10 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
The shader containing code that produces an error and the stack trace by catchsegv. (4.33 KB, application/zip)
2019-06-26 22:58 UTC, jiradet.jd
Details

Description jiradet.jd 2019-06-26 22:58:54 UTC
Created attachment 144650 [details]
The shader containing code that produces an error and the stack trace by catchsegv.

I ran a piglit shader test with the following fragment shader which should render the red solid color image. However, I got an error: Segmentation fault (core dumped). The attachment are the shader and the log obtained when running shader runner with catchsegv tool (by using command “catchsegv ./bin/shader_runner_gles3 shaders/sample.shader_test”).

void main()
{
 for(
     int _injected_loop_counter = 0;
     1 != int((injectionSwitch.y));
     1
 )
  {
   if(gl_FragCoord.y < 0.0)
    {
     return;
    }
  }
 do
  {
   _GLF_color = vec4(1.0, 0.0, 0.0, 1.0);
   if(gl_FragCoord.x < 0.0)
    {
     discard;
    }
  }
 while(0.0 > injectionSwitch.y);
}

[test]
uniform vec2 injectionSwitch 0.0 1.0
draw rect -1 -1 2 2


Steps to reproduce:
-------------------------------------------------------------------------------
1. Obtain and build piglit, the Mesa OpenGL test suite runner: https://gitlab.freedesktop.org/mesa/piglit
2. Download the attached archive.
3. From a terminal, execute the supplied tests with the piglit GLES3 shader runner: 
$ bin/shader_runner_gles3 result.shader_test


Build & PC specs:
-------------------------------------------------------------------------------
CPU: Intel Core i7-2860QM
GPU: Intel Sandybridge Mobile

OS: Ubuntu 18.04.2 LTS
libdrm: git-46cb2aa1ede16380df2d965ca125d855c4278823 (most recent as of this writing)
Mesa: git-d19fe5e67a3945582448748c72b10fd5029d2ed5 (most recent as of this writing)
Linux kernel version: 4.18.0-20-generic

This bug was found with GraphicsFuzz: https://github.com/google/graphicsfuzz
Comment 1 Paul 2019-06-27 08:37:37 UTC
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/pavel/mesa_versions_64/19.1.0/lib/x86_64-linux-gnu
export LIBGL_DRIVERS_PATH="/home/pavel/mesa_versions_64/19.1.0/lib/x86_64-linux-gnu/dri"

Hi Jiradet
I've also reproduced the issue on my KBL (Intel® UHD Graphics 620) on Ubuntu 18.04 and 5.1.2 version of Kernel.
Also, I've checked that the issue isn't actual on 18.3.5 version of the mesa and I bisected the issue:

 9dcf90d7ba966cba904266209087a87ea9c018b9 is the first bad commit
commit 9dcf90d7ba966cba904266209087a87ea9c018b9
Author: Kenneth Graunke <kenneth@whitecape.org>
Date: Wed Apr 3 14:24:31 2019 -0700

intel/fs: Don't emit empty ELSE blocks.

While we can clean this up later, it's trivial to not generate the
stupid code in the first place, which saves some optimization work.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>

:040000 040000 6b7fc44def2bb5b72b9470ed3fea74d276c9845f 23d3807532dd2c5c3316807a11996e77bab207f4 M	src
Comment 2 Sergii Romantsov 2019-07-02 09:32:34 UTC
will try to look on that
Comment 4 Paul 2019-07-31 12:42:03 UTC
Hi all
I've tested the issue and it was fixed by this patch - https://patchwork.freedesktop.org/patch/319488/
My configuration is KBL (Intel® UHD Graphics 620) on Ubuntu 18.04, kernel 4.18, patch was applied to the latest master version of the mesa.
Comment 5 Paul 2019-08-01 07:04:10 UTC
Since the patch hasn't merged to the master for now - I reopen the issue until patch merges.
Comment 6 Mark Janes 2019-08-01 16:25:40 UTC
My mistake, I saw that the merge request was closed, and thought it had been merged.

Paul, can you try Curro's new patch?

https://lists.freedesktop.org/archives/mesa-dev/2019-July/221634.html
Comment 7 Francisco Jerez 2019-08-02 00:01:03 UTC
Should be fixed in master now.  Closing.
Comment 8 Paul 2019-08-02 07:10:07 UTC
I've checked the issue on current master version - fixed.


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.