linux-user 20200728

Fix "pgb_reserved_va: Assertion `guest_base != 0' failed." error
 Fix rt_sigtimedwait() errno
 Fix getcwd() errno
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAl8gG0MSHGxhdXJlbnRA
 dml2aWVyLmV1AAoJEPMMOL0/L748hzEP/iAqiBXXZAZMSSk2HeVw1sTLufHxcBCJ
 lRN5UFrb4nuK9e0gHHKuWUN3H5RM/IQiPqtxLfyZTcYrR2o+7UqsJhY39NV+yPpV
 lI+QmqNPRxhXYoq8JZ/Ok3dxgSLulehsVe3Y9UKf0VwzLMlQn9ZVgMrRCtJMydMJ
 pKIvddTyk0Dy+Kwxn6cXm9ewxpy48KzcCJswuZMaT+WzS4ybkq9kJwuKm5mdCdra
 kR069o23ft9eJ+0BjgHraFLErsZeB6rjkGf2ej6pG0JYsqZhXwy5XAR+uyyTHlgP
 m4lXYpJjQJrSuHVbiDSzBE8opxNbnWwUmnjUaE3C5v0nwa4Q1+BO08xfgxjU4ShX
 H5LLh5teGvLUc3NviUKuuJgps171kxLCAc2sjCbcraJhiB/ohg56CF0drY4CGetp
 CgHlN9ig3oEMu+ZKVr4bj/BNbp/wA+kP9SGP4dKj6v2c5AKexNhk59vm5lQ1A9sp
 54p12tafVclkv80yDHI4jB79pSsDO+6g0yIfwq+DIPdvBsjPKuLXVefqWq5M/Auz
 9sIyV2076mGE3r9tn57ah1tnz7BoUALO3v8D4gqnNx37JEiv9Wd2Wn/7FFdJuoPP
 GaVRhfCWMGxkQaAs1UnhWdV69ETfIpyJkoT8scEa34AQUhjM7vibp/NKOGR844tG
 0d3paBzubA1K
 =0GzB
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
Peter Maydell 2020-07-28 17:15:09 +01:00
commit 0a58e39fe9
2 changed files with 18 additions and 11 deletions

View File

@ -758,14 +758,26 @@ 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.
*/

View File

@ -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;
}