diff options
-rw-r--r-- | linux-user/elfload.c | 7 | ||||
-rw-r--r-- | linux-user/mips/cpu_loop.c | 4 | ||||
-rw-r--r-- | linux-user/syscall.c | 4 |
3 files changed, 12 insertions, 3 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c index bf8c1bd253..0b02a92602 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2188,7 +2188,8 @@ static uintptr_t pgd_find_hole_fallback(uintptr_t guest_size, uintptr_t brk, PROT_NONE, flags, -1, 0); if (mmap_start != MAP_FAILED) { munmap((void *) align_start, guest_size); - if (MAP_FIXED_NOREPLACE || mmap_start == (void *) align_start) { + if (MAP_FIXED_NOREPLACE != 0 || + mmap_start == (void *) align_start) { return (uintptr_t) mmap_start + offset; } } @@ -3484,7 +3485,9 @@ static abi_ulong vma_dump_size(const struct vm_area_struct *vma) if (vma->vma_flags & PROT_EXEC) { char page[TARGET_PAGE_SIZE]; - copy_from_user(page, vma->vma_start, sizeof (page)); + if (copy_from_user(page, vma->vma_start, sizeof (page))) { + return 0; + } if ((page[EI_MAG0] == ELFMAG0) && (page[EI_MAG1] == ELFMAG1) && (page[EI_MAG2] == ELFMAG2) && diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c index 553e8ca7f5..cfe7ba5c47 100644 --- a/linux-user/mips/cpu_loop.c +++ b/linux-user/mips/cpu_loop.c @@ -104,18 +104,22 @@ void cpu_loop(CPUMIPSState *env) if ((ret = get_user_ual(arg8, sp_reg + 28)) != 0) { goto done_syscall; } + /* fall through */ case 7: if ((ret = get_user_ual(arg7, sp_reg + 24)) != 0) { goto done_syscall; } + /* fall through */ case 6: if ((ret = get_user_ual(arg6, sp_reg + 20)) != 0) { goto done_syscall; } + /* fall through */ case 5: if ((ret = get_user_ual(arg5, sp_reg + 16)) != 0) { goto done_syscall; } + /* fall through */ default: break; } diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 6fef8181e7..3160a9ba06 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7592,7 +7592,9 @@ static int do_futex_time64(target_ulong uaddr, int op, int val, target_ulong tim case FUTEX_WAIT_BITSET: if (timeout) { pts = &ts; - target_to_host_timespec64(pts, timeout); + if (target_to_host_timespec64(pts, timeout)) { + return -TARGET_EFAULT; + } } else { pts = NULL; } |