>>>>"NF" == Nelson Ferreira
<nelson.ferreira(a)ieee.org> writes:
NF> Has anyone else managed to
successfully build XEmacs 21.5 under MacOS X
NF> Lion ?
NF> (PS: I did this following similar crash with SXEmacs, so I suspect some
NF> bad influence of Lion on pdump...)
I finally upgraded to Lion and had a look at the problem.
"Address space layout randomization" (ASLR) that Apple has "improved"
in
Lion [1] causes the problem with the portable dumper: The dump file
contains addresses into the address space of the process, e.g. to global
variables that hold parts of the root set or to memory descriptions.
ASLR in Lion randomizes the addresses in the address space of the
process on every program run, thus the addresses that are stored in the
dump file are no longer valid.
My approach to fixing this is the following: Store the address of a
global variable in the dump file. When loading the dump file, calculate
the difference to the now valid address of the same global variable and
use this difference to adjust every address from the dump file that
points into the process' address space. As long as Lion randomizes
every address linearly, this should work.
The attached patch takes the first steps in this direction: The dumper
can load and relocate the dump file under Lion without crashing. But
XEmacs still crashes at a later point, due to remaining invalid pointers
that have not yet been caught by the changes I have made to the dumper.
Pointers that need to be fixed are possibly
- ... in every Lisp_Object (e.g. the ones that contain pointers to
C functions),
- ... in every non-Lisp-Object data structure that is included in the
dump file with `dump_add_opaque' (e.g. lrecord_implementations_table,
lrecord_memory_descriptions, ...),
- ... in many other dumped data structures that I haven't even thought
of yet.
Since this leads to a lot of work, I'd like to get your feedback on my
approach and the next steps that I think are needed to get this working:
- Add a new memory description type for that kind of addresses.
- When the dumper sees such a memory description type while loading
the dump file, it adjusts the corresponding address.
- Write memory descriptions for everything that is dumped via
`dump_add_opaque'.
- Review all Lisp_Objects and update their memory descriptions if they
contain addresses into the address space of the process.
- Figure out what other data structures are stored in the dump file and
add memory descriptions for these as well.
It is going to take us a while to implement all this stuff.
Is there another (easier) solution or a shortcut that I've missed?
Is this problem really so hard to fix?
Footnotes:
[1]
http://www.apple.com/macosx/whats-new/features.html#security
--
Marcus
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta