diff options
author | Mark Wielaard <mjw@redhat.com> | 2009-10-20 12:38:55 +0200 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2009-10-20 12:38:55 +0200 |
commit | c42e2d2e1a9e8c09a435089ce351e1d36309dd9b (patch) | |
tree | d3bdd5fc1d22628386202a1eea3451dafaa0d2c3 /translate.cxx | |
parent | f10d126854eec887ddef18b1d04a8b5ec6505d65 (diff) | |
download | systemtap-steved-c42e2d2e1a9e8c09a435089ce351e1d36309dd9b.tar.gz systemtap-steved-c42e2d2e1a9e8c09a435089ce351e1d36309dd9b.tar.xz systemtap-steved-c42e2d2e1a9e8c09a435089ce351e1d36309dd9b.zip |
Add limit on unwind table size we accept.
* translate.cxx (MAX_UNWIND_TABLE_SIZE): New define.
(dump_unwindsyms): Check debug_len and eh_len against new limit.
Diffstat (limited to 'translate.cxx')
-rw-r--r-- | translate.cxx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/translate.cxx b/translate.cxx index bc5d6158..9d456bca 100644 --- a/translate.cxx +++ b/translate.cxx @@ -29,6 +29,11 @@ extern "C" { #include <elfutils/libdwfl.h> } +// Max unwind table size (debug or eh) per module. Somewhat arbitrary +// limit (a bit more than twice the .debug_frame size of my local +// vmlinux for 2.6.31.4-83.fc12.x86_64) +#define MAX_UNWIND_TABLE_SIZE (3 * 1024 * 1024) + using namespace std; struct var; @@ -4785,6 +4790,9 @@ dump_unwindsyms (Dwfl_Module *m, get_unwind_data (m, &debug_frame, &eh_frame, &debug_len, &eh_len, &eh_addr); if (debug_frame != NULL && debug_len > 0) { + if (debug_len > MAX_UNWIND_TABLE_SIZE) + throw semantic_error ("module debug unwind table size too big"); + c->output << "#if defined(STP_USE_DWARF_UNWINDER) && defined(STP_NEED_UNWIND_DATA)\n"; c->output << "static uint8_t _stp_module_" << stpmod_idx << "_debug_frame[] = \n"; @@ -4802,6 +4810,9 @@ dump_unwindsyms (Dwfl_Module *m, if (eh_frame != NULL && eh_len > 0) { + if (eh_len > MAX_UNWIND_TABLE_SIZE) + throw semantic_error ("module eh unwind table size too big"); + c->output << "#if defined(STP_USE_DWARF_UNWINDER) && defined(STP_NEED_UNWIND_DATA)\n"; c->output << "static uint8_t _stp_module_" << stpmod_idx << "_eh_frame[] = \n"; |