[Xenomai] Assertion current-magic 0 failed

Stéphane Reichert sreichert at sepro-group.com
Wed Jul 4 15:26:56 CEST 2018


Hi Philippe,

Unfortunately, we did not disable auto-init.

Maybe the fact that rt_heap_bind is called from a shared library could be 
the problem ?

I joined the 2 executables we are using. In order to reproduce the problem, 
you have to run these commands:
./start_lib_ipc --session=rct &
./tests_integration_lib_ipc --session=rct CH1 &

The shared library lib_ipc.so contains the call to rt_heap_bind.

The compiler options for the shared library are:
...../bin/arm-linux-gnueabihf-gcc  -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGEFILE64_SOURCE 
 -D_LARGEFILE_SOURCE -D_REENTRANT -D__COBALT_WRAP__ -D__COBALT__ -D__XENO__  
-Dlib_ipc_EXPORTS -fmessage-length=0 -g -fPIC -Wall -Werror -fasynchronous-unwind-tables 
....
The linker options for the shared library are:
...... 
/bin/arm-linux-gnueabihf-gcc  -fPIC  -fmessage-length=0 -g   -shared -Wl,-soname,lib_ipc.so 
 -o lib_ipc.so CMakeFiles/lib_ipc.dir/SRC/messages.c.o 
CMakeFiles/lib_ipc.dir/SRC/shared_memory.c.o 
CMakeFiles/lib_ipc.dir/SRC/fifoplus.c.o 
MakeFiles/lib_ipc.dir/SRC/init.c.o  -L/home2/sreichert/workspace/lib_ipc/.   
-L/home2/sreichert/workspace/lib_ipc/../robot/lib  -L/opt/toolchain/arm-linux-gnueabihf/usr/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/xenomai 
 -lm -lalchemy -lcopperplate -lcobalt -lmodechk -lpthread -lrt 
/opt/toolchain/arm-linux-gnueabihf/usr/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/xenomai/bootstrap-pic.o 
 -Wl,-rpath,/home2/sreichert/workspace/lib_ipc/.:/home2/sreichert/workspace/lib_ipc/../robot/lib:/opt/toolchain/arm-linux-gnueabihf/usr/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/xenomaiThe compiler options for the executables are:...../bin/arm-linux-gnueabihf-gcc  -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_REENTRANT -D__COBALT_WRAP__ -D__COBALT__ -D__XENO__ -g -Wall -Werror -fasynchronous-unwind-tables ....The linker options for the executables are:...../bin/arm-linux-gnueabihf-gcc  -gCMakeFiles/tests_integration_lib_ipc.dir/SRC/test_lib_ipc.c.oCMakeFiles/tests_integration_lib_ipc.dir/SRC/sighandler.c.oCMakeFiles/tests_integration_lib_ipc.dir/SRC/test_fifo.c.oCMakeFiles/tests_integration_lib_ipc.dir/SRC/test_shared_memory.c.o  -otests_integration_lib_ipc  -L/home2/sreichert/workspace/tests_integration_lib_ipc/.  -L/home2/sreichert/workspace/tests_integration_lib_ipc/../robot/lib  -L/opt/toolchain/arm-linux-gnueabihf/usr/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/xenomai -rdynamic -l_ipc -lm -lfuse -lalchemy -lcopperplate -lcobalt -lmodechk -lpthread -lrt -Wl,--wrap=main,@/opt/toolchain/arm-linux-gnueabihf/usr/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/cobalt.wrappers/opt/toolchain/arm-linux-gnueabihf/usr/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/xenomai/bootstrap.o -Wl,-rpath,/home2/sreichert/workspace/tests_integration_lib_ipc/.:/home2/sreichert/workspace/tests_integration_lib_ipc/../robot/lib:/opt/toolchain/arm-linux-gnueabihf/usr/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/xenomaiI did another try and this time the pc was stuck oninclude/linux/signal.h:79This line is :   return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));I hope this could help.Best regardsStéphane-----Message d'origine-----De : Philippe Gerum [mailto:rpm at xenomai.org]Envoyé : mercredi 4 juillet 2018 11:30À : Stéphane Reichert; xenomai at xenomai.orgObjet : Re: [Xenomai] Assertion current-magic 0 failedOn 07/04/2018 09:54 AM, Stéphane Reichert wrote:> Hi Philippe:>> Thanks for your answer. In fact, the assertion occurs when I call> these two statements at the end of sigdebug_handler:>    signal (sig, SIG_DFL);>    kill (getpid(), sig);>> You can find below the answers you asked for:>> Backtrace reported by the debugger:> ------------------------------------------------> Mode switch (reason: triggered fault), aborting. Backtrace:The mode switch is due to a memory access fault, and looking at theimplementation of rt_heap_bind(), the only reason for this to happen in suchsituation would be that alchemy_init() did not run prior to callingrt_heap_bind().In other words, I suspect that auto-init was disabled via xeno-config, butxenomai_init() was not yet called when rt_heap_bind() is issued.Would that be a plausible scenario?> /root/tests_integration_lib_ipc(sigdebug_handler+0x120)[0x12200]> /lib/libc.so.6(+0x25150)[0x76d56150]> /lib/libcopperplate.so.0(syncobj_lock+0x84)[0x76ecd7e8]> /lib/libcopperplate.so.0(syncluster_findobj+0x34)[0x76ecbeec]> /lib/libalchemy.so.0(alchemy_bind_object+0x98)[0x76ef11c0]> /lib/libalchemy.so.0(rt_heap_bind+0x30)[0x76ef41c4]> /root/libs/lib_ipc.so(init_local_data+0x60)[0x76fc385c]> /root/libs/lib_ipc.so(rt_shm_open+0x70)[0x76fc3bfc]> /root/tests_integration_lib_ipc[0x12d08]> /lib/libalchemy.so.0(+0xa448)[0x76ef6448]> /lib/libcopperplate.so.0(+0x8314)[0x76ecd314]> /lib/libcobalt.so.2(+0x1058c)[0x76ea858c]>> tests_integration_lib_ipc: threadobj.c:1344: threadobj_prologue:> Assertion `current->magic == 0' failed.>> This log is displayed in the sigdebug_handler when I call rt_heap_bind> (switch into secondary mode).>> Kernel Panic:> -----------------> . We have adapted the ipipe-core-patch-4.1.18 -arm-10.patch to our> kernel (4.1.46).> . The kernel is compiled with these options for xenomai : full-debug,> registry on, relax traces on.> . The problem occurs when we call the kill at the end of the> sigdebug_handler (same function as in the "Finding spurious relaxes"> example).> . The result of the addr2line gives me :> ..../kernel/xenomai/posix/signal.c:75> This line code is (line 75 - function cobalt_signal_deliver):>     if (sigismember(swc->set, sig))>That kernel panic has to be fixed, however I have not been able to reproduceit yet. If you could either send me a basic test code triggering the issue,or the executable causing the fault (no source needed), that would help.--Philippe.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: start_lib_ipc
Type: application/octet-stream
Size: 14712 bytes
Desc: not available
URL: <http://xenomai.org/pipermail/xenomai/attachments/20180704/bf6c01f7/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tests_integration_lib_ipc
Type: application/octet-stream
Size: 50588 bytes
Desc: not available
URL: <http://xenomai.org/pipermail/xenomai/attachments/20180704/bf6c01f7/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lib_ipc.so
Type: application/octet-stream
Size: 62708 bytes
Desc: not available
URL: <http://xenomai.org/pipermail/xenomai/attachments/20180704/bf6c01f7/attachment.so>


More information about the Xenomai mailing list