History | View | Annotate | Download (278.7 kB)
linux-user: change do_semop to return target errno when unsuccessful
do_semop() is called from two places, and one of these fails to convertreturn error to target errno when semop fails. This patch changes thefunction to always return target errno in case of an unsuccessful call....
linux-user: fix undefined shift in copy_to_user_fdset
If TARGET_ABI_BITS is bigger than 32 we shift by more than the size of int.
Signed-off-by: Andreas Schwab <schwab@suse.de>Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user: fix setgroups/getgroups for non-UID16 archs
Don't assume target_id is a short.
Signed-off-by: Andreas Schwab <schwab@suse.de>Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user: pass correct host flags to eventfd2 call
This change makes conversion of TARGET_O_NONBLOCK and TARGET_O_CLOEXEC flagsto host flags before calling eventfd for TARGET_NR_eventfd2.
Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>Reviewed-by: Peter Maydell <peter.maydell@linaro.org>...
linux-user/syscall.c: Don't warn about unimplemented get_robust_list
The nature of the kernel ABI for the get_robust_list and set_robust_listsyscalls means we cannot implement them in QEMU. Make get_robust_listsilently return ENOSYS rather than using the default "print message and...
linux-user: Implement accept4
Implement the accept4 syscall (which is identical to acceptbut has an additional flags argument).
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user: Implement sendfile and sendfile64
Implement the sendfile and sendfile64 syscalls. This implementationpasses all the LTP test cases for these syscalls.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Reviewed-by: Richard Henderson <rth@twiddle.net>...
linux-user: make bogus negative iovec lengths fail EINVAL
If the guest passes us a bogus negative length for an iovec, failEINVAL rather than proceeding blindly forward. This fixes some ofthe error cases tests for readv and writev in the LTP.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>...
linux-user: Support setgroups syscall with no groups
Signed-off-by: Dillon Amburgey <dillona@dillona.com>Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user/syscall.c: handle FUTEX_WAIT_BITSET in do_futex
Upstream libc has recently changed to start usingFUTEX_WAIT_BITSET instead of FUTEX_WAIT and thisis causing do_futex to return -TARGET_ENOSYS.
Pass bitset in val3 to sys_futex which will beignored by kernel for the FUTEX_WAIT case....
cpu: Move host_tid field to CPUState
Change gdbstub's cpu_index() argument to CPUState now that CPUArchStateis no longer used.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Merge branch 'for-linux-user' of https://git.gitorious.org/qemu-m68k/qemu-m68k into staging
cpu: do not use object_delete
CPUs are never added to the composition tree, so delete is achievedsimply by removing the last references to them.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
linux-user: correct msgrcv()
All parameters must be swapped before the call of do_msgrcv().
Allow faked (debian fakeroot daemon) to work properly.
WITHOUT this patch:
$ faked-sysv --foreground --debugusing 1723744788 as msg keymsg_key=17237447881723744788:431...
linux-user: correct setsockopt()
SO_SNDTIMEO and SO_RCVTIMEO take a struct timeval, not an int
To test this, you can use :
QEMU_STRACE= ping localhost 2>&1 |grep TIMEO568 setsockopt(3,SOL_SOCKET,SO_SNDTIMEO,{1,0},8) = 0568 setsockopt(3,SOL_SOCKET,SO_RCVTIMEO,{1,0},8) = 0...
linux-user: correct reboot()
According to man reboot(2), the 4th argument is only used withLINUX_REBOOT_CMD_RESTART2. In other cases, trying to convertthe value can generate EFAULT.
Signed-off-by: Laurent Vivier <laurent@vivier.eu>Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
alpha-linux-user: Correct select
Alpha, like s390x, passes all select arguments in registers.
Signed-off-by: Laurent Vivier <laurent@vivier.eu>Signed-off-by: Richard Henderson <rth@twiddle.net>
alpha-linux-user: Translate fcntl l_type
The values of F_RDLCK, F_WRLCK, F_UNLCK, F_EXLCK, F_SHLCKdiffer between alpha and other linux architectures.
This patch allows to run "dpkg" (database lock).
linux-user/syscall.c: remove forward declarations
instead use the correct headers that define these functions.
Requested-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: John Spencer <maillist-qemu@barfooze.de>Reviewed-by: Amos Kong <kongjianjun@gmail.com>...
Merge remote-tracking branch 'bonzini/header-dirs' into staging
misc: move include files to include/qemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
linux-user/syscall.c: remove wrong forward decl of setgroups()
this declaration is wrong:the correct prototype on linux is:int setgroups(size_t size, const gid_t *list);
since by default musl libc exposes this symbol in unistd.hadditionally to grp.h, the wrong declaration causes a build error....
linux-user: Merge pread/pwrite into pread64/pwrite64
The Linux syscalls underlying pread() and pwrite() take a 64 bitoffset on all architectures, even if some of them name the syscall"pread/pwrite" rather than "pread64/pwrite64" for historical reasons....
Merge branch 'linux-user-for-upstream' of git://git.linaro.org/people/rikuvoipio/qemu
microblaze: Support setting of TLS ptr
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
linux-user: register align p{read, write}64
pread64 and pwrite64 pass 64bit parameters which for some architectures needto be aligned to special argument pairs, creating a gap argument.
Handle this special case the same way we handle it in other places of the code....
linux-user: ppc: mark as long long aligned
The SysV PPC32 ABI dictates that long long (64bit) parameters are pass in odd/evenregister pairs. Because unlike ARM and MIPS we start at an odd register number,we can reuse the same aligning code that ARM and MIPS use....
linux-user: Fix siginfo handling
Compare signal numbers in the proper domain.Convert all of the fields for SIGIO and SIGCHLD.
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user: Implement gethostname
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>
linux-user: Perform more checks on iovec lists
Validate count between 0 and IOV_MAX. Limit total length ofoperation in the same way the kernel does.
linux-user: fix statfs
The statfs syscall should always memset(0) its full struct extent beforewriting to it. Newer versions of the syscall use one of the reserved fieldsfor flags, which would otherwise get stale values from uncleaned memory.
This fixes libarchive for me, which got confused about the return value of...
linux-user: fix multi-threaded /proc/self/maps
When reading our faked /proc/self/maps from a secondary thread,we get an invalid stack entry. This is because ts->stack_base is notinitialized in non-primary threads.
However, ts->info is, and the stack layout information we're looking...
linux-user: Remove redundant null check and replace free by g_free
Report from smatch:
linux-user/syscall.c:3632 do_ioctl_dm(220) info: redundant null check on big_buf calling free()
'big_buf' was allocated by g_malloc0, therefore free was alsoreplaced by g_free....
linux-user: fix emulation of getdents
In case when TARGET_ABI_BITS 32 && HOST_LONG_BITS 64, the lastbyte of the target dirent structure (aka d_type byte) was never copiedfrom the host dirent structure, thus breaking everything that relieson valid d_type value, e.g. glob(3)....
linux-user: do_msgrcv: don't leak host_mb upon TARGET_EFAULT failure
Also, use g_malloc to avoid NULL-deref upon OOM.
Signed-off-by: Jim Meyering <meyering@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
linux-user: pass sockaddr from host to target
Signed-off-by: Jing Huang <jing.huang.pku@gmail.com>Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
linux-user: make do_setsockopt support SOL_RAW ICMP_FILTER socket option
linux-user: make host_to_target_cmsg support SO_TIMESTAMP cmsg_type
linux-user: Move target_to_host_errno_table[] setup out of ioctl loop
The code to initialise the target_to_host_errno_table[] array wasaccidentally inside the loop through checking and initialising allthe supported ioctls. This was harmless but meant that we reinitialised the...
alpha-linux-user: Fix the getpriority syscall
Alpha uses unbiased priority values in the syscall, with the a3return value signaling error conditions. Therefore, properlyinterpret the libc getpriority as needed for the guest ratherthan passing the host value through unchanged....
alpha-linux-user: Handle TARGET_SSI_IEEE_RAISE_EXCEPTION properly
We weren't aggregating the exceptions, nor raising signals properly.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Richard Henderson <rth@twiddle.net>
linux-user: Handle O_SYNC, O_NOATIME, O_CLOEXEC, O_PATH
linux-user: Translate pipe2 flags; add to strace
alpha-linux-user: Properly handle the non-rt sigprocmask syscall.
Name the syscall properly for QEMU, kernel source notwithstanding.Fix syntax errors in the code thus enabled within do_syscall.
target-or32: Add linux user support
Add QEMU OpenRISC linux user support.
Signed-off-by: Jia Liu <proljc@gmail.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
linux-user: Use cpu_reset() after cpu_init() / cpu_copy()
Eliminates cpu_state_reset() usage.
linux-user: fix emulation of /proc/self/maps
Improve the emulation of /proc/self/maps by reading the underlyinghost maps file and passing lines through with addresses adjustedto be guest addresses. This is necessary to avoid false triggersof the glibc check that a format string containing '%n' is not in...
linux-user: Clean up interim solution for exit syscall
After all target CPUs have been QOM'ified, we no longer need an #ifdefto switch between object_delete() and g_free() in NPTL thread exit.
Signed-off-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user: Fix exit syscall with QOM CPU
For QOM'ified CPUs we cannot g_free() CPUArchState, we mustobject_delete() the object it is embedded into.
Fixes LP#982321 (invalid free() while executing pacman with qemu-arm).
Reported-by: Serge Schneider <serge@xecdesign.com>...
linux-user: implement device mapper ioctls
This patch implements all ioctls currently implemented by device mapper,enabling us to run dmsetup and kpartx inside of linux-user.
Signed-off-by: Alexander Graf <agraf@suse.de>Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user: fix fallocate
Fallocate gets off_t parameters passed in, so we should also read them outaccordingly.
Signed-off-by: Alexander Graf <agraf@suse.de>
v1 -> v2:
- unbreak 64-bit guests
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user/syscall.c: Fix indentation in prctl handling
Clean up the odd indentation of this switch statement beforewe double its size by adding new cases to it.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user: Add support for prctl PR_GET_NAME and PR_SET_NAME
Add support for the prctl options PR_GET_NAME and PR_SET_NAME,which take or return a name in a 16 byte buffer pointed to by arg2.
linux-user: improve fake /proc/self/stat making `ps` not segfault.
With the current fake /proc/self/stat implementation `ps` issegfaulting because it expects to read PID and argv0 as first andsecond field respectively, with the latter being enclosed between...
Rename CPUState -> CPUArchState
Scripted conversion: for file in .[hc] hw/.[hc] hw/kvm/*.[hc] linux-user/*.[hc] linux-user/m68k/*.[hc] bsd-user/*.[hc] darwin-user/*.[hc] tcg/*/*.[hc] target-*/cpu.h; do sed -i "s/CPUState/CPUArchState/g" $file done...
Rename cpu_reset() to cpu_state_reset()
Frees the identifier cpu_reset for QOM CPUs (manual rename).
Don't hide the parameter type behind explicit casts, use staticfunctions with strongly typed argument to indirect.
Signed-off-by: Andreas Färber <afaerber@suse.de>...
linux-user: brk() debugging
Fix format type mismatches in do_brk debug printfs.
Signed-off-by: Paul Brook <paul@codesourcery.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
linux-user: fail execve() if env/args too big
If the host's page size is equal to or smaller than the target's, nativeexecve() will fail appropriately with E2BIG if called with too big anenvironment for the target to handle. It may falsely succeed, however, if...
linux-user: fake /proc/self/maps
glibc's pthread_attr_getstack tries to find the stack range from/proc/self/maps. Unfortunately, /proc is usually the host's /procwhich means linux-user guests see qemu's stack there.
Fake the file with a constructed maps entry that exposes the guest's...
linux-user: fake /proc/self/stat
The boehm gc finds the program's stack starting pointer bychecking /proc/self/stat. Unfortunately, so far it readsqemu's stack pointer which clearly is wrong.
So let's instead fake the file so the guest program sees the...
linux-user: fake /proc/self/auxv
Gtk tries to read /proc/self/auxv to find its auxv table instead oftaking it from its own program memory space.
However, when running with linux-user, we see the host's auxv whichclearly exposes wrong information. so let's instead expose the guest...
linux-user: add SO_PEERCRED support for getsockopt
Signed-off-by: Akos PASZTORY <akos.pasztory@gmail.com>Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user: fix QEMU_STRACE=1 segfault
While debugging some issues with QEMU_STRACE I stumbled over segmentationfaults that were pretty reproducible. Turns out we tried to treat anormal return value as errno, resulting in an access over array boundaries...
linux-user: fix wait* syscall status returns
When calling wait4 or waitpid with a status pointer and WNOHANG, thesyscall can potentially not modify the status pointer input. Now if wehave guest code like:
int status = 0; waitpid(pid, &status, WNOHANG);...
linux-user: Allow NULL value pointer in setxattr and getxattr
It's valid to pass a NULL value pointer to setxattr, so don'tfail this case EFAULT.
linux-user/syscall.c: Implement f and l versions of set/get/removexattr
Implement the f and l versions (operate on fd, don't follow links)of the setxattr, getxattr and removexattr syscalls.
linux-user: Implement *listxattr syscalls
Implement listxattr, flistxattr and llistxattr syscalls.
linux-user: add open() hijack infrastructure
There are a number of files in /proc that expose host informationto the guest program. This patch adds infrastructure to overridethe open() syscall for guest programs to enable us to on the flygenerate guest sensible files....
linux-user/syscall.c: Don't skip stracing for fcntl64 failure case
In an fcntl64 failure path, we were returning directly rather thansimply breaking out of the switch statement. This skips the stracecode for printing the syscall return value, so don't do that....
fix typo: delete redundant semicolon
Double semicolons should be single.
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
configure: fix detection for xattr.h on modern distributions
Modern distributions place xattr.h in /usr/include/sys, and foldlibattr.so into libc. They also don't have an ENOATTR.
Make configure detect this, and add a qemu-xattr.h file thatdirects the #include to the right place....
linux-user: implement reboot syscall
For OBS, we're running a full cross-guest inside of a VM. When a buildis done there, we reboot the guest as shutdown mechanism.
Unfortunately, reboot is not implemented in linux-user. So this mechanismfails, spilling unpretty warnings. This patch implements sys_reboot()...
linux-user: fix abi_(u)long, target_ulong mismatch
abi_(u)long might be different from target_ulong, so don't use tswaplbut introduce a new tswapal
Signed-off-by: Matthias Braun <matze@braunis.de>Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
linux-user: fix openat
When running openat using qemu-arm, we stumbled over invalid permissionson the created files. The reason for this is that the mode parameter getstreates as an O_... flag, which it isn't - it's a permission bitmask.
This patch removes the needless translation of the mode parameter,...
Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging
Remove blanks before \n in output strings
Those blanks violate the coding conventions, seescripts/checkpatch.pl.
Blanks missing after colons in the changed lines were added.
This patch does not try to fix tabs, long lines and otherproblems in the changed lines, therefore checkpatch.pl reports...
Fix include statements for qemu-common.h
linux-user: Implement setxattr/getxattr/removexattr syscalls
This patch implements the setxattr, getxattr, and removexattr syscallsif CONFIG_ATTR is enabled.
Note that since libattr uses indirect syscalls for these, this changedepends on the fix for indirect syscall handling on MIPS....
linux-user: Fix initialization of the heap contents when allocating new pages
Technically the new mmapped pages are already initialized to zerosince they are anonymous, however we have to take care with thecontents that come from the remaining part of the previous page: it...
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Wrap recv to avoid warnings
Avoid warnings like these by wrapping recv(): CC slirp/ip_icmp.o/src/qemu/slirp/ip_icmp.c: In function 'icmp_receive':/src/qemu/slirp/ip_icmp.c:418:5: error: passing argument 2 of 'recv' from incompatible pointer type [-Werror]...
linux-user: make MIPS and ARM eabi use same argument reordering
MIPS uses similar calling convention than ARM eabi, where when using64-bit values some registers are skipped. This patch makes MIPS and ARMeabi share the argument reordering code.
This affects ftruncate64, creating insane sized fails (or just failing)....
mips: rlimit codes are not the same
The codes for get/setrlimit differ between linux target platforms.This patch adds conversion.This is important else programs (rsyslog, python, ...) can go into anear infinite loop trying to close all the file descriptors from 0 to...
mips: rlimit incorrectly converts values
Byte swap was applied in the wrong order with testing forRLIM_INFINITY. On mips bigendian from an amd64 system this results ininfinity being misinterpretted as 2^31-1.
This is a serious bug because it causes setrlimit stack size to kill...
linux-user/syscall.c: Enforce pselect6 sigset size restrictions
Enforce the same restriction on the size of the sigset passed topselect6 as the Linux kernel does. This is both correct and silencesa gcc 4.6 warning about a write-only variable.
linux-user: Implement prlimit64 syscall
Implement the prlimit64 syscall.
Slightly modified to apply upstream -Riku
linux-user: syscall should use sanitized arg1
Looking at the other architectures, we should be using "how" not "arg1".
Signed-off-by: Juan Quintela <quintela@redhat.com>[peter.maydell@linaro.org: remove unnecessary initialisation of how]Signed-off-by: Peter Maydell <peter.maydell@linaro.org>...
linux-user: Bump do_syscall() up to 8 syscall arguments
On 32 bit MIPS a few syscalls have 7 arguments, and so to callthem via NR_syscall the guest needs to be able to pass 8 argumentsto do_syscall(). Raise the number of arguments do_syscall() takesaccordingly....
linux-user: Fix sync_file_range on 32bit mips
As noticed while looking at "Bump do_syscall() up to 8 syscall arguments" patch, sync_file_range uses a pad argument on 32bit mips. Deal with itby reading the correct arguments when on mips.
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
linux-user: Fix the computation of the requested heap size
There were several remaining bugs in the previous implementation ofdo_brk():
1. the value of "new_alloc_size" was one page too large when the requested brk was aligned on a host page boundary....
linux-user: add pselect6 syscall support
Some architectures (like Blackfin) only implement pselect6 (and skipselect/newselect). So add support for it.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
syscall: really return ret code
We assign ret with the error code, but then return 0 unconditionally.
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
linux-user: Don't use MAP_FIXED in do_brk()
Since mmap() with MAP_FIXED will map over the top of existing mappings,it's a bad idea to use it to implement brk(), because brk() with alarge size is likely to overwrite important things like qemu itselfor the host libc. So we drop MAP_FIXED and handle "mapped but at...
s390x: s390x-linux-user support
This patch adds support for running s390x binaries in the linux-user emulationcode.
Signed-off-by: Ulrich Hecht <uli@suse.de>Signed-off-by: Alexander Graf <agraf@suse.de>
linux-user: Replace deprecated function
Function bzero is deprecated, so replace it by function memset.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Fix buffer overrun in sched_getaffinity
Zeroing of the cpu array should start from &cpus[kernel_ret]not &cpus[num_zeros_to_fill].
This fixes a crash in EFL's edje_cc running under qemu-arm.
Signed-off-by: Mike McCormack <mj.mccormack@samsung.com>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>...
Don't zero out buffer in sched_getaffinity
The kernel doesn't fill the buffer provided to sched_getaffinitywith zero bytes, so neither should QEMU.
linux-user: add ioctl(SIOCGIWNAME, ...) support.
Allow to run properly following program from linux-user:
/* cc -o wifi wifi.c */
#include <stdio.h> #include <sys/ioctl.h> #include <sys/types.h> #include <sys/socket.h> #include <linux/wireless.h> #include <netinet/in.h>...
linux-user: add s390x to llseek list
We keep a list of host architectures that do llseek with the samesyscall as lseek. S390x is one of them, so let's add it to the list.
Original-patch-by: Ulrich Hecht <uli@suse.de>Signed-off-by: Alexander Graf <agraf@suse.de>...
linux-user: untie syscalls from UID16
Quite a number of uid/gid related syscalls are only defined on systemswith USE_UID16 defined. This is apperently based on the idea that thesesystem calls would never be called on non-UID16 systems. Make thesesyscalls available for all architectures that define them....