It doesn't seem like a really good idea to try and distinguish between
the various parts of an ELF file. The settings in the phdrs are only
advisory initial conditions: it would be easy to make a program which
had a large array in the "read-only" text section, which it makes
writable with mprotect(). The distinction between different parts of
a process address space are arbitary and have no real meaning except
by convention; there's no way to make hard and fast policy descisions
on that basis (that is, the distinction between "text usage" and "data
usage" is meaningless; there's only memory usage).
On the other hand, it should be OK as an early heuristic. However,
do_wp_page() should check the memory limit when it adds a new page
to the process address space.
J