Re: [Mesa-dev] Double free error on etnaviv driver.
Hi, Lucas! Yes, it works. So, it's not a Mesa problem, it's buildroot problem. Thanks, Sergey. 18.01.2019, 18:26, "Lucas Stach" : > Hi Sergey, > > I've just been made aware of a peculiarity of the buildroot toolchain > configuration, which might well explain why you are seeing the obvious > crash, but no one else is complaining about this. > > Can you try if [1] also solves this issue for you? If it does, I think > we should not try to work around this in Mesa. > > Regards, > Lucas > > [1] http://lists.busybox.net/pipermail/buildroot/2018-November/235923.html ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] Double free error on etnaviv driver.
Hi Sergey, Am Donnerstag, den 17.01.2019, 18:14 +0300 schrieb Nazarov Sergey: > Hi, Lucas! > Here is result of execution standard Qt5 example application mainwindow > built under custom buildroot with gcc-4.9.4, mesa3d-17.3.6. > But we had the same error with latest buildroot and latest supported mesa and > gcc. > --- > # ./mainwindow > QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to > '/root/.tmp/runtime-root' > Failed to move cursor on screen LVDS1: -14 > *** Error in `./mainwindow': double free or corruption (fasttop): 0x021295b8 > *** > Aborted > --- > Some from valgrind output: > ==1473== Invalid free() / delete / delete[] / realloc() > ==1473==at 0x48469F8: free (vg_replace_malloc.c:530) > ==1473==by 0x825C61B: _mesa_glsl_release_builtin_functions() (in > /usr/lib/dri/imx-drm_dri.so) > ==1473==by 0x8286113: _mesa_destroy_shader_compiler (in > /usr/lib/dri/imx-drm_dri.so) > ==1473==by 0x808F073: one_time_fini (in /usr/lib/dri/imx-drm_dri.so) > ==1473== Address 0x96f4ee8 is 0 bytes inside a block of size 24 free'd > ==1473==at 0x48469F8: free (vg_replace_malloc.c:530) > ==1473==by 0x4015CF7: _dl_close_worker (in /lib/ld-2.23.so) > ==1473== Block was alloc'd at > ==1473==at 0x48454B0: malloc (vg_replace_malloc.c:299) > ==1473==by 0x829EA7F: ralloc_size (in /usr/lib/dri/imx-drm_dri.so) I've just been made aware of a peculiarity of the buildroot toolchain configuration, which might well explain why you are seeing the obvious crash, but no one else is complaining about this. Can you try if [1] also solves this issue for you? If it does, I think we should not try to work around this in Mesa. Regards, Lucas [1] http://lists.busybox.net/pipermail/buildroot/2018-November/235923.html ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] Double free error on etnaviv driver.
Hi, Lucas! Here is result of execution standard Qt5 example application mainwindow built under custom buildroot with gcc-4.9.4, mesa3d-17.3.6. But we had the same error with latest buildroot and latest supported mesa and gcc. --- # ./mainwindow QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/root/.tmp/runtime-root' Failed to move cursor on screen LVDS1: -14 *** Error in `./mainwindow': double free or corruption (fasttop): 0x021295b8 *** Aborted --- Some from valgrind output: ==1473== Invalid free() / delete / delete[] / realloc() ==1473==at 0x48469F8: free (vg_replace_malloc.c:530) ==1473==by 0x825C61B: _mesa_glsl_release_builtin_functions() (in /usr/lib/dri/imx-drm_dri.so) ==1473==by 0x8286113: _mesa_destroy_shader_compiler (in /usr/lib/dri/imx-drm_dri.so) ==1473==by 0x808F073: one_time_fini (in /usr/lib/dri/imx-drm_dri.so) ==1473== Address 0x96f4ee8 is 0 bytes inside a block of size 24 free'd ==1473==at 0x48469F8: free (vg_replace_malloc.c:530) ==1473==by 0x4015CF7: _dl_close_worker (in /lib/ld-2.23.so) ==1473== Block was alloc'd at ==1473==at 0x48454B0: malloc (vg_replace_malloc.c:299) ==1473==by 0x829EA7F: ralloc_size (in /usr/lib/dri/imx-drm_dri.so) Regards, Sergey. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] Double free error on etnaviv driver.
Hi Sergey, Am Mittwoch, den 16.01.2019, 13:34 +0300 schrieb Nazarov Sergey: > Hello! > I use mesa+etnaviv Gallium driver on iMX6Q based board. > I have double free error at the end of any application using mesa. > I've found that the problem comes from current ARM g++ compilers > (at least from 4.9.4 up to latest ones) which call static objects destructors > before > on_exit handler. So, static builtin_builder builtins destructor frees > dynamically allocated > internal members memory before call of _mesa_glsl_release_builtin_functions(), > which do that again. Here is a patch to fix the problem: Do you have a reproducer for this issue? I haven't experienced any memory corruption issues with etnaviv in a long time. Also this being shared code, it should also happen on other ARM drivers too. I gave some applications a quick run under valgrind, which didn't turn up anything bad immediately, so I would be interested in a way to clearly demonstrate the issue. Regards, Lucas > > --- a/src/compiler/glsl/builtin_functions.cpp > +++ b/src/compiler/glsl/builtin_functions.cpp > @@ -6268,7 +6268,7 @@ builtin_builder::_vote(const char *intri > > /**/ > > /* The singleton instance of builtin_builder. */ > -static builtin_builder builtins; > +static builtin_builder *builtins = NULL; > static mtx_t builtins_lock = _MTX_INITIALIZER_NP; > > /** > @@ -6279,7 +6279,9 @@ void > _mesa_glsl_initialize_builtin_functions() > { > mtx_lock(_lock); > - builtins.initialize(); > + if (!builtins) > + builtins = new builtin_builder; > + builtins->initialize(); > mtx_unlock(_lock); > } > > @@ -6287,7 +6289,9 @@ void > _mesa_glsl_release_builtin_functions() > { > mtx_lock(_lock); > - builtins.release(); > + builtins->release(); > + delete builtins; > + builtins = NULL; > mtx_unlock(_lock); > } > > @@ -6297,7 +6301,7 @@ _mesa_glsl_find_builtin_function(_mesa_g > { > ir_function_signature *s; > mtx_lock(_lock); > - s = builtins.find(state, name, actual_parameters); > + s = builtins->find(state, name, actual_parameters); > mtx_unlock(_lock); > > return s; > @@ -6309,7 +6313,7 @@ _mesa_glsl_has_builtin_function(_mesa_gl > ir_function *f; > bool ret = false; > mtx_lock(_lock); > - f = builtins.shader->symbols->get_function(name); > + f = builtins->shader->symbols->get_function(name); > if (f != NULL) { > foreach_in_list(ir_function_signature, sig, >signatures) { > if (sig->is_builtin_available(state)) { > @@ -6326,7 +6330,7 @@ _mesa_glsl_has_builtin_function(_mesa_gl > gl_shader * > _mesa_glsl_get_builtin_function_shader() > { > - return builtins.shader; > + return builtins ? builtins->shader : NULL; > } > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev