Review/testing request: changing the detection of
data_addr/text_addr
Nathan Whitehorn
nwhitehorn at freebsd.org
Wed Mar 24 19:29:26 UTC 2010
We currently detect the offical "text" and "data" addresses for ELF
files in kern/imgact_elf.c by the heuristic of calling whichever section
contains the executable's entry point the text section and everything
else data. In general, both this concept and the very few things that
use them are obsolete and rare. The data addresses are, however, used in
obreak() to find the current break. On powerpc64, this logic fails,
because the entry point points to a function descriptor in the data
section, causing sbrk() to fail, which in turn breaks profiling.
The patch at http://people.freebsd.org/~nwhitehorn/textseg.diff changes
this algorithm to make the official text area be the largest executable
segment, and all others data. The patch has been tested on sparc64,
amd64, powerpc, and (of course) powerpc64, with no evident bad effects.
I would appreciate any comments, as well as tests on other
architectures. The main symptom of getting these values wrong is that
sbrk() stops working correctly, so I have put a simple test program for
sbrk() at http://people.freebsd.org/~nwhitehorn/sbrktest.c.
-Nathan
More information about the freebsd-hackers
mailing list