提交 5f022626 编写于 作者: P Peter Maydell

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

GPROF fixes, GCC9 fixes, SIOCGIFNAME fix, new IPV6 sockopts, elf fix

# gpg: Signature made Fri 10 May 2019 11:45:23 BST
# gpg:                using RSA key F30C38BD3F2FBE3C
# 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-4.1-pull-request:
  linux-user: fix GPROF build failure
  linux-user: avoid treading on gprof's SIGPROF signals
  linux-user: elf: Map empty PT_LOAD segments
  The ioctl(SIOCGIFNAME) call requires a struct ifreq.
  linux-user: avoid string truncation warnings in uname field copying
  linux-user/elfload: Fix GCC 9 build warnings
  linux-user: Add missing IPV6 sockopts
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
......@@ -2366,11 +2366,19 @@ static void load_elf_image(const char *image_name, int image_fd,
vaddr_ps = TARGET_ELF_PAGESTART(vaddr);
vaddr_len = TARGET_ELF_PAGELENGTH(eppnt->p_filesz + vaddr_po);
error = target_mmap(vaddr_ps, vaddr_len,
elf_prot, MAP_PRIVATE | MAP_FIXED,
image_fd, eppnt->p_offset - vaddr_po);
if (error == -1) {
goto exit_perror;
/*
* Some segments may be completely empty without any backing file
* segment, in that case just let zero_bss allocate an empty buffer
* for it.
*/
if (eppnt->p_filesz != 0) {
error = target_mmap(vaddr_ps, vaddr_len, elf_prot,
MAP_PRIVATE | MAP_FIXED,
image_fd, eppnt->p_offset - vaddr_po);
if (error == -1) {
goto exit_perror;
}
}
vaddr_ef = vaddr + eppnt->p_filesz;
......@@ -2872,7 +2880,7 @@ struct target_elf_prpsinfo {
target_gid_t pr_gid;
target_pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
/* Lots missing */
char pr_fname[16]; /* filename of executable */
char pr_fname[16] QEMU_NONSTRING; /* filename of executable */
char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */
};
......
......@@ -18,6 +18,9 @@
*/
#include "qemu/osdep.h"
#include "qemu.h"
#ifdef TARGET_GPROF
#include <sys/gmon.h>
#endif
#ifdef CONFIG_GCOV
extern void __gcov_dump(void);
......
......@@ -178,7 +178,7 @@
#endif /* CONFIG_USBFS */
IOCTL(SIOCATMARK, IOC_R, MK_PTR(TYPE_INT))
IOCTL(SIOCGIFNAME, IOC_RW, MK_PTR(TYPE_INT))
IOCTL(SIOCGIFNAME, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_int_ifreq)))
IOCTL(SIOCGIFFLAGS, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_short_ifreq)))
IOCTL(SIOCSIFFLAGS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_short_ifreq)))
IOCTL(SIOCGIFADDR, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq)))
......
......@@ -508,6 +508,11 @@ void signal_init(void)
act.sa_flags = SA_SIGINFO;
act.sa_sigaction = host_signal_handler;
for(i = 1; i <= TARGET_NSIG; i++) {
#ifdef TARGET_GPROF
if (i == SIGPROF) {
continue;
}
#endif
host_sig = target_to_host_signal(i);
sigaction(host_sig, NULL, &oact);
if (oact.sa_sigaction == (void *)SIG_IGN) {
......
......@@ -59,9 +59,6 @@
#ifdef CONFIG_TIMERFD
#include <sys/timerfd.h>
#endif
#ifdef TARGET_GPROF
#include <sys/gmon.h>
#endif
#ifdef CONFIG_EVENTFD
#include <sys/eventfd.h>
#endif
......@@ -1864,6 +1861,28 @@ static abi_long do_setsockopt(int sockfd, int level, int optname,
case IPV6_RECVHOPLIMIT:
case IPV6_2292HOPLIMIT:
case IPV6_CHECKSUM:
case IPV6_ADDRFORM:
case IPV6_2292PKTINFO:
case IPV6_RECVTCLASS:
case IPV6_RECVRTHDR:
case IPV6_2292RTHDR:
case IPV6_RECVHOPOPTS:
case IPV6_2292HOPOPTS:
case IPV6_RECVDSTOPTS:
case IPV6_2292DSTOPTS:
case IPV6_TCLASS:
#ifdef IPV6_RECVPATHMTU
case IPV6_RECVPATHMTU:
#endif
#ifdef IPV6_TRANSPARENT
case IPV6_TRANSPARENT:
#endif
#ifdef IPV6_FREEBIND
case IPV6_FREEBIND:
#endif
#ifdef IPV6_RECVORIGDSTADDR
case IPV6_RECVORIGDSTADDR:
#endif
val = 0;
if (optlen < sizeof(uint32_t)) {
return -TARGET_EINVAL;
......@@ -2358,6 +2377,28 @@ static abi_long do_getsockopt(int sockfd, int level, int optname,
case IPV6_RECVHOPLIMIT:
case IPV6_2292HOPLIMIT:
case IPV6_CHECKSUM:
case IPV6_ADDRFORM:
case IPV6_2292PKTINFO:
case IPV6_RECVTCLASS:
case IPV6_RECVRTHDR:
case IPV6_2292RTHDR:
case IPV6_RECVHOPOPTS:
case IPV6_2292HOPOPTS:
case IPV6_RECVDSTOPTS:
case IPV6_2292DSTOPTS:
case IPV6_TCLASS:
#ifdef IPV6_RECVPATHMTU
case IPV6_RECVPATHMTU:
#endif
#ifdef IPV6_TRANSPARENT
case IPV6_TRANSPARENT:
#endif
#ifdef IPV6_FREEBIND
case IPV6_FREEBIND:
#endif
#ifdef IPV6_RECVORIGDSTADDR
case IPV6_RECVORIGDSTADDR:
#endif
if (get_user_u32(len, optlen))
return -TARGET_EFAULT;
if (len < 0)
......
......@@ -72,9 +72,8 @@ const char *cpu_to_uname_machine(void *cpu_env)
#define COPY_UTSNAME_FIELD(dest, src) \
do { \
/* __NEW_UTS_LEN doesn't include terminating null */ \
(void) strncpy((dest), (src), __NEW_UTS_LEN); \
(dest)[__NEW_UTS_LEN] = '\0'; \
memcpy((dest), (src), MIN(sizeof(src), sizeof(dest))); \
(dest)[sizeof(dest) - 1] = '\0'; \
} while (0)
int sys_uname(struct new_utsname *buf)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册