Bug 98767

Summary: [swrast] ralloc.c:84: get_header: Assertion `info->canary == CANARY' failed.
Product: Mesa Reporter: Vinson Lee <vlee>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium CC: emil.l.velikov, t_arceri
Version: gitKeywords: bisected, have-backtrace, regression
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Vinson Lee 2016-11-17 23:13:31 UTC
mesa: 0cee3fd5c73acf7e3841a7d790e3ec3031b0fe41 (master 13.1.0-devel)

1000+ piglit tests have regressed on swrast.

$ ./bin/fcc-read-after-clear blit rb -auto
fcc-read-after-clear: ralloc.c:84: get_header: Assertion `info->canary == CANARY' failed.
Aborted (core dumped)

(gdb) bt
#0  0x00007f0f4a242428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007f0f4a24402a in __GI_abort () at abort.c:89
#2  0x00007f0f4a23abd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x7f0f450e98a4 "info->canary == CANARY", file=file@entry=0x7f0f450e9891 "ralloc.c", line=line@entry=84, 
    function=function@entry=0x7f0f450e9a70 <__PRETTY_FUNCTION__.3839> "get_header") at assert.c:92
#3  0x00007f0f4a23ac82 in __GI___assert_fail (assertion=assertion@entry=0x7f0f450e98a4 "info->canary == CANARY", file=file@entry=0x7f0f450e9891 "ralloc.c", line=line@entry=84, 
    function=function@entry=0x7f0f450e9a70 <__PRETTY_FUNCTION__.3839> "get_header") at assert.c:101
#4  0x00007f0f44d88922 in get_header (ptr=<optimized out>) at ralloc.c:84
#5  0x00007f0f45019948 in get_header (ptr=<optimized out>) at ralloc.c:223
#6  ralloc_free (ptr=<optimized out>) at ralloc.c:229
#7  0x00007f0f44f94f35 in _mesa_delete_instructions (prog=prog@entry=0x24061c0, start=0, count=<optimized out>, mem_ctx=mem_ctx@entry=0x24061c0) at program/program.c:419
#8  0x00007f0f44f90ac0 in remove_instructions (prog=prog@entry=0x24061c0, removeFlags=removeFlags@entry=0x240edf0 "\001", mem_ctx=mem_ctx@entry=0x24061c0) at program/prog_optimize.c:196
#9  0x00007f0f44f90e7f in _mesa_remove_dead_code_global (prog=prog@entry=0x24061c0, mem_ctx=mem_ctx@entry=0x24061c0) at program/prog_optimize.c:329
#10 0x00007f0f44f9193d in _mesa_optimize_program (ctx=ctx@entry=0x7f0f4adb7010, program=program@entry=0x24061c0, mem_ctx=mem_ctx@entry=0x24061c0) at program/prog_optimize.c:1325
#11 0x00007f0f44f863dc in get_mesa_program (shader=<optimized out>, shader_program=0x24089f0, ctx=<optimized out>) at program/ir_to_mesa.cpp:2936
#12 _mesa_ir_link_shader (ctx=<optimized out>, prog=0x24089f0) at program/ir_to_mesa.cpp:3029
#13 0x00007f0f44f86732 in _mesa_glsl_link_shader (ctx=ctx@entry=0x7f0f4adb7010, prog=prog@entry=0x24089f0) at program/ir_to_mesa.cpp:3071
#14 0x00007f0f44e89050 in _mesa_link_program (ctx=0x7f0f4adb7010, shProg=0x24089f0) at main/shaderapi.c:1086
#15 0x00007f0f4a8ffbf2 in piglit_link_simple_program (vs=1, fs=4) at piglit/tests/util/piglit-shader.c:262
#16 0x0000000000401b3c in piglit_init (argc=3, argv=0x7fff613b3c08) at piglit/tests/fast_color_clear/read-after-clear.c:178
#17 0x00007f0f4a918dcb in run_test (gl_fw=0x222bc20, argc=3, argv=0x7fff613b3c08) at piglit/tests/util/piglit-framework-gl/piglit_fbo_framework.c:50
#18 0x00007f0f4a8fefdf in piglit_gl_test_run (argc=3, argv=0x7fff613b3c08, config=0x7fff613b3ac0) at piglit/tests/util/piglit-framework-gl.c:203
#19 0x000000000040182d in main (argc=3, argv=0x7fff613b3c08) at piglit/tests/fast_color_clear/read-after-clear.c:61

0ad69e6b51b06c483db37c3b7eeb1da1a95d0629 is the first bad commit
commit 0ad69e6b51b06c483db37c3b7eeb1da1a95d0629
Author: Timothy Arceri <timothy.arceri@collabora.com>
Date:   Sat Nov 5 22:35:41 2016 +1100

    mesa: make use of ralloc when creating ARB asm gl_program fields
    
    This will allow us to move the ARB asm fields in gl_program into
    a union as we will be able call ralloc_free() on the entire struct
    when destroying the context.
    
    In this change we switch over to using ralloc for the Instructions,
    String and LocalParams fields of gl_program.
    
    Reviewed-by: Emil Velikov <emil.velikov@collabora.com>

:040000 040000 6d741cefa8974f3c0066a58b63f83381c5567352 b6509f8164fd3dfac726b0a3761bde263471c2d0 M	src
bisect run success
Comment 1 Timothy Arceri 2016-11-18 00:53:32 UTC
I've sent a fix here:

https://patchwork.freedesktop.org/patch/122114/
Comment 2 Timothy Arceri 2016-11-18 12:41:34 UTC
Should be fixed by:

commit 88fe2c308ec0902b8f3980f9ce6ab6241ba74c14
Author: Timothy Arceri <timothy.arceri@collabora.com>
Date:   Fri Nov 18 11:51:59 2016 +1100

    mesa: fix old classic drivers to use ralloc for ARB asm programs
    
    These changes were missed in 0ad69e6b5.
    
    Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98767

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.