linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@davemloft.net>
To: linux-kernel@vger.kernel.org
Subject: fs/binfmt_elf.c:maydump()
Date: Thu, 06 Apr 2006 14:03:57 -0700 (PDT)	[thread overview]
Message-ID: <20060406.140357.14088592.davem@davemloft.net> (raw)


I sort of understand the idea behind this check in maydump():

	/* If it hasn't been written to, don't write it out */
	if (!vma->anon_vma)
		return 0;

but it causes real problems for debugging.  In fact a GDB testcase
breaks because of this check.

In the GDB testcase, the application mmap()'s a file with some
text in it.  It then calls abort() to dump core.  Then GDB loads
up the application again using that core file, and it tries to
look at the mmap()'d file, and that doesn't work.  We don't dump
the file contents because of the above check so GDB has no idea
how to reproduce the application state at the time of the core
dump.

Furthermore, it is vitally important to dump such areas to handle the
case where the file contents change after the core dump occurs.
So even if we had some way to tell GDB the full pathname of the
file which was mapped at that location, we should still dump the
contents and not try to elide them via this check in maydump().

Yes, this means we might hit the core dump limits quicker but we
shouldn't be doing anything which makes less debugging information
than necessary available.  Software development is hard enough as
it is right? :)

I also have a strange feeling that the VM_SHARED/i_nlink==0 check
might cause similar problems, but I won't touch that for now.

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 537893a..7fea878 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1167,10 +1167,6 @@ static int maydump(struct vm_area_struct
 	if (vma->vm_flags & VM_SHARED)
 		return vma->vm_file->f_dentry->d_inode->i_nlink == 0;
 
-	/* If it hasn't been written to, don't write it out */
-	if (!vma->anon_vma)
-		return 0;
-
 	return 1;
 }
 


             reply	other threads:[~2006-04-06 21:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-06 21:03 David S. Miller [this message]
2006-04-06 22:15 ` fs/binfmt_elf.c:maydump() Daniel Jacobowitz
2006-04-06 22:35   ` fs/binfmt_elf.c:maydump() David S. Miller
2006-04-07  5:18     ` fs/binfmt_elf.c:maydump() David S. Miller
2006-04-07 18:02       ` fs/binfmt_elf.c:maydump() Daniel Jacobowitz
2006-04-07 20:27         ` fs/binfmt_elf.c:maydump() David S. Miller
2006-04-10 13:01           ` fs/binfmt_elf.c:maydump() Daniel Jacobowitz
2007-01-03  2:02       ` Contents of core dumps (was: Re: fs/binfmt_elf.c:maydump()) Daniel Jacobowitz
2007-01-03  4:57         ` Contents of core dumps David Miller
2007-01-03 18:13           ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060406.140357.14088592.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).