public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH 0/5] Improve dumper megion region selection
@ 2020-07-18 15:00 Jon Turney
  2020-07-18 15:00 ` [PATCH 1/5] Cygwin: Show details of all memory regions details in dumper debug output Jon Turney
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Jon Turney @ 2020-07-18 15:00 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Jon Turney

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


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

end of thread, other threads:[~2020-07-28 21:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-18 15:00 [PATCH 0/5] Improve dumper megion region selection Jon Turney
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

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).