From: Mark Wielaard Date: Tue, 20 Oct 2009 10:38:55 +0000 (+0200) Subject: Add limit on unwind table size we accept. X-Git-Tag: release-1.0.9~83^2~25^2~3 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=c42e2d2e1a9e8c09a435089ce351e1d36309dd9b;p=systemtap.git 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. --- diff --git a/translate.cxx b/translate.cxx index bc5d6158e..9d456bca6 100644 --- a/translate.cxx +++ b/translate.cxx @@ -29,6 +29,11 @@ extern "C" { #include } +// 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";