All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] SIGILL when calling pthread_cleanup_push()
@ 2011-10-03  9:35 Michael Bernhard
  2011-10-03 12:26 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Bernhard @ 2011-10-03  9:35 UTC (permalink / raw)
  To: xenomai@xenomai.org

Hi

We are using Xenomai-2.5.6 together with Linux-2.6.35 on a PXA270 
processor. Xenomai works fine so far. However we get SIGILL when using 
pthread_cleanup_push() in a RT-thread. I now tried the same over 
Xenomai-2.6 and the behavior is still the same.

Here's a simple example which shows the problem (for Xenomai-2.6):

#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <signal.h>
#include <execinfo.h>
#include <sys/mman.h>

pthread_t thread_id;

void sig_handler(int signal)
{
   void *bt[32];
   int nentries;

   printf("Cought signal: %d\n", signal);

   nentries = backtrace(bt,sizeof(bt) / sizeof(bt[0]));
   backtrace_symbols_fd(bt,nentries,fileno(stdout));
}

void cancel_func(void * arg)
{
}

void * thread_func(void * arg)
{
   /* When forcing a mode switch to Linux, SIGILL is not generated */
#if 0
   __real_printf("Force mode switch\n");
#endif

   pthread_cleanup_push (cancel_func, NULL);
   pthread_cleanup_pop(1);

   return NULL;
}

int main (int argc, char * argv[])
{
   pthread_attr_t attr;
   struct sched_param prio = {.sched_priority = 99};
	
   signal(SIGILL, sig_handler);
	
   mlockall(MCL_CURRENT | MCL_FUTURE);
	
   pthread_attr_init(&attr);
   pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
   pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
   pthread_attr_setschedparam(&attr, &prio);
	
   pthread_create(&thread_id, &attr, thread_func, NULL);

   sleep(1);
	
   pthread_join(thread_id, NULL);
	
   return 0;
}

SIGILL is not raised, when a mode switch to Linux is forced prior to 
call pthread_cleanup_push(). It is also not rised when the RT-thread 
runs under SCHED_OTHER.

The "Undefined instruction" gets incremented in /proc/xenomai/faults.

The backtrace does not reveal much information:
Cought signal: 4
./sigill[0x89bc]
/lib/libc.so.6(__default_sa_restorer_v2+0x0)[0x8bda90]
/lib/libc.so.6(__sigsetjmp+0x38)[0x8bc4f8]
./sigill[0x8a44]
/usr/xenomai/lib/libpthread_rt.so.1(+0x4448)[0x82c448]
/lib/libpthread.so.0(+0x5b60)[0x852b60]
/lib/libc.so.6(clone+0x88)[0x967c58]

What is going wrong here?

--
Michael


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

end of thread, other threads:[~2011-10-05 17:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-03  9:35 [Xenomai-help] SIGILL when calling pthread_cleanup_push() Michael Bernhard
2011-10-03 12:26 ` Gilles Chanteperdrix
2011-10-03 15:33   ` Gilles Chanteperdrix
2011-10-04 11:25     ` Gilles Chanteperdrix
2011-10-04 15:14       ` Michael Bernhard
2011-10-04 15:29         ` Gilles Chanteperdrix
2011-10-05 17:07           ` Michael Bernhard
2011-10-05 17:35             ` Gilles Chanteperdrix

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.