On 06.11.19 15:23, [email protected] wrote:
>> On 06.11.19 14:40, [email protected] wrote:
>>>> On 06.11.19 10:18, Davy via Xenomai wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> Thanks for patching the shared sessions. It works.
>>>>>
>>>>> Now I have another segmentation error that appears when a task ends or
>>>>> is
>>>>> deleted :
>>>>>
>>>>>
>>>>>
>>>>> RT_TASK task;
>>>>> void foo(){
>>>>> int i = 3;
>>>>> while(i--){
>>>>> printf("Hello !\n");
>>>>> rt_task_sleep(1000000000);
>>>>> }
>>>>> return;
>>>>> }
>>>>> int main(int argc, char *argv[]){
>>>>> int n;
>>>>> if (mlockall( MCL_CURRENT | MCL_FUTURE )!=0)
>>>>> return 1;
>>>>> if ((n=rt_task_spawn( &task, NULL, 0, 99, T_JOINABLE, &foo,
>>>>> NULL))!=0){
>>>>> rt_printf("rt_task_spawn error %d\n",n);
>>>>> return 1;
>>>>> }
>>>>> printf("Join task\n");
>>>>> rt_task_join(&task);
>>>>> return EXIT_SUCCESS;
>>>>> }
>>>>>
>>>>>
>>>>> $ sudo ./foo
>>>>> Hello !
>>>>> Join task
>>>>> Hello !
>>>>> Hello !
>>>>> Erreur de segmentation
>>>>>
>>>>
>>>> Works find here. Could you use a debugger to find out where the
>>>> exception is thrown?
>>>>
>>>
>>> I obtain this :
>>>
>>> (gdb) run
>>> Starting program: /home/davy/Documents/Programmes_Test/test/foo
>>> [Thread debugging using libthread_db enabled]
>>> Using host libthread_db library
>>> "/lib/x86_64-linux-gnu/libthread_db.so.1".
>>> [New Thread 0x7ffff6db1700 (LWP 14620)]
>>> [New Thread 0x7ffff7ff6700 (LWP 14621)]
>>> Hello !
>>> Join task
>>> 0"025.863| WARNING: [main] Xenomai compiled with full debug enabled,
>>> very high latencies expected
>>> [--enable-debug=full]
>>> Hello !
>>> Hello !
>>>
>>> Thread 3 "task@1[14616]" received signal SIGSEGV, Segmentation fault.
>>> [Switching to Thread 0x7ffff7ff6700 (LWP 14621)]
>>> 0x00007ffff7799cf5 in shavlh_link (avl=0x7ffff7e47148, holder=0x0,
>>> dir=0)
>>> at ../../include/boilerplate/avl-inner.h:107
>>> 107 ptrdiff_t offset = holder->link[avl_type2index(dir)].offset;
>>>
>>
>> Backtrace? Values of the vars in question?
>
> (gdb) backtrace
> #0 0x00007ffff7799cf5 in shavlh_link (avl=0x7ffff7e47148, holder=0x0,
> dir=0) at ../../include/boilerplate/avl-inner.h:107
> #1 0x00007ffff7799fa7 in shavl_inorder (avl=0x7ffff7e47148, holder=0x0,
> dir=1) at avl.c:55
> #2 0x00007ffff79b89a5 in shavl_next (avl=0x7ffff7e47148,
> holder=0x7ffff7e4d1c8) at ../../include/boilerplate/avl-inner.h:332
> #3 0x00007ffff79b8fe5 in find_next_neighbour (ext=0x7ffff7e47128,
> r=0x7ffff7e4d1c8) at heapobj-pshared.c:276
> #4 0x00007ffff79b90e0 in release_page_range (ext=0x7ffff7e47128,
> page=0x7ffff7f425c8, size=1024) at heapobj-pshared.c:303
> #5 0x00007ffff79b9f84 in sheapmem_free (heap=0x7ffff7e46000,
> block=0x7ffff7f425c8) at heapobj-pshared.c:594
> #6 0x00007ffff79bbb40 in xnfree (ptr=0x7ffff7f425c8) at
> heapobj-pshared.c:1203
> #7 0x00007ffff79b46a5 in __threadobj_free (p=0x7ffff7f425c8) at
> ../../include/copperplate/threadobj.h:312
> #8 0x00007ffff79b46d4 in threadobj_free (thobj=0x7ffff7f426d0) at
> ../../include/copperplate/threadobj.h:317
> #9 0x00007ffff79b64d4 in finalize_thread (p=0x7ffff7f426d0) at
> threadobj.c:1548
> #10 0x00007ffff735f5f9 in __nptl_deallocate_tsd () at pthread_create.c:291
> #11 0x00007ffff7360658 in __nptl_deallocate_tsd () at pthread_create.c:449
> #12 start_thread (arg=0x7ffff7ff6700) at pthread_create.c:469
> #13 0x00007ffff6e9ad0f in clone () at
> ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
>
>>
>> How did you configure Xenomai userspace (beyond --enable-debug=full)?
>
> $ /usr/xenomai/bin/xeno-config --info
> Xenomai version: Xenomai/cobalt v3.1-rc3
> Linux XportNew 4.19.75-xenomai-3.1-rc3 #3 SMP PREEMPT Wed Nov 6 13:48:28
> CET 2019 x86_64 GNU/Linux
> Kernel parameters: BOOT_IMAGE=/boot/vmlinuz-4.19.75-xenomai-3.1-rc3
> root=/dev/mapper/isw_bdaaiafbje_Volume11 ro dmraid=true quiet splash nopat
> crashkernel=384M-:128M
> I-pipe release #7 detected
> Cobalt core 3.1-rc3 detected
> Compiler: gcc version 4.9.2 (Debian 4.9.2-10+deb8u1)
> Build args: --with-core=cobalt --enable-smp --enable-pshared
> --enable-debug=full
>
This is resolving the crash:
diff --git a/lib/boilerplate/avl.c b/lib/boilerplate/avl.c
index 3bf9bf1345..c13ec8a940 100644
--- a/lib/boilerplate/avl.c
+++ b/lib/boilerplate/avl.c
@@ -53,7 +53,7 @@ struct __AVL_T (avlh) * __AVL(inorder)(const struct
__AVL_T(avl) * const avl,
} else {
for (;;) {
next = __AVLH(up)(avl, holder);
- if (next == __AVL(anchor)(avl))
+ if (!next || next == __AVL(anchor)(avl))
return NULL;
if (holder->type != dir)
break;
But I don't feel like we have a stable setup since 1a79c31c9f8. There
could very well be further cases that now break under the new NULL
return value.
Philippe, please double check all affected code paths.
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux