Closed bekker closed 7 years ago
Oh I forgot to mention. I'm using Poin2 Chromebook 11, with ubuntu crouton. xfce4 for desktop and x11 is hw-accelerated with armsoc driver.
Can you try with the export LIBGL_FB=1
(lunixbochs version automaticaly use this).
If that's not enough, a gdb backtrace would be helpfull.
Tried LIBGL_FB
with no luck. Here's the stack trace.
Thread 1 "glxinfo" received signal SIGSEGV, Segmentation fault.
strlen () at ../sysdeps/arm/armv6t2/strlen.S:146
146 ../sysdeps/arm/armv6t2/strlen.S: No such file or directory.
(gdb) bt
#0 strlen () at ../sysdeps/arm/armv6t2/strlen.S:146
#1 0x00012e2a in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
And when I run blender
without LIBGL_FB=1
, it first opens without any font, then after 3 seconds talks about some 'stack smashing'.
*** stack smashing detected ***: blender terminated
[1] 12710 abort (core dumped) LD_LIBRARY_PATH=/usr/lib/gl4es blender
That mean I call strlen with a bad pointer.
That backtrace doesn't help much.
Be sure to compile gl4es with debug info (easy way is to use ccmake
and choose RelWithDebInfo
as build type).
Also, you can uncomment this line: https://github.com/ptitSeb/gl4es/blob/master/src/glx/glx.c#L34 to get manu debug info in the glX part, were I assume the crash occurs.
The only strlen
call in glxinfo.c
was strlen(DisplayString(dpy))
. I compiled glxinfo.c
myself for debugging, and surprisingly, it worked well. The glxinfo.c
source seems identitcal.
And then I compiled gl4es
with RelWithDebInfo
, by adding set(CMAKE_BUILD_TYPE "RelWithDebInfo")
in CMakeLists.txt
. Same segfault and backtrace, no additional info.
When I uncommented the debug line, fcntl.h
started raising some weird errors, so I had to remove the optimization pragma right under it. And then, surprisingly, everything works perfectly just by turning the DBG
macro on. :(
I have no idea what's happening.
Maybe I'll try deleting DBG macro lines one by one.
maybe valgrind
can help here.
$ LD_LIBRARY_PATH=/usr/lib/gl4es valgrind glxinfo
==13057== Memcheck, a memory error detector
==13057== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==13057== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==13057== Command: glxinfo
==13057==
LIBGL: Initialising gl4es
LIBGL: v1.0.2 built on Nov 2 2017 17:56:05
LIBGL: Using GLES 1.1 backend
LIBGL:loaded: libGLESv1_CM.so
LIBGL:loaded: libEGL.so
LIBGL: Using GLES 1.1 backend
==13057== Syscall param ioctl(generic) points to uninitialised byte(s)
==13057== at 0x4AADDA6: ioctl (syscall-template.S:84)
==13057== by 0x5292619: uku_open (in /usr/lib/mali/libmali.so)
==13057== Address 0xbd867a3c is on thread 1's stack
==13057==
==13057== Syscall param ioctl(generic) points to uninitialised byte(s)
==13057== at 0x4AADDA6: ioctl (syscall-template.S:84)
==13057== by 0x529275D: uku_call (in /usr/lib/mali/libmali.so)
==13057== Address 0xbd867aec is on thread 1's stack
==13057==
==13057== Invalid write of size 4
==13057== at 0x4845DE8: memset (vg_replace_strmem.c:1224)
==13057== by 0x5256E41: cframep_shared_pmem_init (in /usr/lib/mali/libmali.so)
==13057== Address 0xac317000 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Thread 9 mali-hist-dump:
==13057== Conditional jump or move depends on uninitialised value(s)
==13057== at 0x4BA72FE: __udivmoddi4 (in /lib/arm-linux-gnueabihf/libgcc_s.so.1)
==13057==
==13057== Use of uninitialised value of size 4
==13057== at 0x4BA7300: __udivmoddi4 (in /lib/arm-linux-gnueabihf/libgcc_s.so.1)
==13057==
==13057== Use of uninitialised value of size 4
==13057== at 0x4BA5BF4: ??? (in /lib/arm-linux-gnueabihf/libgcc_s.so.1)
==13057==
==13057== Invalid write of size 4
==13057== at 0x4BA5BE8: ??? (in /lib/arm-linux-gnueabihf/libgcc_s.so.1)
==13057== Address 0xa20acf0 is on thread 9's stack
==13057== 16 bytes below stack pointer
==13057==
==13057== Thread 1:
==13057== Invalid write of size 4
==13057== at 0x4845DE8: memset (vg_replace_strmem.c:1224)
==13057== by 0x52A50E1: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d7000 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid read of size 4
==13057== at 0x52A50E8: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d7008 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid write of size 4
==13057== at 0x52A50F4: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d7008 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid read of size 2
==13057== at 0x52A5114: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d7010 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid write of size 2
==13057== at 0x52A511E: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d7010 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid write of size 4
==13057== at 0x52A5158: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d7008 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid write of size 4
==13057== at 0x52A5174: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d7008 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid write of size 4
==13057== at 0x52A5186: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d7008 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid write of size 2
==13057== at 0x52A51D2: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d7010 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid write of size 2
==13057== at 0x52A51F8: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d7010 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid write of size 2
==13057== at 0x52A521E: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d7010 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid write of size 2
==13057== at 0x52A5244: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d7010 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid read of size 2
==13057== at 0x52A5246: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d700c is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid read of size 2
==13057== at 0x52A524E: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d700e is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid write of size 2
==13057== at 0x52A5258: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d700c is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid write of size 2
==13057== at 0x52A5266: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d700e is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid read of size 2
==13057== at 0x52A5272: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d7002 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid write of size 4
==13057== at 0x52A527E: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d7000 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid write of size 4
==13057== at 0x52A528A: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d7000 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid write of size 2
==13057== at 0x52A5290: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d7004 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid write of size 2
==13057== at 0x52A52A4: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d7006 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid read of size 2
==13057== at 0x52A5388: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d7042 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid write of size 4
==13057== at 0x52A5392: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d7040 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid write of size 2
==13057== at 0x52A5398: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d7044 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid write of size 4
==13057== at 0x52A53A0: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d7040 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid write of size 2
==13057== at 0x52A53AA: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d70c4 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid write of size 4
==13057== at 0x52A53AE: cobjp_image_template_generate_descriptor (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2d70c0 is not stack'd, malloc'd or (recently) free'd
==13057==
disInstr(thumb): unhandled instruction: 0xDEFF 0x682B
LIBGL: Extension GL_OES_blend_subtract detected and used
LIBGL: Extension GL_OES_blend_func_separate detected and used
LIBGL: Extension GL_OES_blend_equation_separate detected and used
LIBGL: Extension GL_EXT_blend_minmax detected and used
LIBGL: Extension GL_OES_framebuffer_object detected and used
LIBGL: Extension GL_OES_point_sprite detected and used
LIBGL: Extension GL_OES_point_size_array detected
LIBGL: Extension GL_OES_element_index_uint detected
LIBGL: Extension GL_OES_packed_depth_stencil detected and used
LIBGL: Extension GL_OES_depth24 detected and used
LIBGL: Extension GL_OES_rgb8_rgba8 detected and used
LIBGL: Extension GL_EXT_texture_format_BGRA8888 detected and used
LIBGL: Extension GL_OES_texture_cube_map detected and used
LIBGL: Extension GL_OES_draw_texture detected and used
LIBGL: Max texture size: 8192
LIBGL: Texture Units: 8(8), Max lights: 8, Max planes: 1
LIBGL: Implementation Read is GL_RGBA/GL_UNSIGNED_BYTE
LIBGL: sRGB surface supported
==13057== Invalid write of size 4
==13057== at 0x4845DE8: memset (vg_replace_strmem.c:1224)
==13057== by 0x525E4C5: cframep_manager_reset (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2cf000 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057== Invalid write of size 4
==13057== at 0x4845DE8: memset (vg_replace_strmem.c:1224)
==13057== by 0x525E629: cframep_manager_reset (in /usr/lib/mali/libmali.so)
==13057== Address 0xac2cf000 is not stack'd, malloc'd or (recently) free'd
==13057==
LIBGL: Targeting OpenGL 1.5
LIBGL: Current folder is:/home/north/project/gl4es/lib
name of display: :1.0
glXGetProcAddress: glGetProgramivARB not found.
glX stub: glGetStringi
glXGetProcAddress: glGetConvolutionParameteriv not found.
==13057== Conditional jump or move depends on uninitialised value(s)
==13057== at 0x12E18: ??? (in /usr/bin/glxinfo)
==13057==
==13057== Invalid read of size 1
==13057== at 0x4842110: strlen (vg_replace_strmem.c:454)
==13057== by 0x12E29: ??? (in /usr/bin/glxinfo)
==13057== Address 0x1f03 is not stack'd, malloc'd or (recently) free'd
==13057==
==13057==
==13057== Process terminating with default action of signal 11 (SIGSEGV)
==13057== Access not within mapped region at address 0x1F03
==13057== at 0x4842110: strlen (vg_replace_strmem.c:454)
==13057== by 0x12E29: ??? (in /usr/bin/glxinfo)
==13057== If you believe this happened as a result of a stack
==13057== overflow in your program's main thread (unlikely but
==13057== possible), you can try to increase the size of the
==13057== main thread stack using the --main-stacksize= flag.
==13057== The main thread stack size used in this run was 8388608.
==13057==
==13057== HEAP SUMMARY:
==13057== in use at exit: 3,295,291 bytes in 1,669 blocks
==13057== total heap usage: 2,272 allocs, 603 frees, 3,903,793 bytes allocated
==13057==
==13057== LEAK SUMMARY:
==13057== definitely lost: 4 bytes in 1 blocks
==13057== indirectly lost: 0 bytes in 0 blocks
==13057== possibly lost: 1,726,660 bytes in 479 blocks
==13057== still reachable: 1,568,627 bytes in 1,189 blocks
==13057== of which reachable via heuristic:
==13057== stdstring : 13,580 bytes in 599 blocks
==13057== newarray : 13,884 bytes in 243 blocks
==13057== suppressed: 0 bytes in 0 blocks
==13057== Rerun with --leak-check=full to see details of leaked memory
==13057==
==13057== For counts of detected and suppressed errors, rerun with: -v
==13057== Use --track-origins=yes to see where uninitialised values come from
==13057== ERROR SUMMARY: 15965 errors from 38 contexts (suppressed: 115 from 15)
So I guess the mali driver does some nasty things on the stack, and gl4es gets a wrong pointer from it. That's why it worked when I added the macro, it somehow rearranged the stack so that it doesn't segfault, but still runs with a strange behavior.
I found out that it also writes at invalid location even on es2_info
, so much invalid writes/reads but luckily within the segmentation.
I don't know whether this is a normal behavior. Maybe the driver is evil, or maybe I set up something wrong. I'll look into the X.org driver configs.
Thanks for the help.
Ok.
(For testing purpose, you can also try LIBGL_FB=3 and also the ES2 backend with LIBGL_ES=2 , that may be is more stable?).
Also, don't forget that valgrind doesn't have access to kernel protected memory, but the Mali driver probably does. So some invalid access or unitialize warning are maybe false alarm because of that.
es2_info
andes2gears
work well, but I can't getglxinfo
working. Original lunixbochs/glshim branch worked well, but I'm going for OpenGL 2.0.I compiled
gl4es
using ODROID option.But
glxinfo
dies.Libraries are properly linked. (
glshim/libGL.so.1
isgl4es
)glxgears
does not segfault, but with only black screenWhen I try to launch other few programs, they segfault. lunixbochs/glshim branch did not segfault, but with an assertion error.
Any ideas??