Statically-linked binary SegFaults

D

David Douthitt

I have a binary statically linked application that was compiled against
Red Hat 7.3 (presumably glibc 2.2.5). The application SegFaults when
run in a Red Hat Advanced Server environment - with glibc 2.3.2.

I had another binary (Samhain - to which I have source!) which had the
same problem and exhibited the same strace. After a recompile, the
newly compiled static binary worked fine.

Why is this? The first binary I don't have source for and need to make
my case - and I'm curious besides. My initial response is "it shouldn't
matter what glibc is, it's statically linked." This appears to be
wrong. Both binaries made open/close calls to ld-linux.so.2,
libnss_files.so.2, /lib/tls/libc.so.6, and others. The segfault occurs
right after ld-linux.so.2 is opened, read, and closed.
 
M

Malcolm

David Douthitt said:
I have a binary statically linked application that was compiled
against Red Hat 7.3 (presumably glibc 2.2.5). The application
SegFaults when run in a Red Hat Advanced Server environment -
with glibc 2.3.2.
We can only deal with language issues here.
If a commercial library segfaults then the problem is probably in your own
code - most likely you are passing a bad pointer, though undefined behaviour
anywhere in your program can sometimes cause a fault in a seemingly
unrelated part.
Try to comment out code until you have a minimal program that exhibits the
problem. If this doesn't lead you to the answer then try posting here, but
as I say we can't deal with UNIX internals but only tell you whether your C
is or is not Ok.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top