All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] rt_task_delete segfault in libnative.so.3.0.0
@ 2009-03-31 18:53 Adam Bennett
  2009-04-01  8:44 ` Philippe Gerum
  0 siblings, 1 reply; 8+ messages in thread
From: Adam Bennett @ 2009-03-31 18:53 UTC (permalink / raw)
  To: xenomai

I'm running xenomai-head, linux-2.6.28.9, with uclibc-0.9.30.1.

I have to run configure with --build=i586-gentoo-linux-uclibc
--without-__thread.

The problem I'm seeing is a segfault whenever calling rt_task_delete.
This even occurs with the example program trivial-periodic.

I have debug enabled in the kernel, but nothing interesting appears in syslog.

Any thoughts?

Adam


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Xenomai-core] rt_task_delete segfault in libnative.so.3.0.0
  2009-03-31 18:53 [Xenomai-core] rt_task_delete segfault in libnative.so.3.0.0 Adam Bennett
@ 2009-04-01  8:44 ` Philippe Gerum
  2009-04-01 15:55   ` Adam Bennett
  0 siblings, 1 reply; 8+ messages in thread
From: Philippe Gerum @ 2009-04-01  8:44 UTC (permalink / raw)
  To: Adam Bennett; +Cc: xenomai

On Tue, 2009-03-31 at 14:53 -0400, Adam Bennett wrote:
> I'm running xenomai-head, linux-2.6.28.9, with uclibc-0.9.30.1.
> 
> I have to run configure with --build=i586-gentoo-linux-uclibc
> --without-__thread.
> 
> The problem I'm seeing is a segfault whenever calling rt_task_delete.
> This even occurs with the example program trivial-periodic.
> 
> I have debug enabled in the kernel, but nothing interesting appears in syslog.
> 
> Any thoughts?
> 

gdb?

> Adam
> 
> _______________________________________________
> Xenomai-core mailing list
> Xenomai-core@domain.hid
> https://mail.gna.org/listinfo/xenomai-core
-- 
Philippe.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Xenomai-core] rt_task_delete segfault in libnative.so.3.0.0
  2009-04-01  8:44 ` Philippe Gerum
@ 2009-04-01 15:55   ` Adam Bennett
  2009-04-01 16:01     ` Gilles Chanteperdrix
  2009-04-01 16:18     ` Gilles Chanteperdrix
  0 siblings, 2 replies; 8+ messages in thread
From: Adam Bennett @ 2009-04-01 15:55 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai

On Wed, Apr 1, 2009 at 4:44 AM, Philippe Gerum <rpm@xenomai.org> wrote:
> On Tue, 2009-03-31 at 14:53 -0400, Adam Bennett wrote:
>> I'm running xenomai-head, linux-2.6.28.9, with uclibc-0.9.30.1.
>>
>> I have to run configure with --build=i586-gentoo-linux-uclibc
>> --without-__thread.
>>
>> The problem I'm seeing is a segfault whenever calling rt_task_delete.
>> This even occurs with the example program trivial-periodic.
>>
>> I have debug enabled in the kernel, but nothing interesting appears in syslog.
>>
>> Any thoughts?
>>
>
> gdb?

Here's the backtrace (this is my first time using gdb, I've been a fan
of printf) after recompiling xenoami userland libs with debugging:

Thread 3 (process 1263):
#0  0xb7f0c5a6 in rt_task_wait_period (overruns_r=0x0)
    at ../../../../xenomai-head/src/skins/native/task.c:286
	muxcode = 134283819
	resultvar = 2739887275
#1  0x08048638 in demo (arg=0x0) at trivial-periodic.c:26
	now = 1238598807752498347
	previous = 1238598807752498347
#2  0xb7f0c056 in rt_task_trampoline (cookie=0x0)
    at ../../../../xenomai-head/src/skins/native/task.c:111
	iargs = (struct rt_task_iargs *) 0xbfb2c840
	entry = (void (*)(void *)) 0x8048604 <demo>
	bulk = {a1 = 134520892, a2 = 134514592, a3 = 99, a4 = 0, a5 = 1026,
a6 = 147481040}
	task = (RT_TASK *) 0x804a03c
	self = (RT_TASK *) 0x8ca6138
	err = 0
#3  0xb7f14f78 in pthread_start_thread () from /lib/libpthread.so.0
No symbol table info available.
#4  0xb7ec9efe in clone () from /lib/libc.so.0
No symbol table info available.

Thread 2 (process 1262):
#0  0xb7ecc330 in poll () from /lib/libc.so.0
No symbol table info available.
#1  0xb7f1aff4 in ?? () from /lib/libpthread.so.0
No symbol table info available.
#2  0x000004ef in ?? ()
No symbol table info available.
#3  0xb7f152a4 in __pthread_manager () from /lib/libpthread.so.0
No symbol table info available.
#4  0x00000000 in ?? ()
No symbol table info available.

Thread 1 (process 1261):
#0  0xb7f0c455 in rt_task_delete (task=0x804a03c)
    at ../../../../xenomai-head/src/skins/native/task.c:252
	err = -1078802316
#1  0x08048737 in main () at trivial-periodic.c:71
No locals.

The line that causes the segfault is 252:

248	int rt_task_delete(RT_TASK *task)
249	{
250		int err;
251	
252		if (!task || task->opaque == rt_task_self()->opaque) {
253			/* Silently migrate to avoid raising SIGXCPU. */
254			XENOMAI_SYSCALL1(__xn_sys_migrate, XENOMAI_LINUX_DOMAIN);

It looks like with --without-__thread that task->opaque or
rt_task_self()->opaque is not valid?

>
>> Adam
>>
>> _______________________________________________
>> Xenomai-core mailing list
>> Xenomai-core@domain.hid
>> https://mail.gna.org/listinfo/xenomai-core
> --
> Philippe.
>
>
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Xenomai-core] rt_task_delete segfault in libnative.so.3.0.0
  2009-04-01 15:55   ` Adam Bennett
@ 2009-04-01 16:01     ` Gilles Chanteperdrix
  2009-04-01 16:18     ` Gilles Chanteperdrix
  1 sibling, 0 replies; 8+ messages in thread
From: Gilles Chanteperdrix @ 2009-04-01 16:01 UTC (permalink / raw)
  To: Adam Bennett; +Cc: xenomai

Adam Bennett wrote:
> On Wed, Apr 1, 2009 at 4:44 AM, Philippe Gerum <rpm@xenomai.org> wrote:
>> On Tue, 2009-03-31 at 14:53 -0400, Adam Bennett wrote:
>>> I'm running xenomai-head, linux-2.6.28.9, with uclibc-0.9.30.1.
>>>
>>> I have to run configure with --build=i586-gentoo-linux-uclibc
>>> --without-__thread.
>>>
>>> The problem I'm seeing is a segfault whenever calling rt_task_delete.
>>> This even occurs with the example program trivial-periodic.
>>>
>>> I have debug enabled in the kernel, but nothing interesting appears in syslog.
>>>
>>> Any thoughts?
>>>
>> gdb?
> 
> Here's the backtrace (this is my first time using gdb, I've been a fan
> of printf) after recompiling xenoami userland libs with debugging:
> 
> Thread 3 (process 1263):
> #0  0xb7f0c5a6 in rt_task_wait_period (overruns_r=0x0)
>     at ../../../../xenomai-head/src/skins/native/task.c:286
> 	muxcode = 134283819
> 	resultvar = 2739887275
> #1  0x08048638 in demo (arg=0x0) at trivial-periodic.c:26
> 	now = 1238598807752498347
> 	previous = 1238598807752498347
> #2  0xb7f0c056 in rt_task_trampoline (cookie=0x0)
>     at ../../../../xenomai-head/src/skins/native/task.c:111
> 	iargs = (struct rt_task_iargs *) 0xbfb2c840
> 	entry = (void (*)(void *)) 0x8048604 <demo>
> 	bulk = {a1 = 134520892, a2 = 134514592, a3 = 99, a4 = 0, a5 = 1026,
> a6 = 147481040}
> 	task = (RT_TASK *) 0x804a03c
> 	self = (RT_TASK *) 0x8ca6138
> 	err = 0
> #3  0xb7f14f78 in pthread_start_thread () from /lib/libpthread.so.0
> No symbol table info available.
> #4  0xb7ec9efe in clone () from /lib/libc.so.0
> No symbol table info available.
> 
> Thread 2 (process 1262):
> #0  0xb7ecc330 in poll () from /lib/libc.so.0
> No symbol table info available.
> #1  0xb7f1aff4 in ?? () from /lib/libpthread.so.0
> No symbol table info available.
> #2  0x000004ef in ?? ()
> No symbol table info available.
> #3  0xb7f152a4 in __pthread_manager () from /lib/libpthread.so.0
> No symbol table info available.
> #4  0x00000000 in ?? ()
> No symbol table info available.
> 
> Thread 1 (process 1261):
> #0  0xb7f0c455 in rt_task_delete (task=0x804a03c)
>     at ../../../../xenomai-head/src/skins/native/task.c:252
> 	err = -1078802316
> #1  0x08048737 in main () at trivial-periodic.c:71
> No locals.
> 
> The line that causes the segfault is 252:
> 
> 248	int rt_task_delete(RT_TASK *task)
> 249	{
> 250		int err;
> 251	
> 252		if (!task || task->opaque == rt_task_self()->opaque) {
> 253			/* Silently migrate to avoid raising SIGXCPU. */
> 254			XENOMAI_SYSCALL1(__xn_sys_migrate, XENOMAI_LINUX_DOMAIN);
> 
> It looks like with --without-__thread that task->opaque or
> rt_task_self()->opaque is not valid?

This code is bogus. It will only work if rt_task_delete is called from a
native task. Which is obviously not always the case.

-- 
                                                 Gilles.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Xenomai-core] rt_task_delete segfault in libnative.so.3.0.0
  2009-04-01 15:55   ` Adam Bennett
  2009-04-01 16:01     ` Gilles Chanteperdrix
@ 2009-04-01 16:18     ` Gilles Chanteperdrix
  2009-04-01 16:30       ` Philippe Gerum
  1 sibling, 1 reply; 8+ messages in thread
From: Gilles Chanteperdrix @ 2009-04-01 16:18 UTC (permalink / raw)
  To: Adam Bennett; +Cc: xenomai

Adam Bennett wrote:
> On Wed, Apr 1, 2009 at 4:44 AM, Philippe Gerum <rpm@xenomai.org> wrote:
>> On Tue, 2009-03-31 at 14:53 -0400, Adam Bennett wrote:
>>> I'm running xenomai-head, linux-2.6.28.9, with uclibc-0.9.30.1.
>>>
>>> I have to run configure with --build=i586-gentoo-linux-uclibc
>>> --without-__thread.
>>>
>>> The problem I'm seeing is a segfault whenever calling rt_task_delete.
>>> This even occurs with the example program trivial-periodic.
>>>
>>> I have debug enabled in the kernel, but nothing interesting appears in syslog.
>>>
>>> Any thoughts?
>>>
>> gdb?
> 
> Here's the backtrace (this is my first time using gdb, I've been a fan
> of printf) after recompiling xenoami userland libs with debugging:
> 
> Thread 3 (process 1263):
> #0  0xb7f0c5a6 in rt_task_wait_period (overruns_r=0x0)
>     at ../../../../xenomai-head/src/skins/native/task.c:286
> 	muxcode = 134283819
> 	resultvar = 2739887275
> #1  0x08048638 in demo (arg=0x0) at trivial-periodic.c:26
> 	now = 1238598807752498347
> 	previous = 1238598807752498347
> #2  0xb7f0c056 in rt_task_trampoline (cookie=0x0)
>     at ../../../../xenomai-head/src/skins/native/task.c:111
> 	iargs = (struct rt_task_iargs *) 0xbfb2c840
> 	entry = (void (*)(void *)) 0x8048604 <demo>
> 	bulk = {a1 = 134520892, a2 = 134514592, a3 = 99, a4 = 0, a5 = 1026,
> a6 = 147481040}
> 	task = (RT_TASK *) 0x804a03c
> 	self = (RT_TASK *) 0x8ca6138
> 	err = 0
> #3  0xb7f14f78 in pthread_start_thread () from /lib/libpthread.so.0
> No symbol table info available.
> #4  0xb7ec9efe in clone () from /lib/libc.so.0
> No symbol table info available.
> 
> Thread 2 (process 1262):
> #0  0xb7ecc330 in poll () from /lib/libc.so.0
> No symbol table info available.
> #1  0xb7f1aff4 in ?? () from /lib/libpthread.so.0
> No symbol table info available.
> #2  0x000004ef in ?? ()
> No symbol table info available.
> #3  0xb7f152a4 in __pthread_manager () from /lib/libpthread.so.0
> No symbol table info available.
> #4  0x00000000 in ?? ()
> No symbol table info available.
> 
> Thread 1 (process 1261):
> #0  0xb7f0c455 in rt_task_delete (task=0x804a03c)
>     at ../../../../xenomai-head/src/skins/native/task.c:252
> 	err = -1078802316
> #1  0x08048737 in main () at trivial-periodic.c:71
> No locals.
> 
> The line that causes the segfault is 252:
> 
> 248	int rt_task_delete(RT_TASK *task)
> 249	{
> 250		int err;
> 251	
> 252		if (!task || task->opaque == rt_task_self()->opaque) {

try:

if (!task || rt_task_self() && task->opaque == rt_task_self()->opaque)


-- 
                                                 Gilles.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Xenomai-core] rt_task_delete segfault in libnative.so.3.0.0
  2009-04-01 16:18     ` Gilles Chanteperdrix
@ 2009-04-01 16:30       ` Philippe Gerum
  2009-04-01 17:37         ` Jan Kiszka
  0 siblings, 1 reply; 8+ messages in thread
From: Philippe Gerum @ 2009-04-01 16:30 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

On Wed, 2009-04-01 at 18:18 +0200, Gilles Chanteperdrix wrote:
> Adam Bennett wrote:
> > On Wed, Apr 1, 2009 at 4:44 AM, Philippe Gerum <rpm@xenomai.org> wrote:
> >> On Tue, 2009-03-31 at 14:53 -0400, Adam Bennett wrote:
> >>> I'm running xenomai-head, linux-2.6.28.9, with uclibc-0.9.30.1.
> >>>
> >>> I have to run configure with --build=i586-gentoo-linux-uclibc
> >>> --without-__thread.
> >>>
> >>> The problem I'm seeing is a segfault whenever calling rt_task_delete.
> >>> This even occurs with the example program trivial-periodic.
> >>>
> >>> I have debug enabled in the kernel, but nothing interesting appears in syslog.
> >>>
> >>> Any thoughts?
> >>>
> >> gdb?
> > 
> > Here's the backtrace (this is my first time using gdb, I've been a fan
> > of printf) after recompiling xenoami userland libs with debugging:
> > 
> > Thread 3 (process 1263):
> > #0  0xb7f0c5a6 in rt_task_wait_period (overruns_r=0x0)
> >     at ../../../../xenomai-head/src/skins/native/task.c:286
> > 	muxcode = 134283819
> > 	resultvar = 2739887275
> > #1  0x08048638 in demo (arg=0x0) at trivial-periodic.c:26
> > 	now = 1238598807752498347
> > 	previous = 1238598807752498347
> > #2  0xb7f0c056 in rt_task_trampoline (cookie=0x0)
> >     at ../../../../xenomai-head/src/skins/native/task.c:111
> > 	iargs = (struct rt_task_iargs *) 0xbfb2c840
> > 	entry = (void (*)(void *)) 0x8048604 <demo>
> > 	bulk = {a1 = 134520892, a2 = 134514592, a3 = 99, a4 = 0, a5 = 1026,
> > a6 = 147481040}
> > 	task = (RT_TASK *) 0x804a03c
> > 	self = (RT_TASK *) 0x8ca6138
> > 	err = 0
> > #3  0xb7f14f78 in pthread_start_thread () from /lib/libpthread.so.0
> > No symbol table info available.
> > #4  0xb7ec9efe in clone () from /lib/libc.so.0
> > No symbol table info available.
> > 
> > Thread 2 (process 1262):
> > #0  0xb7ecc330 in poll () from /lib/libc.so.0
> > No symbol table info available.
> > #1  0xb7f1aff4 in ?? () from /lib/libpthread.so.0
> > No symbol table info available.
> > #2  0x000004ef in ?? ()
> > No symbol table info available.
> > #3  0xb7f152a4 in __pthread_manager () from /lib/libpthread.so.0
> > No symbol table info available.
> > #4  0x00000000 in ?? ()
> > No symbol table info available.
> > 
> > Thread 1 (process 1261):
> > #0  0xb7f0c455 in rt_task_delete (task=0x804a03c)
> >     at ../../../../xenomai-head/src/skins/native/task.c:252
> > 	err = -1078802316
> > #1  0x08048737 in main () at trivial-periodic.c:71
> > No locals.
> > 
> > The line that causes the segfault is 252:
> > 
> > 248	int rt_task_delete(RT_TASK *task)
> > 249	{
> > 250		int err;
> > 251	
> > 252		if (!task || task->opaque == rt_task_self()->opaque) {
> 
> try:
> 
> if (!task || rt_task_self() && task->opaque == rt_task_self()->opaque)
> 
> 

Indeed. The following patch is queued.

diff --git a/src/skins/native/task.c b/src/skins/native/task.c
index 5cf37d9..905d366 100644
--- a/src/skins/native/task.c
+++ b/src/skins/native/task.c
@@ -249,10 +249,10 @@ int rt_task_delete(RT_TASK *task)
 {
 	int err;
 
-	if (!task || task->opaque == rt_task_self()->opaque) {
+	if (task == NULL ||
+	    (rt_task_self() && task->opaque == rt_task_self()->opaque)) {
 		/* Silently migrate to avoid raising SIGXCPU. */
 		XENOMAI_SYSCALL1(__xn_sys_migrate, XENOMAI_LINUX_DOMAIN);
-
 		pthread_exit(NULL);
 	}
 

-- 
Philippe.




^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Xenomai-core] rt_task_delete segfault in libnative.so.3.0.0
  2009-04-01 16:30       ` Philippe Gerum
@ 2009-04-01 17:37         ` Jan Kiszka
  2009-04-01 19:34           ` Adam Bennett
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Kiszka @ 2009-04-01 17:37 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 3549 bytes --]

Philippe Gerum wrote:
> On Wed, 2009-04-01 at 18:18 +0200, Gilles Chanteperdrix wrote:
>> Adam Bennett wrote:
>>> On Wed, Apr 1, 2009 at 4:44 AM, Philippe Gerum <rpm@xenomai.org> wrote:
>>>> On Tue, 2009-03-31 at 14:53 -0400, Adam Bennett wrote:
>>>>> I'm running xenomai-head, linux-2.6.28.9, with uclibc-0.9.30.1.
>>>>>
>>>>> I have to run configure with --build=i586-gentoo-linux-uclibc
>>>>> --without-__thread.
>>>>>
>>>>> The problem I'm seeing is a segfault whenever calling rt_task_delete.
>>>>> This even occurs with the example program trivial-periodic.
>>>>>
>>>>> I have debug enabled in the kernel, but nothing interesting appears in syslog.
>>>>>
>>>>> Any thoughts?
>>>>>
>>>> gdb?
>>> Here's the backtrace (this is my first time using gdb, I've been a fan
>>> of printf) after recompiling xenoami userland libs with debugging:
>>>
>>> Thread 3 (process 1263):
>>> #0  0xb7f0c5a6 in rt_task_wait_period (overruns_r=0x0)
>>>     at ../../../../xenomai-head/src/skins/native/task.c:286
>>> 	muxcode = 134283819
>>> 	resultvar = 2739887275
>>> #1  0x08048638 in demo (arg=0x0) at trivial-periodic.c:26
>>> 	now = 1238598807752498347
>>> 	previous = 1238598807752498347
>>> #2  0xb7f0c056 in rt_task_trampoline (cookie=0x0)
>>>     at ../../../../xenomai-head/src/skins/native/task.c:111
>>> 	iargs = (struct rt_task_iargs *) 0xbfb2c840
>>> 	entry = (void (*)(void *)) 0x8048604 <demo>
>>> 	bulk = {a1 = 134520892, a2 = 134514592, a3 = 99, a4 = 0, a5 = 1026,
>>> a6 = 147481040}
>>> 	task = (RT_TASK *) 0x804a03c
>>> 	self = (RT_TASK *) 0x8ca6138
>>> 	err = 0
>>> #3  0xb7f14f78 in pthread_start_thread () from /lib/libpthread.so.0
>>> No symbol table info available.
>>> #4  0xb7ec9efe in clone () from /lib/libc.so.0
>>> No symbol table info available.
>>>
>>> Thread 2 (process 1262):
>>> #0  0xb7ecc330 in poll () from /lib/libc.so.0
>>> No symbol table info available.
>>> #1  0xb7f1aff4 in ?? () from /lib/libpthread.so.0
>>> No symbol table info available.
>>> #2  0x000004ef in ?? ()
>>> No symbol table info available.
>>> #3  0xb7f152a4 in __pthread_manager () from /lib/libpthread.so.0
>>> No symbol table info available.
>>> #4  0x00000000 in ?? ()
>>> No symbol table info available.
>>>
>>> Thread 1 (process 1261):
>>> #0  0xb7f0c455 in rt_task_delete (task=0x804a03c)
>>>     at ../../../../xenomai-head/src/skins/native/task.c:252
>>> 	err = -1078802316
>>> #1  0x08048737 in main () at trivial-periodic.c:71
>>> No locals.
>>>
>>> The line that causes the segfault is 252:
>>>
>>> 248	int rt_task_delete(RT_TASK *task)
>>> 249	{
>>> 250		int err;
>>> 251	
>>> 252		if (!task || task->opaque == rt_task_self()->opaque) {
>> try:
>>
>> if (!task || rt_task_self() && task->opaque == rt_task_self()->opaque)
>>
>>
> 
> Indeed. The following patch is queued.
> 
> diff --git a/src/skins/native/task.c b/src/skins/native/task.c
> index 5cf37d9..905d366 100644
> --- a/src/skins/native/task.c
> +++ b/src/skins/native/task.c
> @@ -249,10 +249,10 @@ int rt_task_delete(RT_TASK *task)
>  {
>  	int err;
>  
> -	if (!task || task->opaque == rt_task_self()->opaque) {
> +	if (task == NULL ||
> +	    (rt_task_self() && task->opaque == rt_task_self()->opaque)) {
>  		/* Silently migrate to avoid raising SIGXCPU. */
>  		XENOMAI_SYSCALL1(__xn_sys_migrate, XENOMAI_LINUX_DOMAIN);
> -
>  		pthread_exit(NULL);
>  	}
>

Mea culpa.

I would just suggest to put rt_task_self() into a local variable to
avoid double evaluation.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Xenomai-core] rt_task_delete segfault in libnative.so.3.0.0
  2009-04-01 17:37         ` Jan Kiszka
@ 2009-04-01 19:34           ` Adam Bennett
  0 siblings, 0 replies; 8+ messages in thread
From: Adam Bennett @ 2009-04-01 19:34 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

2009/4/1 Jan Kiszka <jan.kiszka@domain.hid>:
> Philippe Gerum wrote:
>> On Wed, 2009-04-01 at 18:18 +0200, Gilles Chanteperdrix wrote:
>>> Adam Bennett wrote:
>>>> On Wed, Apr 1, 2009 at 4:44 AM, Philippe Gerum <rpm@xenomai.org> wrote:
>>>>> On Tue, 2009-03-31 at 14:53 -0400, Adam Bennett wrote:
>>>>>> I'm running xenomai-head, linux-2.6.28.9, with uclibc-0.9.30.1.
>>>>>>
>>>>>> I have to run configure with --build=i586-gentoo-linux-uclibc
>>>>>> --without-__thread.
>>>>>>
>>>>>> The problem I'm seeing is a segfault whenever calling rt_task_delete.
>>>>>> This even occurs with the example program trivial-periodic.
>>>>>>
>>>>>> I have debug enabled in the kernel, but nothing interesting appears in syslog.
>>>>>>
>>>>>> Any thoughts?
>>>>>>
>>>>> gdb?
>>>> Here's the backtrace (this is my first time using gdb, I've been a fan
>>>> of printf) after recompiling xenoami userland libs with debugging:
>>>>
>>>> Thread 3 (process 1263):
>>>> #0  0xb7f0c5a6 in rt_task_wait_period (overruns_r=0x0)
>>>>     at ../../../../xenomai-head/src/skins/native/task.c:286
>>>>     muxcode = 134283819
>>>>     resultvar = 2739887275
>>>> #1  0x08048638 in demo (arg=0x0) at trivial-periodic.c:26
>>>>     now = 1238598807752498347
>>>>     previous = 1238598807752498347
>>>> #2  0xb7f0c056 in rt_task_trampoline (cookie=0x0)
>>>>     at ../../../../xenomai-head/src/skins/native/task.c:111
>>>>     iargs = (struct rt_task_iargs *) 0xbfb2c840
>>>>     entry = (void (*)(void *)) 0x8048604 <demo>
>>>>     bulk = {a1 = 134520892, a2 = 134514592, a3 = 99, a4 = 0, a5 = 1026,
>>>> a6 = 147481040}
>>>>     task = (RT_TASK *) 0x804a03c
>>>>     self = (RT_TASK *) 0x8ca6138
>>>>     err = 0
>>>> #3  0xb7f14f78 in pthread_start_thread () from /lib/libpthread.so.0
>>>> No symbol table info available.
>>>> #4  0xb7ec9efe in clone () from /lib/libc.so.0
>>>> No symbol table info available.
>>>>
>>>> Thread 2 (process 1262):
>>>> #0  0xb7ecc330 in poll () from /lib/libc.so.0
>>>> No symbol table info available.
>>>> #1  0xb7f1aff4 in ?? () from /lib/libpthread.so.0
>>>> No symbol table info available.
>>>> #2  0x000004ef in ?? ()
>>>> No symbol table info available.
>>>> #3  0xb7f152a4 in __pthread_manager () from /lib/libpthread.so.0
>>>> No symbol table info available.
>>>> #4  0x00000000 in ?? ()
>>>> No symbol table info available.
>>>>
>>>> Thread 1 (process 1261):
>>>> #0  0xb7f0c455 in rt_task_delete (task=0x804a03c)
>>>>     at ../../../../xenomai-head/src/skins/native/task.c:252
>>>>     err = -1078802316
>>>> #1  0x08048737 in main () at trivial-periodic.c:71
>>>> No locals.
>>>>
>>>> The line that causes the segfault is 252:
>>>>
>>>> 248 int rt_task_delete(RT_TASK *task)
>>>> 249 {
>>>> 250         int err;
>>>> 251
>>>> 252         if (!task || task->opaque == rt_task_self()->opaque) {
>>> try:
>>>
>>> if (!task || rt_task_self() && task->opaque == rt_task_self()->opaque)
>>>
>>>
>>
>> Indeed. The following patch is queued.
>>
>> diff --git a/src/skins/native/task.c b/src/skins/native/task.c
>> index 5cf37d9..905d366 100644
>> --- a/src/skins/native/task.c
>> +++ b/src/skins/native/task.c
>> @@ -249,10 +249,10 @@ int rt_task_delete(RT_TASK *task)
>>  {
>>       int err;
>>
>> -     if (!task || task->opaque == rt_task_self()->opaque) {
>> +     if (task == NULL ||
>> +         (rt_task_self() && task->opaque == rt_task_self()->opaque)) {
>>               /* Silently migrate to avoid raising SIGXCPU. */
>>               XENOMAI_SYSCALL1(__xn_sys_migrate, XENOMAI_LINUX_DOMAIN);
>> -
>>               pthread_exit(NULL);
>>       }
>>

Thanks, this fixed the segfaults!

Adam

>
> Mea culpa.
>
> I would just suggest to put rt_task_self() into a local variable to
> avoid double evaluation.
>
> Jan
>
>
> _______________________________________________
> Xenomai-core mailing list
> Xenomai-core@domain.hid
> https://mail.gna.org/listinfo/xenomai-core
>
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-04-01 19:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-31 18:53 [Xenomai-core] rt_task_delete segfault in libnative.so.3.0.0 Adam Bennett
2009-04-01  8:44 ` Philippe Gerum
2009-04-01 15:55   ` Adam Bennett
2009-04-01 16:01     ` Gilles Chanteperdrix
2009-04-01 16:18     ` Gilles Chanteperdrix
2009-04-01 16:30       ` Philippe Gerum
2009-04-01 17:37         ` Jan Kiszka
2009-04-01 19:34           ` Adam Bennett

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.