All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] segfaults when using xenomai shared library
@ 2015-04-23 14:18 Henry Bausley
  2015-04-23 14:34 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 3+ messages in thread
From: Henry Bausley @ 2015-04-23 14:18 UTC (permalink / raw)
  To: Xenomai@xenomai.org

I am seeing a intermittent segfaults when linking to a shared library
that links with xenomai.

I sometimes get
[30354.351344] projpp[25002]: segfault at c ip b751bcfa sp b770c238
error 4 in libpthread-2.19.so[b7511000+18000]

My shared library libppmac.so contains a single function and absolutely
nothing else

int Test(void)
{
  return 1 + 1;
}

ldd returns

root@10.34.9.73:/opt/ppmac/libppmac# ldd libppmac.so 
	linux-gate.so.1 =>  (0xb7779000)
	libpthread_rt.so.1 => /usr/lib/libpthread_rt.so.1 (0xb774e000)
	libxenomai.so.0 => /usr/lib/libxenomai.so.0 (0xb7746000)
	libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7596000)
	libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb757a000)
	librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb7571000)
	/lib/ld-linux.so.2 (0xb777a000)

My application does not even call the function in the shared library.
Its code is as follows

#include <pthread.h>
#include <dlfcn.h>

int Test(void);

int main(int argc, char *argv[])
{
  printf("pthread_setschedparam(pthread_self(),SCHED_OTHER,&param);\n");
}

int CallLibraryToBreak(void)
{
  Test();
}

The application does not segfault if I do not link the xenomai libraries
ie. 

root@10.34.9.73:/opt/ppmac/libppmac# ldd libppmac.so
	linux-gate.so.1 =>  (0xb77ac000)
	libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb75de000)
	/lib/ld-linux.so.2 (0xb77ad000)

I am using i686 ubuntu 14.04 with 3.14.28-xenomai-2.6.4  any suggestions
would be greatly appreciated.

I use the script below to check if the program faults
#!/bin/bash
test=`./projpp | grep SCHED_OTHER`

while [ $test ]
do
test=`./projpp | grep SCHED_OTHER`
done
echo 'Crashed'




Outbound scan for Spam or Virus by Barracuda at Delta Tau



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

* Re: [Xenomai] segfaults when using xenomai shared library
  2015-04-23 14:18 [Xenomai] segfaults when using xenomai shared library Henry Bausley
@ 2015-04-23 14:34 ` Gilles Chanteperdrix
  2015-04-23 14:47   ` Henry Bausley
  0 siblings, 1 reply; 3+ messages in thread
From: Gilles Chanteperdrix @ 2015-04-23 14:34 UTC (permalink / raw)
  To: Henry Bausley; +Cc: Xenomai@xenomai.org

On Thu, Apr 23, 2015 at 07:18:29AM -0700, Henry Bausley wrote:
> I am seeing a intermittent segfaults when linking to a shared library
> that links with xenomai.
> 
> I sometimes get
> [30354.351344] projpp[25002]: segfault at c ip b751bcfa sp b770c238
> error 4 in libpthread-2.19.so[b7511000+18000]
> 
> My shared library libppmac.so contains a single function and absolutely
> nothing else
> 
> int Test(void)
> {
>   return 1 + 1;
> }
> 
> ldd returns
> 
> root@10.34.9.73:/opt/ppmac/libppmac# ldd libppmac.so 
> 	linux-gate.so.1 =>  (0xb7779000)
> 	libpthread_rt.so.1 => /usr/lib/libpthread_rt.so.1 (0xb774e000)
> 	libxenomai.so.0 => /usr/lib/libxenomai.so.0 (0xb7746000)
> 	libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7596000)
> 	libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb757a000)
> 	librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb7571000)
> 	/lib/ld-linux.so.2 (0xb777a000)
> 
> My application does not even call the function in the shared library.
> Its code is as follows
> 
> #include <pthread.h>
> #include <dlfcn.h>
> 
> int Test(void);
> 
> int main(int argc, char *argv[])
> {
>   printf("pthread_setschedparam(pthread_self(),SCHED_OTHER,&param);\n");
> }
> 
> int CallLibraryToBreak(void)
> {
>   Test();
> }
> 
> The application does not segfault if I do not link the xenomai libraries
> ie. 

There is a case you seem to not have tested. What about linking with
xenomai libraries without linking to libppmac.so ?

-- 
					    Gilles.


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

* Re: [Xenomai] segfaults when using xenomai shared library
  2015-04-23 14:34 ` Gilles Chanteperdrix
@ 2015-04-23 14:47   ` Henry Bausley
  0 siblings, 0 replies; 3+ messages in thread
From: Henry Bausley @ 2015-04-23 14:47 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: Xenomai@xenomai.org

On Thu, 2015-04-23 at 16:34 +0200, Gilles Chanteperdrix wrote:
> On Thu, Apr 23, 2015 at 07:18:29AM -0700, Henry Bausley wrote:
> > I am seeing a intermittent segfaults when linking to a shared library
> > that links with xenomai.
> > 
> > I sometimes get
> > [30354.351344] projpp[25002]: segfault at c ip b751bcfa sp b770c238
> > error 4 in libpthread-2.19.so[b7511000+18000]
> > 
> > My shared library libppmac.so contains a single function and absolutely
> > nothing else
> > 
> > int Test(void)
> > {
> >   return 1 + 1;
> > }
> > 
> > ldd returns
> > 
> > root@10.34.9.73:/opt/ppmac/libppmac# ldd libppmac.so 
> > 	linux-gate.so.1 =>  (0xb7779000)
> > 	libpthread_rt.so.1 => /usr/lib/libpthread_rt.so.1 (0xb774e000)
> > 	libxenomai.so.0 => /usr/lib/libxenomai.so.0 (0xb7746000)
> > 	libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7596000)
> > 	libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb757a000)
> > 	librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb7571000)
> > 	/lib/ld-linux.so.2 (0xb777a000)
> > 
> > My application does not even call the function in the shared library.
> > Its code is as follows
> > 
> > #include <pthread.h>
> > #include <dlfcn.h>
> > 
> > int Test(void);
> > 
> > int main(int argc, char *argv[])
> > {
> >   printf("pthread_setschedparam(pthread_self(),SCHED_OTHER,&param);\n");
> > }
> > 
> > int CallLibraryToBreak(void)
> > {
> >   Test();
> > }
> > 
> > The application does not segfault if I do not link the xenomai libraries
> > ie. 
> 
> There is a case you seem to not have tested. What about linking with
> xenomai libraries without linking to libppmac.so ?
> 
Linking w/o libppmac.so does not segfault. 

root@10.34.9.73:/opt/ppmac/projpp# ldd projpp
	linux-gate.so.1 =>  (0xb7741000)
	libpthread_rt.so.1 => /usr/lib/libpthread_rt.so.1 (0xb7719000)
	libxenomai.so.0 => /usr/lib/libxenomai.so.0 (0xb7711000)
	libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7561000)
	libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb7545000)
	librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb753c000)
	/lib/ld-linux.so.2 (0xb7742000)
root@10.34.9.73:/opt/ppmac/projpp# ./test.sh





Outbound scan for Spam or Virus by Barracuda at Delta Tau



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

end of thread, other threads:[~2015-04-23 14:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-23 14:18 [Xenomai] segfaults when using xenomai shared library Henry Bausley
2015-04-23 14:34 ` Gilles Chanteperdrix
2015-04-23 14:47   ` Henry Bausley

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.