Cannot Execute ELF 32-bit LSB Executable file

fkkaleem
fkkaleem used Ask the Experts™
on
Hi gurus,

I would like to run a zipped file for example, (x2.gz).  I had unzipped the file by using the command gunzip x2.gz and obtained x2.  This file is not in an executable form.  So I applied chmod i.e.  chmod +x x2 and made it an executable but if I run this file I am getting "segmentation fault (core dumped)".  How to run such a file??

Example :

$ file x2
x2 : ELF 32-bit LSB executable, Intel 80386, Version 1, dynamically linked(uses shared libs), stripped

$ chmod +x x2

$ ls -l x2
-rwxr-xr-x   1 John John    82288 Aug 26 16:20 x2  

$ ./x2
Segmentation fault (core dumped)  

Any help from gurus is appreciated!!!

Thanks & Regards

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2006
Commented:
segmentation fault, core dumped means that the executable is trying to access memory which is outside its address space ...

to make it run, you will have to modify ( read debug )  its source code ... no other option AFAIK

did you get the executable from a reliable source .... executables from unreliable sources can crack your system
Commented:
The problem is not that you can't run an ELF executable. It is being executed by the kernel. The problem is, like sunnycoder said, that it is trying to access memory space that it doesn't have the privilege too.(Maybe a missing malloc?)

what you can do is to run the executable through a debugger. I would preffer gdb.
In order for that to be more effective (if you have the source file) rebuild with the -g option on gcc.
This will enclose debugging information on the executable:

$gcc -g -Wall X2.c -o X2
$gdb X2
(gdb) run
 and when the segmentation fault occurs:
(gdb) where
in order to give you exact information about the problem.

I hope it is going to help.

Author

Commented:
Hi Sunnycoder and d4rw1n,

Thanks for your kind info.  Still can't run using the -g option on gcc.  The following are the error messages I get.

(gdb) exec-file x2.c
(gdb) run x2
Starting program: /home/John/x2.c x2
(no debugging symbols found)...
Program received signal SIGSEGV, Segmentation fault.
0x4011df2a in _IO_vfprintf (s=0x0,
    format=0x8058a20 "Error, %s (%d): %s (%s)\n", ap=0xbffff768)
    at vfprintf.c:1024
1024    vfprintf.c: No such file or directory.
(gdb)

Hope this will help u guys to track the bug!!

Regards                                                
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

Top Expert 2006

Commented:
do you have the source code for the executable or do you have only the executable ?

Author

Commented:
Hi sunnycoder,

I only have an executable file.

I just tried to rename the file to x2.c and did the process as per your instructions.  But when I exit from (gdb), it says the program is running , do you want exit (y/n)?   when I pressed y, I exit from (gdb).

I'm not sure how this type of file can be executed!!

Any suggestion or advice is appreciated.  

By the way, what is meant by an X Program?   How to run an X Program??

Thanks & Regards,
Top Expert 2006

Commented:
you are correctly running the program ....  it is the executable which is faulty

renaming it to .c would not help

if you wish to run it, you will have to get its source code and debug the source code and then recompile it

as of now, the executable is a compiled incorrect program

Commented:
I can give a certain answer to that, since I don't have the source code, but it seems that vfprintf is trying to access a FILE * stream that does not exist. Either it was never opened or it was closed before the call of vfprintf. Bad programming. Taugh luck. Maybe you should address to the programm's develloper.

Author

Commented:
Hi Sunnycoder,

I accept your comments for the ELF 32-bit LSB Executable file too.

Regards,


Top Expert 2006

Commented:
In that case, you should have used the point split feature ... it allows you to accept more than one answers

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial