0

Here is a dump from a.out

STACK off 0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**2 filesz 0x00000000 memsz 0x00000000 flags rwx

Why does a stack segment have executable attribute?

Why isn't there a heap segment with rw- attribute?

//On ubuntu 32bit machine. Program is a simple hello world.

Command: ld test.o startup.s; objdump -dhSxt -M intel-pneumonic a.out //startup.s has a small assembly code with _start symbol which calls main and exits after main returns.

4
  • You'll need to give your compiler flags and the command you're running. Commented Mar 31, 2013 at 15:18
  • @teppic nothing special. just gcc test.c; Added that to Q. Commented Mar 31, 2013 at 15:58
  • The stack is allowed to be executable, but I'm surprised it's a default. On my copy of Ubuntu it isn't. Commented Mar 31, 2013 at 17:39
  • @teppic, I apologize. the actual command I used was ld test.o startup.s, where I had assembly code with _startup symbol. There is some context here - airs.com/blog/archives/518 Commented Apr 1, 2013 at 4:56

1 Answer 1

1

Command: gcc test.c

Try gcc test.c -Wl,-z,noexecstack.

That should be the default on any reasonably modern distribution.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.