Cygwin: Don't dump non-writable image regions
After this, we will end up dumping memory regions where: - 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 protection allows writes Making this decision based on the current protection isn't 100% correct, because it may have been changed using VirtualProtect(). But we don't know how to determine if a region is shareable. (As a practical matter, anything which gets us the stack (MEM_PRIVATE) and .data/.bss (RW MEM_IMAGE) is going to be enough for 99% of cases)
This commit is contained in:
parent
44103c0621
commit
35227fec97
@ -292,6 +292,12 @@ dumper::collect_memory_sections ()
|
|||||||
int skip_region_p = 0;
|
int skip_region_p = 0;
|
||||||
const char *disposition = "dumped";
|
const char *disposition = "dumped";
|
||||||
|
|
||||||
|
if ((mbi.Type & MEM_IMAGE) && !(mbi.Protect & (PAGE_EXECUTE_READWRITE | PAGE_READWRITE)))
|
||||||
|
{
|
||||||
|
skip_region_p = 1;
|
||||||
|
disposition = "skipped due to non-writeable MEM_IMAGE";
|
||||||
|
}
|
||||||
|
|
||||||
if (mbi.Protect & PAGE_NOACCESS)
|
if (mbi.Protect & PAGE_NOACCESS)
|
||||||
{
|
{
|
||||||
skip_region_p = 1;
|
skip_region_p = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user