Merge pull request #114 from WorksButNotTested/dontdump
Support madvise(MADV_DONTDUMP) when creating core dumps for qemu-user
This commit is contained in:
commit
d20fb07d99
@ -38,6 +38,12 @@
|
||||
*/
|
||||
#define PAGE_PASSTHROUGH 0x0800
|
||||
|
||||
/*
|
||||
* For linux-user, indicates that the page should not be included in a core
|
||||
* dump.
|
||||
*/
|
||||
#define PAGE_DONTDUMP 0x1000
|
||||
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
|
||||
void TSA_NO_TSA mmap_lock(void);
|
||||
|
@ -4068,6 +4068,10 @@ static size_t vma_dump_size(target_ulong start, target_ulong end,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (flags & PAGE_DONTDUMP) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Usually we don't dump executable pages as they contain
|
||||
* non-writable code that debugger can read directly from
|
||||
|
@ -1246,6 +1246,11 @@ abi_long target_madvise(abi_ulong start, abi_ulong len_in, int advice)
|
||||
*/
|
||||
mmap_lock();
|
||||
switch (advice) {
|
||||
case MADV_DONTDUMP:
|
||||
if (len > 0) {
|
||||
page_set_flags(start, start + len - 1, PAGE_DONTDUMP);
|
||||
}
|
||||
break;
|
||||
case MADV_WIPEONFORK:
|
||||
case MADV_KEEPONFORK:
|
||||
ret = -EINVAL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user