Re: segfaults

Mark Hounschell <[email protected]> Mon, 13 Jan 2003 12:57:27 -0500
Newsgroups gmane.linux.ngpt.user
Message-ID <[email protected]>
"Howell, David P" wrote:
> 
> One additional comment, if there is no /usr/lib/libpthread.so.0 symbolic
> link to libpthread.so.22 you should be able to build it link and retry
> your APP with the same script and it should work. As for why this wasn't
> in the builds as is, a quick look shows that it's in the Makefile after
> config but is missing from ngpt.spec, so building and installing from
> the source tarball should work but building/installing the binary
> packages will have this bug.
> 
> I'll post a patch for this ASAP and get it in for the next release.
> 
> Dave Howell
> 
> These are my opinions and not official opinions of Intel Corp.
> 
> David Howell
> Intel Corporation
> Telco Server Development
> Server Products Division
> Voice: (803) 461-6112  Fax: (803) 461-6292
> 
> Intel Corporation
> Columbia Design Center, CBA-2
> 250 Berryhill Road, Suite 100
> Columbia, SC 29210
> 
> [email protected]
> 
> -----Original Message-----
> From: Howell, David P
> Sent: Monday, January 13, 2003 9:17 AM
> To: [email protected]; [email protected]
> Subject: RE: [pthreads-users] segfaults
> 
> >From the 'ldd v67' output, libpthread.so.0 was resolved to
> /lib/libpthread.so.0 (Linuxthreads). As /usr/lib/libpthread.so.22 is
> also included this will SEGFAULT (both NGPT and Linuxthreads in same
> image).
> 
> With the LD_LIBRARY_PATH and LD_PRELOAD this should have been
> /usr/lib/libpthread.so.0 (NGPT), is there not a link in /usr/lib as
> libpthread.so.0 to libpthread.so.22.0.20? This is what I would have
> expected and would have resulted in a fully NGPT image.
> 
> Dave Howell
> 
> These are my opinions and not official opinions of Intel Corp.
> 
> David Howell
> Intel Corporation
> Telco Server Development
> Server Products Division
> Voice: (803) 461-6112  Fax: (803) 461-6292
> 
> Intel Corporation
> Columbia Design Center, CBA-2
> 250 Berryhill Road, Suite 100
> Columbia, SC 29210
> 
> [email protected]
> 
> -----Original Message-----
> From: Mark Hounschell [mailto:[email protected]]
> Sent: Saturday, January 11, 2003 2:10 PM
> To: [email protected]
> Subject: [pthreads-users] segfaults
> 
> I'm running a 2.4.20 kernel on a SuSE 8.1 box. The futex-2.4.19 patch
> applied but had to make a couple changes by hand. No biggie. Built,
> installed, then rebooted the new kernel after adding the
> ngptinit command to my /etc/init.d/boot.local file and doing Then I did
> the following:
> 
> rpm -Uvh ngpt-2.2.0-1.src.rpm
> rpm -ba /usr/src/packages/SPEC/ngpt.spec
> rpm -Uvh --replacefiles
> /usr/src/packages/RPMS/i386/ngpt-2.2.0-1.i386.rpm
> rpm -Uvh --replacefiles
> /usr/src/packages/RPMS/i386/ngpt-devel-2.2.0-1.i386.rpm
> 
> I rebuilt the rpms because I wasn't sure what gcc rev was used. I wanted
> to make sure it was with gcc-3.2.. I tried the original rpms first with
> the same results as below.
> 
> Reboot.......
> 
> Then I recompiled my app. It compiled and linked ok.. Then I did..
> 
> export LD_LIBARARY_PATH="/usr/lib:/lib:$LD_LIBARARY_PATH"
> export LD_PRELOAD=libpthread.so.0
> 
> Then I  ldd v67
> harley:/home/markh/work/lcrs # ldd v67
>         libpthread.so.0 => /lib/libpthread.so.0 (0x4002b000)
>         libdl.so.2 => /lib/libdl.so.2 (0x40040000)
>         libpthread.so.22 => /usr/lib/libpthread.so.22 (0x40043000)
>         librt.so.1 => /lib/librt.so.1 (0x400f9000)
>         libm.so.6 => /lib/libm.so.6 (0x4010a000)
>         libc.so.6 => /lib/libc.so.6 (0x4012d000)
>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
> 
> 
> My app segfaults ...
> harley:/home/markh/work/lcrs # ./v67
> Segmentation fault
> 
> Here is a short strace...
> 
> harley:/home/markh/work/lcrs # strace ./v67
> execve("./v67", ["./v67"], [/* 60 vars */]) = 0
> uname({sys="Linux", node="harley", ...}) = 0
> brk(0)                                  = 0x8148860
> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
> 0) = 0x40013000
> open("/etc/ld.so.cache", O_RDONLY)      = 3
> fstat64(3, {st_mode=S_IFREG|0644, st_size=90309, ...}) = 0
> mmap2(NULL, 90309, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40014000
> close(3)                                = 0
> open("/lib/libpthread.so.0", O_RDONLY)  = 3
> read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\300B\0"...,
> 1024) = 1024
> fstat64(3, {st_mode=S_IFREG|0755, st_size=106013, ...}) = 0
> mmap2(NULL, 85328, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4002b000
> mprotect(0x40039000, 27984, PROT_NONE)  = 0
> mmap2(0x40039000, 28672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
> 0xe) = 0x40039000
> close(3)                                = 0
> open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or
> directory)
> open("/lib/libdl.so.2", O_RDONLY)       = 3
> read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0`\31\0\000"...,
> 1024) = 1024
> fstat64(3, {st_mode=S_IFREG|0755, st_size=11832, ...}) = 0
> mmap2(NULL, 11544, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x40040000
> mprotect(0x40042000, 3352, PROT_NONE)   = 0
> mmap2(0x40042000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
> 0x1) = 0x40042000
> close(3)                                = 0
> open("/usr/lib/libpthread.so.22", O_RDONLY) = 3
> read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@\207\0"...,
> 1024) = 1024
> fstat64(3, {st_mode=S_IFREG|0755, st_size=270889, ...}) = 0
> mmap2(NULL, 745416, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x40043000
> mprotect(0x40073000, 548808, PROT_NONE) = 0
> mmap2(0x40073000, 49152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
> 0x2f) = 0x40073000
> mmap2(0x4007f000, 499656, PROT_READ|PROT_WRITE,
> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4007f000
> close(3)                                = 0
> open("/lib/librt.so.1", O_RDONLY)       = 3
> read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0P\32\0\000"...,
> 1024) = 1024
> fstat64(3, {st_mode=S_IFREG|0755, st_size=33743, ...}) = 0
> mmap2(NULL, 68020, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x400f9000
> mprotect(0x400ff000, 43444, PROT_NONE)  = 0
> mmap2(0x400ff000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
> 0x6) = 0x400ff000
> mmap2(0x40100000, 39348, PROT_READ|PROT_WRITE,
> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40100000
> close(3)                                = 0
> open("/lib/libm.so.6", O_RDONLY)        = 3
> read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@7\0\000"...,
> 1024) = 1024
> fstat64(3, {st_mode=S_IFREG|0755, st_size=176463, ...}) = 0
> mmap2(NULL, 140960, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4010a000
> mprotect(0x4012c000, 1696, PROT_NONE)   = 0
> mmap2(0x4012c000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
> 0x21) = 0x4012c000
> close(3)                                = 0
> open("/lib/libc.so.6", O_RDONLY)        = 3
> read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\300\205"...,
> 1024) = 1024
> fstat64(3, {st_mode=S_IFREG|0755, st_size=1312470, ...}) = 0
> mmap2(NULL, 1169856, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) =
> 0x4012d000
> mprotect(0x40241000, 39360, PROT_NONE)  = 0
> mmap2(0x40241000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
> 0x113) = 0x40241000
> mmap2(0x40247000, 14784, PROT_READ|PROT_WRITE,
> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40247000
> close(3)                                = 0
> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
> 0) = 0x4024b000
> munmap(0x40014000, 90309)               = 0
> getrlimit(0x3, 0xbffff36c)              = 0
> setrlimit(RLIMIT_STACK, {rlim_cur=2044*1024, rlim_max=RLIM_INFINITY}) =
> 0
> getpid()                                = 25357
> rt_sigaction(SIGRTMIN, {0x400338b0, [], 0x4000000}, NULL, 8) = 0
> rt_sigaction(SIGRT_1, {0x40033950, [], 0x4000000}, NULL, 8) = 0
> rt_sigaction(SIGRT_2, {0x40033a80, [], 0x4000000}, NULL, 8) = 0
> --- SIGSEGV (Segmentation fault) ---
> +++ killed by SIGSEGV +++
> 
> ??????
> 
> Thanks
> Mark

Here is was I have in /usr/lib after installing the rpms

harley:/usr/lib # ls -al /usr/lib/libpth*
-rw-r--r--    1 root     root       315190 2003-01-09 13:37 /usr/lib/libpthread.a
-rw-r--r--    1 root     root          659 2003-01-09 13:37 /usr/lib/libpthread.la
lrwxrwxrwx    1 root     root           21 2003-01-13 12:52 /usr/lib/libpthread.so -> libpthread.so.22.0.20
lrwxrwxrwx    1 root     root           13 2003-01-13 12:52 /usr/lib/libpthread.so.0 -> libpthread.so
lrwxrwxrwx    1 root     root           21 2003-01-13 12:52 /usr/lib/libpthread.so.22 -> libpthread.so.22.0.20
-rwxr-xr-x    1 root     root       272182 2003-01-09 13:37 /usr/lib/libpthread.so.22.0.20
-rw-r--r--    1 root     root      1523718 2002-09-09 12:41 /usr/lib/libpthread_p.a

The link is there


Here is what is in /lib

harley:/lib #ls -al /lib/pth*

/lib/libpthread.so.0

???

Mark