summaryrefslogtreecommitdiff
path: root/linux-user
AgeCommit message (Collapse)AuthorFilesLines
2016-07-19linux-user: AArch64 has sync_file_range, not sync_file_range2Peter Maydell1-2/+1
The AArch64 Linux ABI syscall 84 is sync_file_range, not sync_file_range2 (in the kernel it uses the asm-generic headers and does not define __ARCH_WANT_SYNC_FILE_RANGE2). Update our TARGET_NR_* definitions accordingly. This fixes the sync_file_range syscall which otherwise gets its arguments in the wrong order. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-07-19linux-user: Fix type for SIOCATMARK ioctlPeter Maydell1-1/+1
The SIOCATMARK ioctl takes an argument which should be a pointer to an integer where the kernel will write the result. We were incorrectly declaring it as TYPE_NULL which would mean it would always fail (with EFAULT) when it should succeed. Correct the type. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-07-19linux-user: define missing sparc syscallsLaurent Vivier1-0/+3
NR_lookup_dcookie, NR_fadvise64, NR_fadvise64_64 Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-07-19linux-user: Fix terminal control ioctlsTimothy Pearson1-6/+6
TIOCGPTN and related terminal control ioctls were not converted to the guest ioctl format on x86_64 targets. Convert these ioctls to enable terminal functionality on x86_64 guests. Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-07-19linux-user: Add some new blk ioctlsPeter Maydell2-0/+40
Add some new blk ioctls (these are 0x12,119 through to 0x12,127). Several of these are used by mke2fs; this silences the warnings: mke2fs 1.42.12 (29-Aug-2014) Unsupported ioctl: cmd=0x127b Unsupported ioctl: cmd=0x127a warning: Unable to get device geometry for /dev/loop5 Unsupported ioctl: cmd=0x127c Unsupported ioctl: cmd=0x127c Unsupported ioctl: cmd=0x1277 Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-07-19linux-user: Handle short lengths in host_to_target_sockaddr()Peter Maydell1-2/+9
If userspace specifies a short buffer for a target sockaddr, the kernel will only copy in as much as it has space for (or none at all if the length is zero) -- see the kernel move_addr_to_user() function. Mimic this in QEMU's host_to_target_sockaddr() routine. In particular, this fixes a segfault running the LTP recvfrom01 test, where the guest makes a recvfrom() call with a bad buffer pointer and other parameters which cause the kernel to set the addrlen to zero; because we did not skip the attempt to swap the sa_family field we segfaulted on the bad address. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-07-19linux-user: Forget about synchronous signal once it is deliveredPeter Maydell1-4/+4
Commit 655ed67c2a248cf which switched synchronous signals to benig recorded in ts->sync_signal rather than in a queue with every other signal had a bug: we failed to clear the flag indicating that a synchronous signal was pending when we delivered it. This meant that we would take the signal again and again every time the guest made a syscall. (This is a bug introduced in my refactoring of Timothy Baldwin's original code.) Fix this by passing in the struct emulated_sigtable* to handle_pending_signal(), so that we clear the pending flag in the ts->sync_signal struct when handling a synchronous signal. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-07-19linux-user: Correct type for LOOP_GET_STATUS{,64} ioctlsPeter Maydell2-6/+7
The LOOP_GET_STATUS and LOOP_GET_STATUS64 ioctls were incorrectly defined as IOC_W rather than IOC_R, which meant we weren't correctly copying the information back from the kernel to the guest. The loop_info64 structure definition was also missing a member and using the wrong type for several 32-bit fields. In particular, this meant that "kpartx -d image.img" didn't work and "losetup -a" behaved strangely. Correct the ioctl type definitions. Reported-by: Chanho Park <chanho61.park@samsung.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-07-19linux-user: Correct type for BLKSSZGETPeter Maydell1-1/+1
The BLKSSZGET ioctl takes an argument which is a pointer to an int. We were incorrectly declaring it to take a pointer to a long, which meant that we would incorrectly write to memory which we should not if the guest is a 64-bit architecture. In particular, kpartx uses this ioctl to write to an int on the stack, which tends to result in it crashing immediately. Reported-by: Chanho Park <chanho61.park@samsung.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-07-19linux-user: Add loop control ioctlsPeter Maydell3-1/+18
Add support for the /dev/loop-control ioctls: LOOP_CTL_ADD LOOP_CTL_REMOVE LOOP_CTL_GET_FREE [RV: fixed to apply to new header guards] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-07-19linux-user: Check sigsetsize argument to syscallsPeter Maydell1-1/+46
Many syscalls which take a sigset_t argument also take an argument giving the size of the sigset_t. The kernel insists that this matches its idea of the type size and fails EINVAL if it is not. Implement this logic in QEMU. (This mostly just means some LTP test cases which check error cases now pass.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
2016-07-19linux-user: add nested netlink typesLaurent Vivier1-4/+316
Nested types are used by the kernel to send link information and protocol properties. We can see following errors with "ip link show": Unimplemented nested type 26 Unimplemented nested type 26 Unimplemented nested type 18 Unimplemented nested type 26 Unimplemented nested type 18 Unimplemented nested type 26 This patch implements nested types 18 (IFLA_LINKINFO) and 26 (IFLA_AF_SPEC). Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-07-19linux-user: convert sockaddr_ll from host to targetLaurent Vivier1-0/+5
As we convert sockaddr for AF_PACKET family for sendto() (target to host) we need also to convert this for getsockname() (host to target). arping uses getsockname() to get the the interface address and uses this address with sendto(). Tested with: /sbin/arping -D -q -c2 -I eno1 192.168.122.88 ... getsockname(3, {sa_family=AF_PACKET, proto=0x806, if2, pkttype=PACKET_HOST, addr(6)={1, 10c37b6b9a76}, [18]) = 0 ... sendto(3, "..." 28, 0, {sa_family=AF_PACKET, proto=0x806, if2, pkttype=PACKET_HOST, addr(6)={1, ffffffffffff}, 20) = 28 ... Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-07-19linux-user: add fd_trans helper in do_recvfrom()Laurent Vivier1-0/+3
Fix passwd using netlink audit. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-07-19linux-user: fix netlink memory corruptionLaurent Vivier1-8/+24
Netlink is byte-swapping data in the guest memory (it's bad). It's ok when the data come from the host as they are generated by the host. But it doesn't work when data come from the guest: the guest can try to reuse these data whereas they have been byte-swapped. This is what happens in glibc: glibc generates a sequence number in nlh.nlmsg_seq and calls sendto() with this nlh. In sendto(), we byte-swap nlmsg.seq. Later, after the recvmsg(), glibc compares nlh.nlmsg_seq with sequence number given in return, and of course it fails (hangs), because nlh.nlmsg_seq is not valid anymore. The involved code in glibc is: sysdeps/unix/sysv/linux/check_pf.c:make_request() ... req.nlh.nlmsg_seq = time (NULL); ... if (TEMP_FAILURE_RETRY (__sendto (fd, (void *) &req, sizeof (req), 0, (struct sockaddr *) &nladdr, sizeof (nladdr))) < 0) <here req.nlh.nlmsg_seq has been byte-swapped> ... do { ... ssize_t read_len = TEMP_FAILURE_RETRY (__recvmsg (fd, &msg, 0)); ... struct nlmsghdr *nlmh; for (nlmh = (struct nlmsghdr *) buf; NLMSG_OK (nlmh, (size_t) read_len); nlmh = (struct nlmsghdr *) NLMSG_NEXT (nlmh, read_len)) { <we compare nlmh->nlmsg_seq with corrupted req.nlh.nlmsg_seq> if (nladdr.nl_pid != 0 || (pid_t) nlmh->nlmsg_pid != pid || nlmh->nlmsg_seq != req.nlh.nlmsg_seq) continue; ... else if (nlmh->nlmsg_type == NLMSG_DONE) /* We found the end, leave the loop. */ done = true; } } while (! done); As we have a continue on "nlmh->nlmsg_seq != req.nlh.nlmsg_seq", "done" cannot be set to "true" and we have an infinite loop. It's why commands like "apt-get update" or "dnf update hangs". Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-07-19linux-user: fd_trans_*_data() returns the lengthLaurent Vivier1-4/+32
fd_trans_target_to_host_data() and fd_trans_host_to_target_data() must return the length of processed data. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-07-18trace: Add per-vCPU tracing states for events with the 'vcpu' propertyLluís Vilanova1-0/+1
Each vCPU gets a 'trace_dstate' bitmap to control the per-vCPU dynamic tracing state of events with the 'vcpu' property. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-07-18trace: [linux-user] Commandline arguments to control tracingLluís Vilanova1-0/+19
[Changed const char *trace_file to char *trace_file since it's a heap-allocated string that needs to be freed. This type is also returned by trace_opt_parse() and used in vl.c. --Stefan] Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Message-id: 146860251784.30668.17339867835129075077.stgit@fimbulvetr.bsc.es Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-07-12Clean up decorations and whitespace around header guardsMarkus Armbruster1-2/+2
Cleaned up with scripts/clean-header-guards.pl. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2016-07-12Clean up ill-advised or unusual header guardsMarkus Armbruster5-10/+11
Cleaned up with scripts/clean-header-guards.pl. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2016-07-12linux-user: Fix broken header guard in syscall_defs.hMarkus Armbruster1-4/+3
Found with scripts/clean-header-guards.pl. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2016-07-12linux-user: Clean up hostdep.h header guardsMarkus Armbruster13-26/+26
These headers all use QEMU_HOSTDEP_H as header guard symbol. Reuse of the same guard symbol in multiple headers is okay as long as they cannot be included together. Since we can avoid guard symbol reuse easily, do so: use guard symbol $target_HOSTDEP_H for linux-user/host/$target/hostdep.h. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2016-07-12linux-user: Clean up target_structs.h header guardsMarkus Armbruster17-34/+34
These headers all use TARGET_STRUCTS_H as header guard symbol. Reuse of the same guard symbol in multiple headers is okay as long as they cannot be included together. Since we can avoid guard symbol reuse easily, do so: use guard symbol $target_TARGET_STRUCTS_H for linux-user/$target/target_structs.h. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2016-07-12linux-user: Clean up target_signal.h header guardsMarkus Armbruster18-54/+54
These headers all use TARGET_SIGNAL_H as header guard symbol. Reuse of the same guard symbol in multiple headers is okay as long as they cannot be included together. Since we can avoid guard symbol reuse easily, do so: use guard symbol $target_TARGET_SIGNAL_H for linux-user/$target/target_signal.h. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2016-07-12linux-user: Clean up target_cpu.h header guardsMarkus Armbruster15-31/+31
These headers all use TARGET_CPU_H as header guard symbol. Reuse of the same guard symbol in multiple headers is okay as long as they cannot be included together. Since we can avoid guard symbol reuse easily, do so: use guard symbol $target_TARGET_CPU_H for linux-user/$target/target_cpu.h. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2016-07-12linux-user: Clean up target_syscall.h header guardsMarkus Armbruster18-51/+53
Some of them use guard symbol TARGET_SYSCALL_H, but we also have CRIS_SYSCALL_H, MICROBLAZE_SYSCALLS_H, TILEGX_SYSCALLS_H and __UC32_SYSCALL_H__. They all upset scripts/clean-header-guards.pl. Reuse of the same guard symbol TARGET_SYSCALL_H in multiple headers is okay as long as they cannot be included together. The script can't tell, so it warns. The script dislikes the other guard symbols, too. They don't match their file name (they should, to make guard collisions less likely), and __UC32_SYSCALL_H__ is a reserved identifier. Clean them all up: use guard symbol $target_TARGET_SYSCALL_H for linux-user/$target/target_sycall.h. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2016-07-12Use #include "..." for our own headers, <...> for othersMarkus Armbruster2-3/+2
Tracked down with an ugly, brittle and probably buggy Perl script. Also move includes converted to <...> up so they get included before ours where that's obviously okay. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Eric Blake <eblake@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
2016-07-07linux-user: Fix i386 safe-syscall.SRichard Henderson1-18/+6
Clang insists that "cmp" is ambiguous with a memory destination, requiring an explicit size suffix. There was a true error in the use of .cfi_def_cfa_offset in the epilogue, but changing to use the proper .cfi_adjust_cfa_offset runs afoul of a clang bug wrt .cfi_restore_state. Better to fold the two epilogues so that we don't trigger the bug. Signed-off-by: Richard Henderson <rth@twiddle.net>
2016-07-04linux-user: Make semihosting heap/stack fields abi_ulongsPeter Maydell1-3/+3
The fields in the TaskState heap_base, heap_limit and stack_base are all guest addresses (representing the locations of the heap and stack for the guest binary), so they should be abi_ulong rather than uint32_t. (This only in practice affects ARM AArch64 since all the other semihosting implementations are 32-bit.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com> Message-id: 1466783381-29506-2-git-send-email-peter.maydell@linaro.org
2016-06-30linux-user: Fix compilation when F_SETPIPE_SZ isn't definedPeter Maydell1-0/+2
Older kernels don't have F_SETPIPE_SZ and F_GETPIPE_SZ (in particular RHEL6's system headers don't define these). Add ifdefs so that we can gracefully fall back to not supporting those guest ioctls rather than failing to build. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-id: 1467304429-21470-1-git-send-email-peter.maydell@linaro.org
2016-06-29Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into stagingPeter Maydell1-16/+16
* serial port fixes (Paolo) * Q35 modeling improvements (Paolo, Vasily) * chardev cleanup improvements (Marc-André) * iscsi bugfix (Peter L.) * cpu_exec patch from multi-arch patches (Peter C.) * pci-assign tweak (Lin Ma) # gpg: Signature made Wed 29 Jun 2016 15:56:30 BST # gpg: using RSA key 0xBFFBD25F78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini/tags/for-upstream: (35 commits) socket: unlink unix socket on remove socket: add listen feature char: clean up remaining chardevs when leaving vhost-user: disable chardev handlers on close vhost-user-test: fix g_cond_wait_until compat implementation vl: smp_parse: fix regression ich9: implement SCI_IRQ_SEL register ich9: implement ACPI_EN register serial: reinstate watch after migration serial: remove watch on reset char: change qemu_chr_fe_add_watch to return unsigned serial: separate serial_xmit and serial_watch_cb serial: simplify tsr_retry reset serial: make tsr_retry unsigned iscsi: fix assertion in is_sector_request_lun_aligned target-*: Don't redefine cpu_exec() pci-assign: Move "Invalid ROM" error message to pci-assign-load-rom.c vnc: generalize "VNC server running on ..." message scsi: esp: fix migration MC146818 RTC: add GPIO access to output IRQ ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-29Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' ↵Peter Maydell1-0/+2
into staging # gpg: Signature made Tue 28 Jun 2016 22:27:20 BST # gpg: using RSA key 0x9CA4ABB381AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8 * remotes/stefanha/tags/tracing-pull-request: trace: [*-user] Add events to trace guest syscalls in syscall emulation mode trace: enable tracing in qemu-img qemu-img: move common options parsing before commands processing trace: enable tracing in qemu-nbd trace: enable tracing in qemu-io trace: move qemu_trace_opts to trace/control.c doc: move text describing --trace to specific .texi file doc: sync help description for --trace with man for qemu.1 Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-29target-*: Don't redefine cpu_exec()Peter Crosthwaite1-16/+16
This function needs to be converted to QOM hook and virtualised for multi-arch. This rename interferes, as cpu-qom will not have access to the renaming causing name divergence. This rename doesn't really do anything anyway so just delete it. Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Message-Id: <69bd25a8678b8b31b91cd9760c777bed1aafb44e.1437212383.git.crosthwaite.peter@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Peter Crosthwaite <crosthwaitepeter@gmail.com>
2016-06-29Merge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20160628' ↵Peter Maydell24-220/+1634
into staging Drop building linux-user targets on HPPA or m68k host systems and add safe_syscall support for i386, aarch64, arm, ppc64 and s390x. # gpg: Signature made Tue 28 Jun 2016 19:31:16 BST # gpg: using RSA key 0xB44890DEDE3C9BC0 # gpg: Good signature from "Riku Voipio <riku.voipio@iki.fi>" # gpg: aka "Riku Voipio <riku.voipio@linaro.org>" # Primary key fingerprint: FF82 03C8 C391 98AE 0581 41EF B448 90DE DE3C 9BC0 * remotes/riku/tags/pull-linux-user-20160628: (24 commits) linux-user: Provide safe_syscall for ppc64 linux-user: Provide safe_syscall for s390x linux-user: Provide safe_syscall for aarch64 linux-user: Provide safe_syscall for arm linux-user: Provide safe_syscall for i386 linux-user: fix x86_64 safe_syscall linux-user: don't swap NLMSG_DATA() fields linux-user: fd_trans_host_to_target_data() must process only received data linux-user: add missing return in netlink switch statement linux-user: update get_thread_area/set_thread_area strace linux-user: fix clone() strace linux-user: add socket() strace linux-user: add socketcall() strace linux-user: Support F_GETPIPE_SZ and F_SETPIPE_SZ fcntls linux-user: Fix wrong type used for argument to rt_sigqueueinfo linux-user: Create a hostdep.h for each host architecture user-exec: Remove unused code for OSX hosts user-exec: Delete now-unused hppa and m68k cpu_signal_handler() code configure: Don't allow user-only targets for unknown CPU architectures configure: Don't override ARCH=unknown if enabling TCI ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-28trace: [*-user] Add events to trace guest syscalls in syscall emulation modeLluís Vilanova1-0/+2
Adds two events to trace syscalls in syscall emulation mode (*-user): * guest_user_syscall: Emitted before the syscall is emulated; contains the syscall number and arguments. * guest_user_syscall_ret: Emitted after the syscall is emulated; contains the syscall number and return value. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Message-id: 146651712411.12388.10024905980452504938.stgit@fimbulvetr.bsc.es Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-06-26linux-user: Provide safe_syscall for ppc64Richard Henderson2-0/+115
Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-06-26linux-user: Provide safe_syscall for s390xRichard Henderson2-0/+113
Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-06-26linux-user: Provide safe_syscall for aarch64Richard Henderson2-0/+98
Signed-off-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> [RV] Updated syscall argument comment to match code
2016-06-26linux-user: Provide safe_syscall for armRichard Henderson2-0/+113
Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-06-26linux-user: Provide safe_syscall for i386Richard Henderson2-0/+135
Signed-off-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-06-26linux-user: fix x86_64 safe_syscallRichard Henderson1-3/+3
Do what the comment says, test for signal_pending non-zero, rather than the current code which tests for bit 0 non-zero. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-26linux-user: don't swap NLMSG_DATA() fieldsLaurent Vivier1-30/+42
If the structure pointed by NLMSG_DATA() is bigger than the size of NLMSG_DATA(), don't swap its fields to avoid memory corruption. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-26linux-user: fd_trans_host_to_target_data() must process only received dataLaurent Vivier1-1/+1
if we process the whole buffer, the netlink helpers can try to swap invalid data. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-26linux-user: add missing return in netlink switch statementLaurent Vivier1-0/+1
Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-26linux-user: update get_thread_area/set_thread_area straceLaurent Vivier1-2/+4
int get_thread_area(struct user_desc *u_info); int set_thread_area(struct user_desc *u_info); Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-26linux-user: fix clone() straceLaurent Vivier1-22/+20
Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-26linux-user: add socket() straceLaurent Vivier2-1/+24
Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-26linux-user: add socketcall() straceLaurent Vivier3-5/+568
Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-26linux-user: Support F_GETPIPE_SZ and F_SETPIPE_SZ fcntlsPeter Maydell3-0/+15
Support the F_GETPIPE_SZ and F_SETPIPE_SZ fcntl operations. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-06-26linux-user: Fix wrong type used for argument to rt_sigqueueinfoPeter Maydell1-1/+4
The third argument to the rt_sigqueueinfo syscall is a pointer to a siginfo_t, not a pointer to a sigset_t. Fix the error in the arguments to lock_user(), which meant that we would not have detected some faults that we should. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>