diff options
author | Paul Guyot <[email protected]> | 2010-07-06 23:48:48 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2010-08-27 13:31:57 +0200 |
commit | c04218394fdf84468b1163c4c832d64071bbc798 (patch) | |
tree | 6cef2678aa6d6ed3391a869d6e332db1004bf6b5 /lib/docbuilder/src | |
parent | 91078fbc7b0719150a0c7749a1de9e5c0c9bbdeb (diff) | |
download | otp-c04218394fdf84468b1163c4c832d64071bbc798.tar.gz otp-c04218394fdf84468b1163c4c832d64071bbc798.tar.bz2 otp-c04218394fdf84468b1163c4c832d64071bbc798.zip |
Fix segmentation fault when dumping the crash log with hipe enabled and natively compiled modules
When loading a module, code area is allocated and header fields
code[MI_ATTR_SIZE] as well as code[MI_COMPILE_SIZE] are not
cleared. They are only set later when freeze_code is called, if the
module has attributes and compilation info, which should always be the
case. When loading a native module (as a stub), code is allocated as
well (to contain the stub functions), and code[MI_ATTR_SIZE] as well
as code[MI_COMPILE_SIZE] are not cleared either. Yet, freeze_code will
not be called (since there is no threaded code to freeze for native
modules), and as a result, these header fields are never set. They can
contain any garbage.
Later on, when writing a crash dump, the attributes and compilation
info are dumped, using these particular header fields. If the size is
garbage, the dump attribute function will iterate until it segfaults.
The fix consists in clearing code[MI_ATTR_SIZE] and
code[MI_COMPILE_SIZE] in both cases (threaded code and native
code). Even if non-native modules should contain code and attributes
and therefore the values code[MI_ATTR_SIZE] and code[MI_COMPILE_SIZE]
should be set by freeze_code, it seems cleaner and easier to maintain
to clear the whole the header in the "initialize code area"
section. As a result, crash dump will not segfault. Instead, native
modules will have an empty attributes and compilation info section in
the crash dump.
Diffstat (limited to 'lib/docbuilder/src')
0 files changed, 0 insertions, 0 deletions