Compiling on a different cpu

General chat concerning linux or linuxzoo.

Moderator: drgrussell

Post Reply
Posts: 1
Joined: Sun Jul 05, 2015 8:49 pm
Are you a robot or a human?: Human

Compiling on a different cpu

Post by xxc3nsoredxx » Sun Jul 05, 2015 9:11 pm

I wrote (copied) a simple C program from a YouTube tutorial about buffer overflow and it needs to be compiled as 32 bit not 64. I learned through trial and error that the kali image is 64 bit and the gcc it has doesn't accept the -m32 flag to compile as 32 bit. Because of this, I compiled on a different machine and sftp'd the compiled program to my linuxzoo. When I do

Code: Select all

chmod 777 bo_aslr_off
to make it executable, it gives me a bash error along the lines of

Code: Select all

Error: ./bo_aslr_off is not a file or directory.
(sorry it's not a direct quote, I'm not logged in to linuxzoo to see what it is right now).

The exact compiler command I used on a different ssh server is

Code: Select all

gcc bo_aslr_off.c -fno-stack-protector -m32 -o bo_aslr_off
. The reason I don't do the tutorial on the other server is that I don't have access to root, gdb, python, and other usefull tools.

I did some googling and some command line magic to figure out that linixzoo uses a QEMU Virtual CPU, the problem is that the other server uses intel and I have no idea what -march or -mtune flag to give gcc to make it work on QEMU Virtual CPU. Atleast I think that that's the problem, as the program ran fine on the other server (It's not a coding error).

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests