Why a stack with exec flag?

From: Stephane Chauveau (s.chauveau@chello.nl)
Date: 06/05/02


From: Stephane Chauveau <s.chauveau@chello.nl>
Date: Wed, 05 Jun 2002 16:43:29 GMT


Hi,
I noticed that on Linux-x86, the stack is mapped with "rwx" flags.
Other parts of memory usually have "r-x" for code and "rw-" for data.

For example, this is the memory map of a simple program.
The stack memory is in bfffe000-c0000000:

08048000-08049000 r-xp 00000000 03:05 130937 /home/chauveau/test/a.out
08049000-0804a000 rw-p 00000000 03:05 130937 /home/chauveau/test/a.out
40000000-40013000 r-xp 00000000 03:02 18361 /lib/ld-2.2.5.so
40013000-40014000 rw-p 00013000 03:02 18361 /lib/ld-2.2.5.so
40020000-40133000 r-xp 00000000 03:02 19419 /lib/libc-2.2.5.so
40133000-40139000 rw-p 00113000 03:02 19419 /lib/libc-2.2.5.so
40139000-4013d000 rw-p 00000000 00:00 0
bfffe000-c0000000 rwxp fffff000 00:00 0

Is there a good reason to allow execution in the stack?
Is it possible to change that to prevent attacks via buffer overflow?

Stephane Chauveau.



Relevant Pages

  • Why a stack with exec flag?
    ... the stack is mapped with "rwx" flags. ... this is the memory map of a simple program. ...
    (comp.os.linux.security)
  • Re: Why a stack with exec flag?
    ... this is the memory map of a simple program. ... > Is there a good reason to allow execution in the stack? ... Changing flags on a page to something ... int func ...
    (comp.os.linux.security)
  • Re: Why a stack with exec flag?
    ... this is the memory map of a simple program. ... > Is there a good reason to allow execution in the stack? ... Changing flags on a page to something ... int func ...
    (comp.os.linux.security)
  • TS1000 / ZX81 Rom changes
    ... The new memory map would look like: ... System Variables ... Calculator Stack ... Edit line + work space ...
    (comp.sys.sinclair)
  • Re: News from the wooden hut (n/m with n < m)
    ... I am going to be lazy and ask, ... memory map the same as 6502? ... provided stack is 4 bytes large, your program is better managing his own ... your program origin could be anywhere, ...
    (comp.sys.apple2)