diff options
Diffstat (limited to 'meta/packages/qemu/qemu-0.9.1+svn/fix_brk.patch')
| -rw-r--r-- | meta/packages/qemu/qemu-0.9.1+svn/fix_brk.patch | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/meta/packages/qemu/qemu-0.9.1+svn/fix_brk.patch b/meta/packages/qemu/qemu-0.9.1+svn/fix_brk.patch new file mode 100644 index 0000000000..783198d9e3 --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1+svn/fix_brk.patch | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | --- qemu/linux-user/syscall.c1 (revision 16) | ||
| 2 | +++ qemu/linux-user/syscall.c (working copy) | ||
| 3 | @@ -441,7 +441,7 @@ | ||
| 4 | if (!new_brk) | ||
| 5 | return target_brk; | ||
| 6 | if (new_brk < target_original_brk) | ||
| 7 | - return -TARGET_ENOMEM; | ||
| 8 | + return target_brk; | ||
| 9 | |||
| 10 | brk_page = HOST_PAGE_ALIGN(target_brk); | ||
| 11 | |||
| 12 | @@ -456,12 +456,11 @@ | ||
| 13 | mapped_addr = get_errno(target_mmap(brk_page, new_alloc_size, | ||
| 14 | PROT_READ|PROT_WRITE, | ||
| 15 | MAP_ANON|MAP_FIXED|MAP_PRIVATE, 0, 0)); | ||
| 16 | - if (is_error(mapped_addr)) { | ||
| 17 | - return mapped_addr; | ||
| 18 | - } else { | ||
| 19 | + | ||
| 20 | + if (!is_error(mapped_addr)) | ||
| 21 | target_brk = new_brk; | ||
| 22 | - return target_brk; | ||
| 23 | - } | ||
| 24 | + | ||
| 25 | + return target_brk; | ||
| 26 | } | ||
| 27 | |||
| 28 | static inline abi_long copy_from_user_fdset(fd_set *fds, | ||
| 29 | --- qemu/linux-user/mmap.c1 (revision 16) | ||
| 30 | +++ qemu/linux-user/mmap.c (working copy) | ||
| 31 | @@ -260,6 +259,9 @@ | ||
| 32 | host_start += offset - host_offset; | ||
| 33 | start = h2g(host_start); | ||
| 34 | } else { | ||
| 35 | + int flg; | ||
| 36 | + target_ulong addr; | ||
| 37 | + | ||
| 38 | if (start & ~TARGET_PAGE_MASK) { | ||
| 39 | errno = EINVAL; | ||
| 40 | return -1; | ||
| 41 | @@ -267,6 +269,14 @@ | ||
| 42 | end = start + len; | ||
| 43 | real_end = HOST_PAGE_ALIGN(end); | ||
| 44 | |||
| 45 | + for(addr = real_start; addr < real_end; addr += TARGET_PAGE_SIZE) { | ||
| 46 | + flg = page_get_flags(addr); | ||
| 47 | + if( flg & PAGE_RESERVED ) { | ||
| 48 | + errno = ENXIO; | ||
| 49 | + return -1; | ||
| 50 | + } | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | /* worst case: we cannot map the file because the offset is not | ||
| 54 | aligned, so we read it */ | ||
| 55 | if (!(flags & MAP_ANONYMOUS) && | ||
