Jeffrey Walton <noloader@xxxxxxxxx> writes: > I'm looking for reading on PT_GNU_STACK and PT_GNU_HEAP. The Gentoo > documentation I have seen states GCC will add PT_GNU_STACK and > PT_GNU_HEAP markings to the binary if compiled from non-asm files. If > compiling ASM files, the markings are not added. The docs also state > PaX ignores the markings (PaX offers no-execute plus more). > > Other than Gentoo documentation, I'm not finding much reading on GCC > and PT_GNU_STACK and PT_GNU_HEAP. I described PT_GNU_STACK here: http://www.airs.com/blog/archives/518 . I believe that PT_GNU_HEAP is a Gentoo extension. I'm not aware of it existing on any other system. Gentoo appears to handle PT_GNU_HEAP just like PT_GNU_STACK, with a .note.GNU-heap section. The heap is of course normally not executable. I assume that the presence of a PT_GNU_HEAP segment without executable permission means that the kernel denies attempts to call mprotect to mark the heap as executable. But I'm just guessing--I don't know for sure. I don't see any use of PT_GNU_HEAP in the Linux kernel sources I have lying around. Ian