public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] runtime/unwind: Allow to increase MAX_CFI
@ 2018-11-27 21:37 Torsten Polle
  2018-11-29 18:06 ` Mark Wielaard
  0 siblings, 1 reply; 4+ messages in thread
From: Torsten Polle @ 2018-11-27 21:37 UTC (permalink / raw)
  To: systemtap

[-- Attachment #1: Type: text/plain, Size: 143 bytes --]

Hi,

As discussed this patch allows to define the limit of CFIs to a higher value in case the limit is too low.

Kind Regards,
Torsten


[-- Attachment #2: 0001-runtime-unwind-Allow-to-increase-MAX_CFI.patch --]
[-- Type: application/octet-stream, Size: 1019 bytes --]

From 2910b218662b222ac44f6ffb558044bc261459c5 Mon Sep 17 00:00:00 2001
From: Torsten Polle <Torsten.Polle@gmx.de>
Date: Tue, 27 Nov 2018 22:15:44 +0100
Subject: [PATCH] runtime/unwind: Allow to increase MAX_CFI

As the limit MAX_CFI is an arbitrary value, the value might need to be
changed by an external definition (e.g. -DMAX_CFI=8192).

Acked-by: Torsten Polle <Torsten.Polle@gmx.de>
---
 runtime/unwind.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/runtime/unwind.c b/runtime/unwind.c
index 6e1d740..f3ae7d3 100644
--- a/runtime/unwind.c
+++ b/runtime/unwind.c
@@ -293,7 +293,9 @@ static void set_expr_rule(uleb128_t reg, enum item_location where,
 
 /* Limit the number of instructions we process. Arbitrary limit.
    512 should be enough for anybody... */
+#ifndef MAX_CFI
 #define MAX_CFI 512
+#endif
 
 static int processCFI(const u8 *start, const u8 *end, unsigned long targetLoc,
 		      signed ptrType, int user, struct uw_state *state, int compat_task)
-- 
2.7.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] runtime/unwind: Allow to increase MAX_CFI
  2018-11-27 21:37 [PATCH] runtime/unwind: Allow to increase MAX_CFI Torsten Polle
@ 2018-11-29 18:06 ` Mark Wielaard
  2018-11-29 21:12   ` Torsten Polle
       [not found]   ` <FCB2E3ED-C261-46D0-AB9C-76EA3AA20083@gmx.de>
  0 siblings, 2 replies; 4+ messages in thread
From: Mark Wielaard @ 2018-11-29 18:06 UTC (permalink / raw)
  To: Torsten Polle; +Cc: systemtap

Hi Torsten,

On Tue, Nov 27, 2018 at 10:37:08PM +0100, Torsten Polle wrote:
> As discussed this patch allows to define the limit of CFIs to a higher value in case the limit is too low.

Thanks, applied to git master.

I am still curious what program/library defines more than 512 CFI
instructions. If you could post some example of eu-readelf --debug-dump=frame
that would be interesting. I assume it must be some really big
functions that haven't been split up?

Cheers,

Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] runtime/unwind: Allow to increase MAX_CFI
  2018-11-29 18:06 ` Mark Wielaard
@ 2018-11-29 21:12   ` Torsten Polle
       [not found]   ` <FCB2E3ED-C261-46D0-AB9C-76EA3AA20083@gmx.de>
  1 sibling, 0 replies; 4+ messages in thread
From: Torsten Polle @ 2018-11-29 21:12 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: systemtap

Hi Mark,

> Am 29.11.2018 um 19:06 schrieb Mark Wielaard <mark@klomp.org>:
> 
> Hi Torsten,
> 
> On Tue, Nov 27, 2018 at 10:37:08PM +0100, Torsten Polle wrote:
>> As discussed this patch allows to define the limit of CFIs to a higher value in case the limit is too low.
> 
> Thanks, applied to git master.

Thanks.

> I am still curious what program/library defines more than 512 CFI
> instructions. If you could post some example of eu-readelf --debug-dump=frame
> that would be interesting. I assume it must be some really big
> functions that haven't been split up?

I’m working on it. But it’s not that trivial. I included tons of libraries with the '-d' option and have to identify the one(s) that is (are) causing the warnings.

> Cheers,
> Mark

Regards,
Torsten

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] runtime/unwind: Allow to increase MAX_CFI
       [not found]   ` <FCB2E3ED-C261-46D0-AB9C-76EA3AA20083@gmx.de>
@ 2018-11-30 22:47     ` Mark Wielaard
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Wielaard @ 2018-11-30 22:47 UTC (permalink / raw)
  To: Torsten Polle; +Cc: systemtap

Hi Torsten,
[Sorry for the duplicate, I said I would CC the list, then forgot...]

On Fri, Nov 30, 2018 at 10:31:11PM +0100, Torsten Polle wrote:
> > Am 29.11.2018 um 19:06 schrieb Mark Wielaard <mark@klomp.org>:
> > I am still curious what program/library defines more than 512 CFI
> > instructions. If you could post some example of eu-readelf --debug-dump=frame
> > that would be interesting. I assume it must be some really big
> > functions that haven't been split up?
> 
> PFA the dump. As it is even compressed more than 2 MB, I just send it to you and not to the mailing list.

Wow, I had no idea. That is indeed huge. I inspected it and include the
mailinglist again so there is a bit of a record.

> This is the output of unwind.c with slightly modified messages.
> 
> unwind_frame:1291: processCFI for CIE: /usr/lib/libgtk-3.so.0.2000.9
> unwind_frame:1299: processCFI for FDE
> processCFI:312: Too many CFI instuctions: 5547
> 
> This is the first part backtrace.
> 0x4a8aa:libglib-2.0.so.0.4800.2:0xca2c:libgobject-2.0.so.0.4800.2:0xdf68:libgobject-2.0.so.0.4800.2:0x230c9:libgobject-2.0.so.0.4800.2:0x359d25:libgtk-3.so.0.2000.9

So 5547 is more than a factor 10 bigger than the current 512 limit.
Looking through the dump I see this must be either gtk_widget_class_init
or gtk_settings_class_intern_init. Both have a really big CFI descriptions.

I see the same in my local /usr/lib64/libgtk-3.so.0.2400.1 library.
Both functions seem to be just very long initialization sequnces.

Maybe we should increase the MAX_CFI by default.
But processing so many CFI instructions is resource intensive.
Maybe we should have a better way to just skip frames with
such complicated CFI.

Thanks,

Mark


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-11-30 22:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-27 21:37 [PATCH] runtime/unwind: Allow to increase MAX_CFI Torsten Polle
2018-11-29 18:06 ` Mark Wielaard
2018-11-29 21:12   ` Torsten Polle
     [not found]   ` <FCB2E3ED-C261-46D0-AB9C-76EA3AA20083@gmx.de>
2018-11-30 22:47     ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).