dwarves.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* dwarf_loader.c: Fixed leaked bogon
@ 2010-01-06 15:24 Rakesh Pandit
       [not found] ` <b401d2531001060724r4a06401fx9cc8a5dbf24518d3-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Rakesh Pandit @ 2010-01-06 15:24 UTC (permalink / raw)
  To: dwarves-u79uwXL29TY76Z2rM5mHXA

While checking one of big shared objects I found kernel getting
unhappy and sending SIGKILL. File was 282M libwebkit-1.0.so.2.8.1 from
webkit project. (Can be obtained from
http://kojipkgs.fedoraproject.org/packages/webkitgtk/1.1.12/2.fc12/x86_64/webkitgtk-debuginfo-1.1.12-2.fc12.x86_64.rpm
and extracted via rpm2cpio, file is libwebkit-1.0.so.2.8.1.debug)

URL: http://rakesh.fedorapeople.org/misc/0001-dwarf_loader.c-Fixed-leaked-bogon.patch

-- 
Rakesh Pandit
https://fedoraproject.org/wiki/User:Rakesh
freedom, friends, features, first

From 897af23e9c66a74a27fc7a4b60567bc92163d066 Mon Sep 17 00:00:00 2001
From: Rakesh Pandit <rakesh-rxtnV0ftBwyoClj4AeEUq9i2O/JbrIOy@public.gmane.org>
Date: Wed, 6 Jan 2010 20:34:03 +0530
Subject: [PATCH] dwarf_loader.c: Fixed leaked bogon

Freed chunks of memory left by obstack. It went beyond kernels
expectation for libwebkit-1.0.so.2.debug (from
libwebkit-1.0.so.2.8.1.debug) file and so that it had to send SIGKILL.

Signed-off-by: Rakesh Pandit <rakesh-rxtnV0ftBwyoClj4AeEUq9i2O/JbrIOy@public.gmane.org>
---
 dwarf_loader.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/dwarf_loader.c b/dwarf_loader.c
index 3b58ecb..ce1e4d8 100644
--- a/dwarf_loader.c
+++ b/dwarf_loader.c
@@ -2052,9 +2052,7 @@ static int cus__load_module(struct cus *self,
struct conf_load *conf,
 			}
 		}

-		if (!cu->extra_dbg_info)
-			obstack_free(&dcu.obstack, NULL);

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

* Re: dwarf_loader.c: Fixed leaked bogon
       [not found] ` <b401d2531001060724r4a06401fx9cc8a5dbf24518d3-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-01-06 16:44   ` Arnaldo Carvalho de Melo
       [not found]     ` <20100106164444.GB18919-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-01-06 16:44 UTC (permalink / raw)
  To: Rakesh Pandit; +Cc: dwarves-u79uwXL29TY76Z2rM5mHXA

Em Wed, Jan 06, 2010 at 08:54:59PM +0530, Rakesh Pandit escreveu:
> While checking one of big shared objects I found kernel getting
> unhappy and sending SIGKILL. File was 282M libwebkit-1.0.so.2.8.1 from
> webkit project. (Can be obtained from
> http://kojipkgs.fedoraproject.org/packages/webkitgtk/1.1.12/2.fc12/x86_64/webkitgtk-debuginfo-1.1.12-2.fc12.x86_64.rpm
> and extracted via rpm2cpio, file is libwebkit-1.0.so.2.8.1.debug)
> 
> URL: http://rakesh.fedorapeople.org/misc/0001-dwarf_loader.c-Fixed-leaked-bogon.patch

What is the exact command line you are using? You cannot destroy that
obstack if you really will use the extra debugging info that is has
many pointers that will point to some other info if you destroy it.

By default cu->extra_dbg_info is false, it only is true if set
explicitely by one of the tools, like:

[acme@doppio pahole]$ grep extra_dbg_info *.c
dwarf_loader.c:	if (cu->extra_dbg_info) {
dwarf_loader.c:	return cu->extra_dbg_info ?
dwarf_loader.c:	return cu->extra_dbg_info ? dtag->decl_line : 0;
dwarf_loader.c:	return cu->extra_dbg_info ? dtag->id : 0;
dwarf_loader.c:	return cu->extra_dbg_info ? dtag->type : 0;
dwarf_loader.c:		cu->extra_dbg_info = conf ? conf->extra_dbg_info : 0;
dwarf_loader.c:		if (!cu->extra_dbg_info)
dwarves.c:		self->extra_dbg_info = 0;
pahole.c:		  conf_load.extra_dbg_info = 1;		break;
pahole.c:		  conf_load.extra_dbg_info = 1;		break;
pahole.c:		  conf_load.extra_dbg_info = 1;		break;
pfunct.c:		  conf_load.extra_dbg_info = true;
pfunct.c:		  conf_load.extra_dbg_info = 1;		 break;
pfunct.c:		  conf_load.extra_dbg_info = true;
[acme@doppio pahole]$

pahole and pfunct, and inpahole, assuming it is the one you are using:

                .name = "decl_exclude",
                .key  = 'D',
                .arg  = "PREFIX",
                .doc  = "exclude classes declared in files with PREFIX",

        case 'D': decl_exclude_prefix = arg;
                  decl_exclude_prefix_len = strlen(decl_exclude_prefix);
                  conf_load.extra_dbg_info = 1;         break;

                .name = "show_decl_info",
                .key  = 'I',
                .doc  = "Show the file and line number where the tags were defined"

        case 'I': conf.show_decl_info = 1;
                  conf_load.extra_dbg_info = 1;         break;

                .name = "packable",
                .key  = 'P',
                .doc  = "show only structs that has holes that can be packed",

        case 'P': show_packable = 1;
                  conf_load.extra_dbg_info = 1;         break;


The only seemingly "strange" case above is --packable, that I bet is
what you're using, where it needs the extra debug info because for
anonymous structs it shows in which file and line the struct is, and
that is only available from the DWARF info.

Can you try the following patch to see if the problem goes away? We may
want to just enable extra_dbg_info in this case if used with --verbose,
something like that.

Regards,

- Arnaldo

diff --git a/pahole.c b/pahole.c
index 5dad6c2..24845cd 100644
--- a/pahole.c
+++ b/pahole.c
@@ -1000,8 +1000,7 @@ static error_t pahole__options_parser(int key, char *arg,
 	case 'm': stats_formatter = nr_methods_formatter; break;
 	case 'N': formatter = class_name_len_formatter;	break;
 	case 'n': formatter = nr_members_formatter;	break;
-	case 'P': show_packable	= 1;
-		  conf_load.extra_dbg_info = 1;		break;
+	case 'P': show_packable	= 1;			break;
 	case 'p': conf.expand_pointers = 1;		break;
 	case 'q': conf.emit_stats = 0;
 		  conf.suppress_comments = 1;
--
To unsubscribe from this list: send the line "unsubscribe dwarves" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: dwarf_loader.c: Fixed leaked bogon
       [not found]     ` <20100106164444.GB18919-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
@ 2010-04-05  7:27       ` Rakesh Pandit
  2010-05-10 11:03       ` Rakesh Pandit
  1 sibling, 0 replies; 4+ messages in thread
From: Rakesh Pandit @ 2010-04-05  7:27 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: dwarves-u79uwXL29TY76Z2rM5mHXA

On 6 January 2010 22:14, Arnaldo Carvalho de Melo wrote:
> Em Wed, Jan 06, 2010 at 08:54:59PM +0530, Rakesh Pandit escreveu:
>> While checking one of big shared objects I found kernel getting
>> unhappy and sending SIGKILL. File was 282M libwebkit-1.0.so.2.8.1 from
>> webkit project. (Can be obtained from
>> http://kojipkgs.fedoraproject.org/packages/webkitgtk/1.1.12/2.fc12/x86_64/webkitgtk-debuginfo-1.1.12-2.fc12.x86_64.rpm
>> and extracted via rpm2cpio, file is libwebkit-1.0.so.2.8.1.debug)
>>
>> URL: http://rakesh.fedorapeople.org/misc/0001-dwarf_loader.c-Fixed-leaked-bogon.patch
>
> What is the exact command line you are using? You cannot destroy that
> obstack if you really will use the extra debugging info that is has
> many pointers that will point to some other info if you destroy it.
>

Sorry for delay in responding. Hardly had any time to look at this
one. Will reply in few days.

-- 
Rakesh Pandit
https://fedoraproject.org/wiki/User:Rakesh
freedom, friends, features, first
--
To unsubscribe from this list: send the line "unsubscribe dwarves" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: dwarf_loader.c: Fixed leaked bogon
       [not found]     ` <20100106164444.GB18919-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
  2010-04-05  7:27       ` Rakesh Pandit
@ 2010-05-10 11:03       ` Rakesh Pandit
  1 sibling, 0 replies; 4+ messages in thread
From: Rakesh Pandit @ 2010-05-10 11:03 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: dwarves-u79uwXL29TY76Z2rM5mHXA

Finally had a look at this case again and I am able to reproduce it.
Kernel kills the command:
[rakesh@simu build]$ ./pfunct -l -P
~/testrpms/webkitgtk-debuginfo-1.1.12-1.fc12.x86_64/usr/lib/debug/usr/lib64/libwebkit-1.0.so.2.debug
with message:
May 10 12:19:20 simu kernel: Out of memory: kill process 2956 (bash)
score 496818 or a child
May 10 12:19:20 simu kernel: Killed process 5758 (pfunct)

On 6 January 2010 22:14, Arnaldo Carvalho de Melo  wrote:
> Em Wed, Jan 06, 2010 at 08:54:59PM +0530, Rakesh Pandit escreveu:
>> While checking one of big shared objects I found kernel getting
>> unhappy and sending SIGKILL. File was 282M libwebkit-1.0.so.2.8.1 from
>> webkit project. (Can be obtained from
>> http://kojipkgs.fedoraproject.org/packages/webkitgtk/1.1.12/2.fc12/x86_64/webkitgtk-debuginfo-1.1.12-2.fc12.x86_64.rpm
>> and extracted via rpm2cpio, file is libwebkit-1.0.so.2.8.1.debug)
>>
>> URL: http://rakesh.fedorapeople.org/misc/0001-dwarf_loader.c-Fixed-leaked-bogon.patch
>
> What is the exact command line you are using? You cannot destroy that
> obstack if you really will use the extra debugging info that is has
> many pointers that will point to some other info if you destroy it.
>
> By default cu->extra_dbg_info is false, it only is true if set
> explicitely by one of the tools, like:
>
> [acme@doppio pahole]$ grep extra_dbg_info *.c
> dwarf_loader.c: if (cu->extra_dbg_info) {
> dwarf_loader.c: return cu->extra_dbg_info ?
> dwarf_loader.c: return cu->extra_dbg_info ? dtag->decl_line : 0;
> dwarf_loader.c: return cu->extra_dbg_info ? dtag->id : 0;
> dwarf_loader.c: return cu->extra_dbg_info ? dtag->type : 0;
> dwarf_loader.c:         cu->extra_dbg_info = conf ? conf->extra_dbg_info : 0;
> dwarf_loader.c:         if (!cu->extra_dbg_info)
> dwarves.c:              self->extra_dbg_info = 0;
> pahole.c:                 conf_load.extra_dbg_info = 1;         break;
> pahole.c:                 conf_load.extra_dbg_info = 1;         break;
> pahole.c:                 conf_load.extra_dbg_info = 1;         break;
> pfunct.c:                 conf_load.extra_dbg_info = true;
> pfunct.c:                 conf_load.extra_dbg_info = 1;          break;
> pfunct.c:                 conf_load.extra_dbg_info = true;
> [acme@doppio pahole]$
>
> pahole and pfunct, and inpahole, assuming it is the one you are using:
>
>                .name = "decl_exclude",
>                .key  = 'D',
>                .arg  = "PREFIX",
>                .doc  = "exclude classes declared in files with PREFIX",
>
>        case 'D': decl_exclude_prefix = arg;
>                  decl_exclude_prefix_len = strlen(decl_exclude_prefix);
>                  conf_load.extra_dbg_info = 1;         break;
>
>                .name = "show_decl_info",
>                .key  = 'I',
>                .doc  = "Show the file and line number where the tags were defined"
>
>        case 'I': conf.show_decl_info = 1;
>                  conf_load.extra_dbg_info = 1;         break;
>
>                .name = "packable",
>                .key  = 'P',
>                .doc  = "show only structs that has holes that can be packed",
>
>        case 'P': show_packable = 1;
>                  conf_load.extra_dbg_info = 1;         break;
>
>
> The only seemingly "strange" case above is --packable, that I bet is
> what you're using, where it needs the extra debug info because for
> anonymous structs it shows in which file and line the struct is, and
> that is only available from the DWARF info.
>

I am using -l ( along with -P & one more option also) among the above.
ELF file is webkitgtk-debuginfo-1.1.12-1.fc12.x86_64/usr/lib/debug/usr/lib64/libwebkit-1.0.so.2.debug
which is essentially a symlink to libwebkit-1.0.so.2.8.1.debug in same
debuginfo rpm.

Link to debuginfo rpm is:
http://kojipkgs.fedoraproject.org/packages/webkitgtk/1.1.12/1.fc12/x86_64/webkitgtk-debuginfo-1.1.12-1.fc12.x86_64.rpm

It is 290 MB ELF file.

> Can you try the following patch to see if the problem goes away? We may
> want to just enable extra_dbg_info in this case if used with --verbose,
> something like that.
>

Looking into where this leaks happens and what would be better way to
deal with it.

-- 
Rakesh Pandit
https://fedoraproject.org/wiki/User:Rakesh
freedom, friends, features, first
--
To unsubscribe from this list: send the line "unsubscribe dwarves" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2010-05-10 11:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-06 15:24 dwarf_loader.c: Fixed leaked bogon Rakesh Pandit
     [not found] ` <b401d2531001060724r4a06401fx9cc8a5dbf24518d3-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-06 16:44   ` Arnaldo Carvalho de Melo
     [not found]     ` <20100106164444.GB18919-f8uhVLnGfZaxAyOMLChx1axOck334EZe@public.gmane.org>
2010-04-05  7:27       ` Rakesh Pandit
2010-05-10 11:03       ` Rakesh Pandit

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 NNTP newsgroup(s).