From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2933 invoked by alias); 19 Feb 2013 02:09:41 -0000 Received: (qmail 2872 invoked by uid 22791); 19 Feb 2013 02:09:40 -0000 X-SWARE-Spam-Status: No, hits=-7.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 19 Feb 2013 02:09:30 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1J29SUq025226 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 18 Feb 2013 21:09:28 -0500 Received: from [10.3.113.98] (ovpn-113-98.phx2.redhat.com [10.3.113.98]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r1J29RGx023248; Mon, 18 Feb 2013 21:09:27 -0500 Message-ID: <5122DED7.9040104@redhat.com> Date: Tue, 19 Feb 2013 02:09:00 -0000 From: Josh Stone User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Dave Cameron CC: systemtap@sourceware.org Subject: Re: eh_frame table too big References: <20130219123825.365291d5@tink.daverabbitz.ath.cx> In-Reply-To: <20130219123825.365291d5@tink.daverabbitz.ath.cx> Content-Type: multipart/mixed; boundary="------------000508000702020905020302" X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2013-q1/txt/msg00145.txt.bz2 This is a multi-part message in MIME format. --------------000508000702020905020302 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 1007 On 02/18/2013 03:38 PM, Dave Cameron wrote: > I'm trying to run a systemtap script on Firefox, but I get the > following warning when I invoke systemtap like: > > stap firefox.stap -d /lib64/libpthread-2.15.so \ > -d /usr/lib64/firefox/libmozsqlite3.so \ > -d /usr/lib64/firefox/libxul.so -d /usr/lib64/firefox/firefox \ > -x `pidof firefox` > > WARNING: skipping module /usr/lib64/firefox/libxul.so eh_frame table (too big: 6812836 > 6291456 > > - > > Also after this probe compiled and loaded, I got a kpanic, > which I was unable to capture, but I will try to reproduce. We definitely need to address that! I think I found a place where the unwind table is not completely skipped, possibly leading to bad memory references. I'd appreciate if you could try the attached patch (while the max is still set too low for you). > How can I bump this limit? This is MAX_UNWIND_TABLE_SIZE in translate.cxx, currently set to 6MB. We have bumped this before for libxul.so, and can do so again. Josh --------------000508000702020905020302 Content-Type: text/x-patch; name="0001-Don-t-output-anything-at-all-for-skipped-unwind-tabl.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Don-t-output-anything-at-all-for-skipped-unwind-tabl.pa"; filename*1="tch" Content-length: 7494 >From dba320e01beda47a117cefafebc4558369fcbd0e Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 18 Feb 2013 17:55:46 -0800 Subject: [PATCH] Don't output anything at all for skipped unwind tables * translate.cxx (dump_unwindsym_cxt_table): New common function to output an unwind table. It checks against MAX_UNWIND_TABLE_SIZE and nulls out those that are skipped, so they're truly skipped everywhere. (dump_unwindsym_cxt): Use dump_unwindsym_cxt_table for all four unwind tables: debug_frame, debug_frame_hdr, eh_frame, and eh_frame_hdr. --- translate.cxx | 144 ++++++++++++++++++++-------------------------------------- 1 file changed, 50 insertions(+), 94 deletions(-) diff --git a/translate.cxx b/translate.cxx index 898a52d..102e7c3 100644 --- a/translate.cxx +++ b/translate.cxx @@ -5900,6 +5900,47 @@ dump_unwind_tables (Dwfl_Module *m, return DWARF_CB_OK; } +static void +dump_unwindsym_cxt_table(systemtap_session& session, ostream& output, + const string& modname, unsigned modindex, + const string& secname, unsigned secindex, + const string& table, void*& data, size_t& len) +{ + if (data == NULL || len == 0) + return; + + if (len > MAX_UNWIND_TABLE_SIZE) + { + if (secname.empty()) + session.print_warning (_F("skipping module %s %s table (too big: %zi > %zi)", + modname.c_str(), table.c_str(), + len, (size_t)MAX_UNWIND_TABLE_SIZE)); + else + session.print_warning (_F("skipping module %s, section %s %s table (too big: %zi > %zi)", + modname.c_str(), secname.c_str(), table.c_str(), + len, (size_t)MAX_UNWIND_TABLE_SIZE)); + data = NULL; + len = 0; + return; + } + + output << "#if defined(STP_USE_DWARF_UNWINDER) && defined(STP_NEED_UNWIND_DATA)\n"; + output << "static uint8_t _stp_module_" << modindex << "_" << table; + if (!secname.empty()) + output << "_" << secindex; + output << "[] = \n"; + output << " {"; + for (size_t i = 0; i < len; i++) + { + int h = ((uint8_t *)data)[i]; + output << h << ","; // decimal is less wordy than hex + if ((i + 1) % 16 == 0) + output << "\n" << " "; + } + output << "};\n"; + output << "#endif /* STP_USE_DWARF_UNWINDER && STP_NEED_UNWIND_DATA */\n"; +} + static int dump_unwindsym_cxt (Dwfl_Module *m, unwindsym_dump_context *c, @@ -5919,76 +5960,15 @@ dump_unwindsym_cxt (Dwfl_Module *m, Dwarf_Addr eh_addr = c->eh_addr; Dwarf_Addr eh_frame_hdr_addr = c->eh_frame_hdr_addr; - if (debug_frame != NULL && debug_len > 0) - { - 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"; - c->output << " {"; - if (debug_len > MAX_UNWIND_TABLE_SIZE) - { - c->session.print_warning ("skipping module " + modname + " debug_frame unwind table (too big: " + - lex_cast(debug_len) + " > " + lex_cast(MAX_UNWIND_TABLE_SIZE) + ")"); - } - else - for (size_t i = 0; i < debug_len; i++) - { - int h = ((uint8_t *)debug_frame)[i]; - c->output << h << ","; // decimal is less wordy than hex - if ((i + 1) % 16 == 0) - c->output << "\n" << " "; - } - c->output << "};\n"; - c->output << "#endif /* STP_USE_DWARF_UNWINDER && STP_NEED_UNWIND_DATA */\n"; - } + dump_unwindsym_cxt_table(c->session, c->output, modname, stpmod_idx, "", 0, + "debug_frame", debug_frame, debug_len); - if (eh_frame != NULL && eh_len > 0) - { - 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"; - c->output << " {"; - if (eh_len > MAX_UNWIND_TABLE_SIZE) - { - c->session.print_warning ("skipping module " + modname + " eh_frame table (too big: " + - lex_cast(eh_len) + " > " + lex_cast(MAX_UNWIND_TABLE_SIZE) + ")"); - } - else - for (size_t i = 0; i < eh_len; i++) - { - int h = ((uint8_t *)eh_frame)[i]; - c->output << h << ","; // decimal is less wordy than hex - if ((i + 1) % 16 == 0) - c->output << "\n" << " "; - } - c->output << "};\n"; - c->output << "#endif /* STP_USE_DWARF_UNWINDER && STP_NEED_UNWIND_DATA */\n"; - } + dump_unwindsym_cxt_table(c->session, c->output, modname, stpmod_idx, "", 0, + "eh_frame", eh_frame, eh_len); + + dump_unwindsym_cxt_table(c->session, c->output, modname, stpmod_idx, "", 0, + "eh_frame_hdr", eh_frame_hdr, eh_frame_hdr_len); - if (eh_frame_hdr != NULL && eh_frame_hdr_len > 0) - { - 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_hdr[] = \n"; - c->output << " {"; - if (eh_frame_hdr_len > MAX_UNWIND_TABLE_SIZE) - { - c->session.print_warning (_F("skipping module %s eh_frame_hdr table (too big: %s > %s)", - modname.c_str(), lex_cast(eh_frame_hdr_len).c_str(), - lex_cast(MAX_UNWIND_TABLE_SIZE).c_str())); - } - else - for (size_t i = 0; i < eh_frame_hdr_len; i++) - { - int h = ((uint8_t *)eh_frame_hdr)[i]; - c->output << h << ","; // decimal is less wordy than hex - if ((i + 1) % 16 == 0) - c->output << "\n" << " "; - } - c->output << "};\n"; - c->output << "#endif /* STP_USE_DWARF_UNWINDER && STP_NEED_UNWIND_DATA */\n"; - } - if (c->session.need_unwind && debug_frame == NULL && eh_frame == NULL) { // There would be only a small benefit to warning. A user @@ -6035,32 +6015,8 @@ dump_unwindsym_cxt (Dwfl_Module *m, if (secname == ".dynamic" || secname == ".absolute" || secname == ".text" || secname == "_stext") { - if (debug_frame_hdr != NULL && debug_frame_hdr_len > 0) - { - 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_hdr_" << secidx << "[] = \n"; - c->output << " {"; - if (debug_frame_hdr_len > MAX_UNWIND_TABLE_SIZE) - { - c->session.print_warning (_F("skipping module %s, section %s debug_frame_hdr" - " table (too big: %s > %s)", modname.c_str(), - secname.c_str(), lex_cast(debug_frame_hdr_len).c_str(), - lex_cast(MAX_UNWIND_TABLE_SIZE).c_str())); - } - else - for (size_t i = 0; i < debug_frame_hdr_len; i++) - { - int h = ((uint8_t *)debug_frame_hdr)[i]; - c->output << h << ","; // decimal is less wordy than hex - if ((i + 1) % 16 == 0) - c->output << "\n" << " "; - } - c->output << "};\n"; - c->output << "#endif /* STP_USE_DWARF_UNWINDER" - << " && STP_NEED_UNWIND_DATA */\n"; - } + dump_unwindsym_cxt_table(c->session, c->output, modname, stpmod_idx, secname, secidx, + "debug_frame_hdr", debug_frame_hdr, debug_frame_hdr_len); } } -- 1.8.1.2 --------------000508000702020905020302--