From: Jon Turney <jon.turney@dronecode.org.uk>
To: cygwin-patches@cygwin.com
Cc: Jon Turney <jon.turney@dronecode.org.uk>
Subject: [PATCH 0/5] Improve dumper megion region selection
Date: Sat, 18 Jul 2020 16:00:23 +0100 [thread overview]
Message-ID: <20200718150028.1709-1-jon.turney@dronecode.org.uk> (raw)
Improve how dumper determines if a memory region should be dumped:
Currently we open and read the PE file for each module, and exclude regions
corresponding to sections marked 'DEBUGGING' or 'CODE'.
This doesn't work correctly if the DLL has been loaded to an address other
than the ImageBase recorded in the PE header. It fails to produce a useful
dump if there's a collision in excluded region addresses (which will always
occur on x86_64, as kernel32.dll has an ImageBase which collides with the
cygwin1.dll)
This probably also doesn't produce correct dumps if the protection on memory
regions corresponding to 'CODE' sections is manipulated using VirtualProtect().
Instead, dump memory region based on their type, protection and sharability:
- state is MEM_COMMIT (i.e. is not MEM_RESERVE or MEM_FREE), and
-- type is MEM_PRIVATE and protection allows reads (i.e. not a guardpage), or
-- type is MEM_IMAGE and attribute is non-sharable (i.e. it was WC, got
written to, and is now a RW copy)
Jon Turney (5):
Cygwin: Show details of all memory regions details in dumper debug
output
Cygwin: Remove reading of PE for section flags from dumper
Cygwin: Drop excluded regions list from dumper
Cygwin: Don't dump non-writable image regions
Cygwin: Use MEMORY_WORKING_SET_EX_INFORMATION in dumper
winsup/doc/utils.xml | 8 +-
winsup/utils/Makefile.in | 8 +-
winsup/utils/dumper.cc | 214 +++++++++++++++++++++++++++------------
winsup/utils/dumper.h | 19 ----
winsup/utils/parse_pe.cc | 107 --------------------
5 files changed, 155 insertions(+), 201 deletions(-)
delete mode 100644 winsup/utils/parse_pe.cc
--
2.27.0
next reply other threads:[~2020-07-18 15:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-18 15:00 Jon Turney [this message]
2020-07-18 15:00 ` [PATCH 1/5] Cygwin: Show details of all memory regions details in dumper debug output Jon Turney
2020-07-18 15:00 ` [PATCH 2/5] Cygwin: Remove reading of PE for section flags from dumper Jon Turney
2020-07-18 15:00 ` [PATCH 3/5] Cygwin: Drop excluded regions list " Jon Turney
2020-07-18 15:00 ` [PATCH 4/5] Cygwin: Don't dump non-writable image regions Jon Turney
2020-07-18 15:00 ` [PATCH 5/5] Cygwin: Use MEMORY_WORKING_SET_EX_INFORMATION in dumper Jon Turney
2020-07-20 8:15 ` Corinna Vinschen
2020-07-28 2:20 ` Takashi Yano
2020-07-28 21:04 ` Jon Turney
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=20200718150028.1709-1-jon.turney@dronecode.org.uk \
--to=jon.turney@dronecode.org.uk \
--cc=cygwin-patches@cygwin.com \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).