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

-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJc1VZDAAoJEPMMOL0/L748K10P/3JAdArJi8fpHtF5xW/MIlCq
 ZcJkeytwyTBUnEF1gjYgsS9WrEfAQVUYg8rSgh9OVn6xa//QpwN+6x7Ex6SCUbC8
 EKL5Dff43pQ0EOpakNtUST1zD8vQIQBBUc0HXsQlmPPTW29g0aYZzy9XaTBopvbY
 Z6U3GZS9VQFBYizVRfk/0VoSPS1eeN9rZI8QrIX0JRP2i6XhsgcwMJY/m5EZXtLs
 EI/0+kmFQkLNppIFMJV8Idhrsnqz5S+i59QScbXh+ukF+eFkkF+Mv/F34yYEazwu
 Gam44hXJDplhiceoecg2hzKQDuE68VfDV4t+6Hr71jVubF3Vo5dBQ6+69qxLqd5O
 OX5uUBYrfFXQWWsXdsNkAHZJdaLL43Qf5+aU6CWS0c0zItSt5P2AAzT8SMu5OEYX
 le5hXlDtxDCZAXCeFTEHCmQJaeCjl3Z68hqrmGknwKTU0nnEHo6mUaucybtVQNrn
 BZYGEKi8Mh8wU0vh0khdDNvypML8NVdo8j2TVuxU9D/C7cA4fH39UNKPLv+Z7/Oc
 eHuMhvwR5EWy/nwIJkBQHAP+IM5JpxbiOKhbGVXJ3P6RJmibKR7WM0to4HlFipom
 j0lfl2+2IqfPU4lWyqU4+dAi1FbnLavuLSQzK87kwAGCGyGsiuvzQBElUDt9mDVQ
 uSeJ8oax54oMMQhaxQ6J
 =M/I+
 -----END PGP SIGNATURE-----

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: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2019-05-10 12:49:13 +01:00
commit 5f022626c8
6 changed files with 69 additions and 13 deletions

View File

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

View File

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

View File

@ -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)))

View File

@ -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) {

View File

@ -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)

View File

@ -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)