Bug 55219 - glibc realloc error when runing 17000-consecutive-chars-identifier piglit glslparser test
Summary: glibc realloc error when runing 17000-consecutive-chars-identifier piglit gls...
Status: RESOLVED DUPLICATE of bug 40611
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Ian Romanick
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-22 13:48 UTC by Jure Repinc
Modified: 2012-09-26 14:38 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Jure Repinc 2012-09-22 13:48:46 UTC
When I was runing piglist tests (quick) it stoped at one of the glslparser tests (window for it wouldn't close). I check with "ps aux" and the command was
glslparsertest tests/glslparsertest/glsl2/17000-consecutive-chars-identifier.frag pass 1.10


When I started this test separately from command line I got this error:
*** glibc detected *** /home/test/programming/piglit/framework/../bin/glslparsertest: realloc(): invalid next size: 0x00000000012c8b50 ***


I also run it from gdb with this output:
(gdb) run tests/glslparsertest/glsl2/17000-consecutive-chars-identifier.frag pass 1.10
Starting program: /home/test/programming/piglit/bin/glslparsertest tests/glslparsertest/glsl2/17000-consecutive-chars-identifier.frag pass 1.10
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7ffff6027700 (LWP 2362)]
*** glibc detected *** /home/test/programming/piglit/bin/glslparsertest: realloc(): invalid next size: 0x0000000000753b60 ***
p
w
^C
Program received signal SIGINT, Interrupt.
__lll_lock_wait_private () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:93
93      ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: No such file or directory.
(gdb) w
Ambiguous command "w": watch, wh, whatis, where, while, while-stepping, winheight, ws.
(gdb) where
#0  __lll_lock_wait_private () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:93
#1  0x0000003de02817fe in _L_lock_11335 () at malloc.c:5210
#2  0x0000003de027f993 in __GI___libc_malloc (bytes=265757021760) at malloc.c:2921
#3  0x0000003ddea0d092 in _dl_map_object_deps (map=map@entry=0x7ffff7856000, preloads=preloads@entry=0x0, npreloads=npreloads@entry=0, trace_mode=trace_mode@entry=0, 
    open_mode=open_mode@entry=-2147483648) at dl-deps.c:517
#4  0x0000003ddea12ca7 in dl_open_worker (a=a@entry=0x7fffffffb320) at dl-open.c:262
#5  0x0000003ddea0e969 in _dl_catch_error (objname=objname@entry=0x7fffffffb310, errstring=errstring@entry=0x7fffffffb318, mallocedp=mallocedp@entry=0x7fffffffb30f, 
    operate=operate@entry=0x3ddea12b20 <dl_open_worker>, args=args@entry=0x7fffffffb320) at dl-error.c:178
#6  0x0000003ddea126b1 in _dl_open (file=0x3de036640c "libgcc_s.so.1", mode=-2147483647, caller_dlopen=<optimized out>, nsid=-2, argc=4, argv=0x7fffffffdce8, env=0x7fffffffdd10)
    at dl-open.c:639
#7  0x0000003de03202e2 in do_dlopen (ptr=ptr@entry=0x7fffffffb550) at dl-libc.c:89
#8  0x0000003ddea0e969 in _dl_catch_error (objname=0x7fffffffb530, errstring=0x7fffffffb538, mallocedp=0x7fffffffb52f, operate=0x3de03202a0 <do_dlopen>, args=0x7fffffffb550) at dl-error.c:178
#9  0x0000003de03203af in dlerror_run (operate=operate@entry=0x3de03202a0 <do_dlopen>, args=args@entry=0x7fffffffb550) at dl-libc.c:48
#10 0x0000003de0320431 in __GI___libc_dlopen_mode (name=name@entry=0x3de036640c "libgcc_s.so.1", mode=mode@entry=-2147483647) at dl-libc.c:165
#11 0x0000003de02fb895 in init () at ../sysdeps/x86_64/../ia64/backtrace.c:53
#12 0x0000003de060e4f3 in pthread_once () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S:104
#13 0x0000003de02fb9bc in __GI___backtrace (array=array@entry=0x7fffffffb810, size=size@entry=64) at ../sysdeps/x86_64/../ia64/backtrace.c:104
#14 0x0000003de0275bef in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x3de036aa68 "*** glibc detected *** %s: %s: 0x%s ***\n") at ../sysdeps/unix/sysv/linux/libc_fatal.c:178
#15 0x0000003de027b9dd in malloc_printerr (action=3, str=0x3de0367b00 "realloc(): invalid next size", ptr=<optimized out>) at malloc.c:5007
#16 0x0000003de027e54e in _int_realloc (av=<optimized out>, oldp=0x753b50, oldsize=<optimized out>, nb=<optimized out>) at malloc.c:4323
#17 0x0000003de027ffd9 in __GI___libc_realloc (oldmem=0x753b60, bytes=17073) at malloc.c:3060
#18 0x00007ffff665b29d in resize (ptr=<optimized out>, size=17025) at ../../src/glsl/ralloc.c:145
#19 0x00007ffff665b9a8 in ralloc_vasprintf_rewrite_tail (str=0x613b88, start=0x613b98, fmt=0x7ffff7293b41 " ", args=args@entry=0x7fffffffc028) at ../../src/glsl/ralloc.c:482
#20 0x00007ffff665bac2 in ralloc_asprintf_rewrite_tail (str=<optimized out>, start=<optimized out>, fmt=<optimized out>) at ../../src/glsl/ralloc.c:460
#21 0x00007ffff67de996 in _token_list_print (list=<optimized out>, parser=0x613b40) at glcpp-parse.y:1096
#22 _glcpp_parser_print_expanded_token_list (list=<optimized out>, parser=0x613b40) at glcpp-parse.y:1708
#23 glcpp_parser_parse (parser=parser@entry=0x613b40) at glcpp-parse.y:194
#24 0x00007ffff6751596 in glcpp_preprocess (ralloc_ctx=0x6f59e0, shader=0x7fffffffda88, info_log=0x6f5ae0, extensions=<optimized out>, api=<optimized out>) at ../../../src/glsl/glcpp/pp.c:162
#25 0x00007ffff6708223 in _mesa_glsl_compile_shader (ctx=ctx@entry=0x671580, shader=shader@entry=0x6f15d0) at ../../src/mesa/program/ir_to_mesa.cpp:3064
#26 0x00007ffff66b8160 in compile_shader (ctx=0x671580, shaderObj=<optimized out>) at ../../src/mesa/main/shaderapi.c:722
#27 0x00007ffff7ada373 in stub_glCompileShader (shader=1) at /home/test/programming/piglit/tests/util/generated_dispatch.c:3113
#28 0x000000000040197c in test () at /home/test/programming/piglit/tests/glslparsertest/glslparsertest.c:163
#29 0x0000000000401f57 in piglit_init (argc=4, argv=0x7fffffffdce8) at /home/test/programming/piglit/tests/glslparsertest/glslparsertest.c:320
#30 0x00007ffff7ad1980 in piglit_gl_test_run (argc=4, argv=0x7fffffffdce8, info=0x7fffffffdbe0) at /home/test/programming/piglit/tests/util/piglit-framework.c:133
#31 0x00000000004016e1 in main (argc=4, argv=0x7fffffffdce8) at /home/test/programming/piglit/tests/glslparsertest/glslparsertest.c:38


Runing it through valgrind I get this:
$ valgrind /home/test/programming/piglit/framework/../bin/glslparsertest tests/glslparsertest/glsl2/17000-consecutive-chars-identifier.frag pass 1.10
==28218== Memcheck, a memory error detector
==28218== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==28218== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==28218== Command: /home/test/programming/piglit/framework/../bin/glslparsertest tests/glslparsertest/glsl2/17000-consecutive-chars-identifier.frag pass 1.10
==28218== 
==28218== Invalid write of size 4
==28218==    at 0x5B62370: glcpp_lex (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5B67EC3: glcpp_parser_parse (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5ADA595: glcpp_preprocess (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5A91222: _mesa_glsl_compile_shader (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5A4115F: compile_shader (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x4EFE372: stub_glCompileShader (generated_dispatch.c:3113)
==28218==    by 0x40197B: test (glslparsertest.c:163)
==28218==    by 0x401F56: piglit_init (glslparsertest.c:320)
==28218==    by 0x4EF597F: piglit_gl_test_run (piglit-framework.c:133)
==28218==    by 0x4016E0: main (glslparsertest.c:38)
==28218==  Address 0x5593f98 is 0 bytes after a block of size 65,544 alloc'd
==28218==    at 0x4A099CB: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==28218==    by 0x5B62899: glcpp_lex (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5B67EC3: glcpp_parser_parse (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5ADA595: glcpp_preprocess (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5A91222: _mesa_glsl_compile_shader (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5A4115F: compile_shader (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x4EFE372: stub_glCompileShader (generated_dispatch.c:3113)
==28218==    by 0x40197B: test (glslparsertest.c:163)
==28218==    by 0x401F56: piglit_init (glslparsertest.c:320)
==28218==    by 0x4EF597F: piglit_gl_test_run (piglit-framework.c:133)
==28218==    by 0x4016E0: main (glslparsertest.c:38)
==28218==                                                                                                                                                                                       
==28218== Invalid read of size 4                                                                                                                                                                
==28218==    at 0x5B623B2: glcpp_lex (in /usr/lib64/mesa/r600g_dri.so)                                                                                                                          
==28218==    by 0x5B67EC3: glcpp_parser_parse (in /usr/lib64/mesa/r600g_dri.so)                                                                                                                 
==28218==    by 0x5ADA595: glcpp_preprocess (in /usr/lib64/mesa/r600g_dri.so)                                                                                                                   
==28218==    by 0x5A91222: _mesa_glsl_compile_shader (in /usr/lib64/mesa/r600g_dri.so)                                                                                                          
==28218==    by 0x5A4115F: compile_shader (in /usr/lib64/mesa/r600g_dri.so)                                                                                                                     
==28218==    by 0x4EFE372: stub_glCompileShader (generated_dispatch.c:3113)
==28218==    by 0x40197B: test (glslparsertest.c:163)
==28218==    by 0x401F56: piglit_init (glslparsertest.c:320)
==28218==    by 0x4EF597F: piglit_gl_test_run (piglit-framework.c:133)
==28218==    by 0x4016E0: main (glslparsertest.c:38)
==28218==  Address 0x5594934 is 36 bytes inside a block of size 57 free'd
==28218==    at 0x4A09BDE: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==28218==    by 0x59E429C: resize (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x59E49A7: ralloc_vasprintf_rewrite_tail (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x59E4AC1: ralloc_asprintf_rewrite_tail (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5B67995: glcpp_parser_parse (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5ADA595: glcpp_preprocess (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5A91222: _mesa_glsl_compile_shader (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5A4115F: compile_shader (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x4EFE372: stub_glCompileShader (generated_dispatch.c:3113)
==28218==    by 0x40197B: test (glslparsertest.c:163)
==28218==    by 0x401F56: piglit_init (glslparsertest.c:320)
==28218==    by 0x4EF597F: piglit_gl_test_run (piglit-framework.c:133)
==28218== 
==28218== Invalid read of size 4
==28218==    at 0x5B62434: glcpp_lex (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5B67EC3: glcpp_parser_parse (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5ADA595: glcpp_preprocess (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5A91222: _mesa_glsl_compile_shader (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5A4115F: compile_shader (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x4EFE372: stub_glCompileShader (generated_dispatch.c:3113)
==28218==    by 0x40197B: test (glslparsertest.c:163)
==28218==    by 0x401F56: piglit_init (glslparsertest.c:320)
==28218==    by 0x4EF597F: piglit_gl_test_run (piglit-framework.c:133)
==28218==    by 0x4016E0: main (glslparsertest.c:38)
==28218==  Address 0x5594930 is 32 bytes inside a block of size 57 free'd
==28218==    at 0x4A09BDE: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==28218==    by 0x59E429C: resize (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x59E49A7: ralloc_vasprintf_rewrite_tail (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x59E4AC1: ralloc_asprintf_rewrite_tail (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5B67995: glcpp_parser_parse (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5ADA595: glcpp_preprocess (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5A91222: _mesa_glsl_compile_shader (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5A4115F: compile_shader (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x4EFE372: stub_glCompileShader (generated_dispatch.c:3113)
==28218==    by 0x40197B: test (glslparsertest.c:163)
==28218==    by 0x401F56: piglit_init (glslparsertest.c:320)
==28218==    by 0x4EF597F: piglit_gl_test_run (piglit-framework.c:133)
==28218== 
==28218== Invalid read of size 8
==28218==    at 0x59E4200: unsafe_free (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x59E420C: unsafe_free (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5ADA5EC: glcpp_preprocess (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5A91222: _mesa_glsl_compile_shader (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5A4115F: compile_shader (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x4EFE372: stub_glCompileShader (generated_dispatch.c:3113)
==28218==    by 0x40197B: test (glslparsertest.c:163)
==28218==    by 0x401F56: piglit_init (glslparsertest.c:320)
==28218==    by 0x4EF597F: piglit_gl_test_run (piglit-framework.c:133)
==28218==    by 0x4016E0: main (glslparsertest.c:38)
==28218==  Address 0x3700000057 is not stack'd, malloc'd or (recently) free'd
==28218== 
==28218== 
==28218== Process terminating with default action of signal 11 (SIGSEGV)
==28218==  Access not within mapped region at address 0x3700000057
==28218==    at 0x59E4200: unsafe_free (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x59E420C: unsafe_free (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5ADA5EC: glcpp_preprocess (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5A91222: _mesa_glsl_compile_shader (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x5A4115F: compile_shader (in /usr/lib64/mesa/r600g_dri.so)
==28218==    by 0x4EFE372: stub_glCompileShader (generated_dispatch.c:3113)
==28218==    by 0x40197B: test (glslparsertest.c:163)
==28218==    by 0x401F56: piglit_init (glslparsertest.c:320)
==28218==    by 0x4EF597F: piglit_gl_test_run (piglit-framework.c:133)
==28218==    by 0x4016E0: main (glslparsertest.c:38)
==28218==  If you believe this happened as a result of a stack
==28218==  overflow in your program's main thread (unlikely but
==28218==  possible), you can try to increase the size of the
==28218==  main thread stack using the --main-stacksize= flag.
==28218==  The main thread stack size used in this run was 8388608.
==28218== 
==28218== HEAP SUMMARY:
==28218==     in use at exit: 1,388,944 bytes in 1,599 blocks
==28218==   total heap usage: 2,294 allocs, 695 frees, 1,950,378 bytes allocated
==28218== 
==28218== LEAK SUMMARY:
==28218==    definitely lost: 506 bytes in 7 blocks
==28218==    indirectly lost: 0 bytes in 0 blocks
==28218==      possibly lost: 64,779 bytes in 184 blocks
==28218==    still reachable: 1,323,659 bytes in 1,408 blocks
==28218==         suppressed: 0 bytes in 0 blocks
==28218== Rerun with --leak-check=full to see details of leaked memory
==28218== 
==28218== For counts of detected and suppressed errors, rerun with: -v
==28218== ERROR SUMMARY: 483 errors from 4 contexts (suppressed: 2 from 2)
Killed
Comment 1 Ian Romanick 2012-09-26 14:38:34 UTC

*** This bug has been marked as a duplicate of bug 40611 ***


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.