Some fixes for linux-user:
- workaround for CMSG_NXTHDR bug - two patches for ppc64/ppc64le host: fix fcntl() with *LK64 commands (seen when dpkg wants to lock the DB) fix reserved_va alignment (ppc64 needs a 64kB alignment) - convert a forgotten fcntl() to safe_fcntl() -----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJbS6W3AAoJEPMMOL0/L748Bs0P/3f+QKMdpllQPDLtrf2SkDw/ S71+4rz2oKcXX1wBj1btc6zLDTVtX0J65yNUhJ78Q/2pM8WnrFgloc6wnj01V7bR HfCNcJ52WtnomNYEUZ2IcbJp6nytcRSjGKNv5oSCVCEe4SYERLWg21u7VOoIp0zb DMT4xJ5fLvip6I4I0QCVlSWB9iOuG/zFXQsLlYQet3XZ0cXzy8FTLqp2Jt609k4L 5073ibHoNF7SHuIf9OP0nP3P0NnD5UKVshDgWDvTPnvhgeVrcypSjZUf7Gcy9//D REwTN/gXpyffyhwj7Rqbw+Oi9naUdp4VADRas3qZi5SxouJ9h/ORsce1JgPE9cmL jQwh/ZzoajV2omMSLhzVDdRtO0ZWSXX394JaHBIws7q75AecYNR0J6PgBcW25+Q4 Te6LovxPa0q0ZOTAGh9HnFBcyRR8WxewO++CLWsbrFUqsLBZJgAWh1pBMdKAEOkT QX6rWLvzAMJGAjFGEQ7T62lB9khF8ygE2C/s5nbgFG5sc6NVjrcvlCIeFZcYT5BZ 3PwG6sGSOK/9mc5NLfxGVSwMIwAl+uyP/q3d5GrqJWGYD1ZEIm4h7xmZ68rDNSpK IjcpkGt6Vaf2Z79KZGMcPnljItKvGz4+pWXS3g/eWI1H3FuvrYFZE1md9nk6+BP7 /il1ZjBkLA+GZA+Bnlp1 =vqGn -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-3.0-pull-request' into staging Some fixes for linux-user: - workaround for CMSG_NXTHDR bug - two patches for ppc64/ppc64le host: fix fcntl() with *LK64 commands (seen when dpkg wants to lock the DB) fix reserved_va alignment (ppc64 needs a 64kB alignment) - convert a forgotten fcntl() to safe_fcntl() # gpg: Signature made Sun 15 Jul 2018 20:51:19 BST # gpg: using RSA key F30C38BD3F2FBE3C # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" # gpg: aka "Laurent Vivier <laurent@vivier.eu>" # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier2/tags/linux-user-for-3.0-pull-request: Zero out the host's `msg_control` buffer linux-user: fix mmap_find_vma_reserved() linux-user: convert remaining fcntl() to safe_fcntl() linux-user: ppc64: use the correct values for F_*LK64s Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
b808d2001d
@ -78,14 +78,7 @@ int have_guest_base;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* That said, reserving *too* much vm space via mmap can run into problems
|
||||
with rlimits, oom due to page table creation, etc. We will still try it,
|
||||
if directed by the command-line option, but not by default. */
|
||||
#if HOST_LONG_BITS == 64 && TARGET_VIRT_ADDR_SPACE_BITS <= 32
|
||||
unsigned long reserved_va = MAX_RESERVED_VA;
|
||||
#else
|
||||
unsigned long reserved_va;
|
||||
#endif
|
||||
|
||||
static void usage(int exitcode);
|
||||
|
||||
@ -672,6 +665,18 @@ int main(int argc, char **argv, char **envp)
|
||||
/* init tcg before creating CPUs and to get qemu_host_page_size */
|
||||
tcg_exec_init(0);
|
||||
|
||||
/* Reserving *too* much vm space via mmap can run into problems
|
||||
with rlimits, oom due to page table creation, etc. We will still try it,
|
||||
if directed by the command-line option, but not by default. */
|
||||
if (HOST_LONG_BITS == 64 &&
|
||||
TARGET_VIRT_ADDR_SPACE_BITS <= 32 &&
|
||||
reserved_va == 0) {
|
||||
/* reserved_va must be aligned with the host page size
|
||||
* as it is used with mmap()
|
||||
*/
|
||||
reserved_va = MAX_RESERVED_VA & qemu_host_page_mask;
|
||||
}
|
||||
|
||||
cpu = cpu_create(cpu_type);
|
||||
env = cpu->env_ptr;
|
||||
cpu_reset(cpu);
|
||||
|
@ -3843,6 +3843,8 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
|
||||
}
|
||||
msg.msg_controllen = 2 * tswapal(msgp->msg_controllen);
|
||||
msg.msg_control = alloca(msg.msg_controllen);
|
||||
memset(msg.msg_control, 0, msg.msg_controllen);
|
||||
|
||||
msg.msg_flags = tswap32(msgp->msg_flags);
|
||||
|
||||
count = tswapal(msgp->msg_iovlen);
|
||||
@ -6545,63 +6547,97 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
|
||||
/* warning : doesn't handle linux specific flags... */
|
||||
static int target_to_host_fcntl_cmd(int cmd)
|
||||
{
|
||||
int ret;
|
||||
|
||||
switch(cmd) {
|
||||
case TARGET_F_DUPFD:
|
||||
case TARGET_F_GETFD:
|
||||
case TARGET_F_SETFD:
|
||||
case TARGET_F_GETFL:
|
||||
case TARGET_F_SETFL:
|
||||
return cmd;
|
||||
case TARGET_F_GETLK:
|
||||
return F_GETLK64;
|
||||
case TARGET_F_SETLK:
|
||||
return F_SETLK64;
|
||||
case TARGET_F_SETLKW:
|
||||
return F_SETLKW64;
|
||||
case TARGET_F_GETOWN:
|
||||
return F_GETOWN;
|
||||
case TARGET_F_SETOWN:
|
||||
return F_SETOWN;
|
||||
case TARGET_F_GETSIG:
|
||||
return F_GETSIG;
|
||||
case TARGET_F_SETSIG:
|
||||
return F_SETSIG;
|
||||
case TARGET_F_DUPFD:
|
||||
case TARGET_F_GETFD:
|
||||
case TARGET_F_SETFD:
|
||||
case TARGET_F_GETFL:
|
||||
case TARGET_F_SETFL:
|
||||
ret = cmd;
|
||||
break;
|
||||
case TARGET_F_GETLK:
|
||||
ret = F_GETLK64;
|
||||
break;
|
||||
case TARGET_F_SETLK:
|
||||
ret = F_SETLK64;
|
||||
break;
|
||||
case TARGET_F_SETLKW:
|
||||
ret = F_SETLKW64;
|
||||
break;
|
||||
case TARGET_F_GETOWN:
|
||||
ret = F_GETOWN;
|
||||
break;
|
||||
case TARGET_F_SETOWN:
|
||||
ret = F_SETOWN;
|
||||
break;
|
||||
case TARGET_F_GETSIG:
|
||||
ret = F_GETSIG;
|
||||
break;
|
||||
case TARGET_F_SETSIG:
|
||||
ret = F_SETSIG;
|
||||
break;
|
||||
#if TARGET_ABI_BITS == 32
|
||||
case TARGET_F_GETLK64:
|
||||
return F_GETLK64;
|
||||
case TARGET_F_SETLK64:
|
||||
return F_SETLK64;
|
||||
case TARGET_F_SETLKW64:
|
||||
return F_SETLKW64;
|
||||
case TARGET_F_GETLK64:
|
||||
ret = F_GETLK64;
|
||||
break;
|
||||
case TARGET_F_SETLK64:
|
||||
ret = F_SETLK64;
|
||||
break;
|
||||
case TARGET_F_SETLKW64:
|
||||
ret = F_SETLKW64;
|
||||
break;
|
||||
#endif
|
||||
case TARGET_F_SETLEASE:
|
||||
return F_SETLEASE;
|
||||
case TARGET_F_GETLEASE:
|
||||
return F_GETLEASE;
|
||||
case TARGET_F_SETLEASE:
|
||||
ret = F_SETLEASE;
|
||||
break;
|
||||
case TARGET_F_GETLEASE:
|
||||
ret = F_GETLEASE;
|
||||
break;
|
||||
#ifdef F_DUPFD_CLOEXEC
|
||||
case TARGET_F_DUPFD_CLOEXEC:
|
||||
return F_DUPFD_CLOEXEC;
|
||||
case TARGET_F_DUPFD_CLOEXEC:
|
||||
ret = F_DUPFD_CLOEXEC;
|
||||
break;
|
||||
#endif
|
||||
case TARGET_F_NOTIFY:
|
||||
return F_NOTIFY;
|
||||
case TARGET_F_NOTIFY:
|
||||
ret = F_NOTIFY;
|
||||
break;
|
||||
#ifdef F_GETOWN_EX
|
||||
case TARGET_F_GETOWN_EX:
|
||||
return F_GETOWN_EX;
|
||||
case TARGET_F_GETOWN_EX:
|
||||
ret = F_GETOWN_EX;
|
||||
break;
|
||||
#endif
|
||||
#ifdef F_SETOWN_EX
|
||||
case TARGET_F_SETOWN_EX:
|
||||
return F_SETOWN_EX;
|
||||
case TARGET_F_SETOWN_EX:
|
||||
ret = F_SETOWN_EX;
|
||||
break;
|
||||
#endif
|
||||
#ifdef F_SETPIPE_SZ
|
||||
case TARGET_F_SETPIPE_SZ:
|
||||
return F_SETPIPE_SZ;
|
||||
case TARGET_F_GETPIPE_SZ:
|
||||
return F_GETPIPE_SZ;
|
||||
case TARGET_F_SETPIPE_SZ:
|
||||
ret = F_SETPIPE_SZ;
|
||||
break;
|
||||
case TARGET_F_GETPIPE_SZ:
|
||||
ret = F_GETPIPE_SZ;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return -TARGET_EINVAL;
|
||||
default:
|
||||
ret = -TARGET_EINVAL;
|
||||
break;
|
||||
}
|
||||
return -TARGET_EINVAL;
|
||||
|
||||
#if defined(__powerpc64__)
|
||||
/* On PPC64, glibc headers has the F_*LK* defined to 12, 13 and 14 and
|
||||
* is not supported by kernel. The glibc fcntl call actually adjusts
|
||||
* them to 5, 6 and 7 before making the syscall(). Since we make the
|
||||
* syscall directly, adjust to what is supported by the kernel.
|
||||
*/
|
||||
if (ret >= F_GETLK64 && ret <= F_SETLKW64) {
|
||||
ret -= F_GETLK64 - 5;
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define FLOCK_TRANSTBL \
|
||||
@ -11730,7 +11766,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
|
||||
if (ret) {
|
||||
break;
|
||||
}
|
||||
ret = get_errno(fcntl(arg1, cmd, &fl));
|
||||
ret = get_errno(safe_fcntl(arg1, cmd, &fl));
|
||||
if (ret == 0) {
|
||||
ret = copyto(arg3, &fl);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user