Skip to contentSkip to conversation

Non-Exec stack patches

DISCUSSION Andi Kleen 2 participants 2 messages Mar 24, 2004 11 messages not in the archive

lore
Share & tools
lore

Andi Kleen

author
#11 lore raw
In reply to a message not in the archive
Quoted 4 lines · Jakub Jelinek

Nope. Think about multithreaded apps. Furthermore, getting the exact extents of the particular stack is difficult to find for applications, but e.g. the threading library has to know such things.

It's actually not that difficult. You just have to read /proc/self/maps and check for the mapping of your current stack pointer.
For the main stack GROWSDOWN will inherit the x or nx on growing down.

And cache a flag about this in a TLS variable.

-Andi

#12 lore raw
Quoted 4 lines · Andi Kleen

It's actually not that difficult. You just have to read /proc/self/maps and check for the mapping of your current stack pointer.
For the main stack GROWSDOWN will inherit the x or nx on growing down.

That assumes there are always gaps around thread stacks, which doesn't have to be true. You could make executable some other mapping as well easily.

Jakub