Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-6.0-pull-request' into staging

linux-user pull request 20210328

- Fix recvfrom with NULL msg
- Fix sigreturn address on s390x

# gpg: Signature made Sun 28 Mar 2021 17:05:45 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-6.0-pull-request:
  linux-user: allow NULL msg in recvfrom
  linux-user/s390x: Use the guest pointer for the sigreturn stub

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell
2021-03-28 19:49:57 +01:00
2 changed files with 11 additions and 5 deletions
+3 -2
View File
@@ -211,9 +211,10 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
/* Set up to return from userspace. If provided, use a stub
already in userspace. */
if (ka->sa_flags & TARGET_SA_RESTORER) {
env->regs[14] = (unsigned long) ka->sa_restorer | PSW_ADDR_AMODE;
env->regs[14] = ka->sa_restorer | PSW_ADDR_AMODE;
} else {
env->regs[14] = (unsigned long) frame->retcode | PSW_ADDR_AMODE;
env->regs[14] = (frame_addr + offsetof(typeof(*frame), retcode))
| PSW_ADDR_AMODE;
__put_user(S390_SYSCALL_OPCODE | TARGET_NR_rt_sigreturn,
(uint16_t *)(frame->retcode));
}
+8 -3
View File
@@ -3679,9 +3679,14 @@ static abi_long do_recvfrom(int fd, abi_ulong msg, size_t len, int flags,
void *host_msg;
abi_long ret;
host_msg = lock_user(VERIFY_WRITE, msg, len, 0);
if (!host_msg)
return -TARGET_EFAULT;
if (!msg) {
host_msg = NULL;
} else {
host_msg = lock_user(VERIFY_WRITE, msg, len, 0);
if (!host_msg) {
return -TARGET_EFAULT;
}
}
if (target_addr) {
if (get_user_u32(addrlen, target_addrlen)) {
ret = -TARGET_EFAULT;