diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2020-07-28 17:15:09 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2020-07-28 17:15:09 +0100 |
commit | 0a58e39fe90c50b313a5148c095f8dbb6111a6d6 (patch) | |
tree | 4de8c4e9c21893f914bf91689081f156481701fc | |
parent | a466dd084f51cdc9da2e99361f674f98d7218559 (diff) | |
parent | 0f6bb1958f3aae0171996941df7fb7ea7536bb12 (diff) | |
download | qemu-0a58e39fe90c50b313a5148c095f8dbb6111a6d6.zip qemu-0a58e39fe90c50b313a5148c095f8dbb6111a6d6.tar.gz qemu-0a58e39fe90c50b313a5148c095f8dbb6111a6d6.tar.bz2 |
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-5.1-pull-request' into staging
linux-user 20200728
Fix "pgb_reserved_va: Assertion `guest_base != 0' failed." error
Fix rt_sigtimedwait() errno
Fix getcwd() errno
# gpg: Signature made Tue 28 Jul 2020 13:34:11 BST
# gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg: issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg: aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C
* remotes/vivier2/tags/linux-user-for-5.1-pull-request:
linux-user: Use getcwd syscall directly
linux-user: Fix syscall rt_sigtimedwait() implementation
linux-user: Ensure mmap_min_addr is non-zero
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | linux-user/main.c | 16 | ||||
-rw-r--r-- | linux-user/syscall.c | 13 |
2 files changed, 18 insertions, 11 deletions
diff --git a/linux-user/main.c b/linux-user/main.c index 3597e99..75c9785 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -758,15 +758,27 @@ int main(int argc, char **argv, char **envp) if ((fp = fopen("/proc/sys/vm/mmap_min_addr", "r")) != NULL) { unsigned long tmp; - if (fscanf(fp, "%lu", &tmp) == 1) { + if (fscanf(fp, "%lu", &tmp) == 1 && tmp != 0) { mmap_min_addr = tmp; - qemu_log_mask(CPU_LOG_PAGE, "host mmap_min_addr=0x%lx\n", mmap_min_addr); + qemu_log_mask(CPU_LOG_PAGE, "host mmap_min_addr=0x%lx\n", + mmap_min_addr); } fclose(fp); } } /* + * We prefer to not make NULL pointers accessible to QEMU. + * If we're in a chroot with no /proc, fall back to 1 page. + */ + if (mmap_min_addr == 0) { + mmap_min_addr = qemu_host_page_size; + qemu_log_mask(CPU_LOG_PAGE, + "host mmap_min_addr=0x%lx (fallback)\n", + mmap_min_addr); + } + + /* * Prepare copy of argv vector for target. */ target_argc = argc - optind; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index f5c4f6b..945fc25 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -388,14 +388,7 @@ static bitmask_transtbl fcntl_flags_tbl[] = { { 0, 0, 0, 0 } }; -static int sys_getcwd1(char *buf, size_t size) -{ - if (getcwd(buf, size) == NULL) { - /* getcwd() sets errno */ - return (-1); - } - return strlen(buf)+1; -} +_syscall2(int, sys_getcwd1, char *, buf, size_t, size) #ifdef TARGET_NR_utimensat #if defined(__NR_utimensat) @@ -8868,7 +8861,9 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, unlock_user(p, arg1, 0); if (arg3) { puts = &uts; - target_to_host_timespec(puts, arg3); + if (target_to_host_timespec(puts, arg3)) { + return -TARGET_EFAULT; + } } else { puts = NULL; } |