mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
Teach mmap to not overwrite reserved pages and fix brk return value (Richard Purdie).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4255 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
662caa6f91
commit
7ab240ad4b
2 changed files with 17 additions and 7 deletions
|
@ -420,7 +420,7 @@ abi_long do_brk(abi_ulong new_brk)
|
|||
if (!new_brk)
|
||||
return target_brk;
|
||||
if (new_brk < target_original_brk)
|
||||
return -TARGET_ENOMEM;
|
||||
return target_brk;
|
||||
|
||||
brk_page = HOST_PAGE_ALIGN(target_brk);
|
||||
|
||||
|
@ -435,12 +435,11 @@ abi_long do_brk(abi_ulong new_brk)
|
|||
mapped_addr = get_errno(target_mmap(brk_page, new_alloc_size,
|
||||
PROT_READ|PROT_WRITE,
|
||||
MAP_ANON|MAP_FIXED|MAP_PRIVATE, 0, 0));
|
||||
if (is_error(mapped_addr)) {
|
||||
return mapped_addr;
|
||||
} else {
|
||||
|
||||
if (!is_error(mapped_addr))
|
||||
target_brk = new_brk;
|
||||
return target_brk;
|
||||
}
|
||||
|
||||
return target_brk;
|
||||
}
|
||||
|
||||
static inline abi_long copy_from_user_fdset(fd_set *fds,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue