mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roland McGrath <roland@redhat.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Andrew Morton <akpm@osdl.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] dump read-only anonymous memory in core files
Date: Tue, 7 Oct 2003 12:07:44 -0700	[thread overview]
Message-ID: <200310071907.h97J7i4a004576@magilla.sf.frob.com> (raw)
In-Reply-To: Linus Torvalds's message of  Tuesday, 7 October 2003 02:06:34 -0700 <Pine.LNX.4.44.0310070155110.1749-100000@home.osdl.org>

> 
> What about shared mappings (that test should be VM_MAYSHARE)?
> 
> My inclination would be to not dump them if they are backed by a file, 
> even if the mmap is writable.

That sounds reasonable to me (perhaps modulo the shmfs issue).  I intended
my patch not to omit any vmas that were dumped before, so I didn't consider
omitting any writable areas.  (I don't really understand the difference
between VM_MAYSHARE and VM_SHARED, so I might be assuming something wrong
when saying you are right.)

> Also, the VM_WRITE test should possibly be VM_MAYWRITE, since the thing
> could have been mprotect()'ed. Alternatively, we could really add a "this
> mapping has been writable" flag (a kind of "sticky VM_WRITE" bit). It's
> only mprotect that can do this, anyway.

Actually the ideal would be "this mapping has been written to" (or might
have been, i.e. it at least was writable in a pte, if not actually dirty).
Then if you mmap some pages PROT_READ|PROT_WRITE, and then mprotect them
PROT_READ before ever touching them, you don't dump those pages just as you
wouldn't dump always-read-only pages.  (If you had that, you could apply it
to anonymous mappings as well and omit all zero-fill pages.)  Ideally this
would dump PROT_NONE pages that have been written in the past as well,
which is ruled out by the VM_READ test at the top of maydump.  Despite the
comment, it looks to me like dump_write's use of get_user_pages will make
it work, so it could be a VM_MAYREAD check. 


Thanks,
Roland

      parent reply	other threads:[~2003-10-07 19:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-07  8:28 Roland McGrath
2003-10-07  9:06 ` Linus Torvalds
2003-10-07 14:33   ` Dave McCracken
2003-10-07 19:07   ` Roland McGrath [this message]

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=200310071907.h97J7i4a004576@magilla.sf.frob.com \
    --to=roland@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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

all inboxes | Powered by JetHome®