Thursday, November 20, 2008

segfault in libselinux

#0 0x00007f471e25281d in fini_context_translations () at setrans_client.c:211
#1 0x00007f471e2452ff in __do_global_dtors_aux () from /lib/libselinux.so.1
#2 0x0000000000413c80 in ?? ()
#3 0x00007fff2c6fade0 in ?? ()
#4 0x00007f471e2540c1 in _fini () from /lib/libselinux.so.1
#5 0x00007fff2c6fade0 in ?? ()
#6 0x00007f47244ed0e4 in ?? () from /lib64/ld-linux-x86-64.so.2
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

After making some changes in my code I started getting this crash at the end of my application (during exit). No change that I made had anything to do with libselinux. I referred to this post a bit. Getting debug version of libselinux helped. But the above stack trace and the discussion in forum led me to believe this was some memory corruption that I had introduced. Running valgrind didn't help a lot.

After carefully going through all the changes, I figured out that I was now linking to the opengl library, although I hadn't enabled its use yet. When I commented it out, the crash went away. Probably the __fini__ routine of libgl was expecting some cleanup tasks from me.

No comments: