History | View | Annotate | Download (286.1 kB)
linux-user: Implement BLKPG ioctl
Signed-off-by: Andreas Färber <afaerber@suse.de>Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user: Fix error handling in target_to_host_semarray()
Fix two issues in error handling in target_to_host_semarray(): * don't leak the host_array buffer if lock_user fails * return an error if malloc() fails
v2: added missing * -Riku Voipio
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>...
linux-user: Fix error handling in lock_iovec()
In lock_iovec() if lock_user() failed we were doing an unlock_userbut not a free(vec), which is the wrong way round. We were alsoassuming that free() and unlock_user() don't touch errno, whichis not guaranteed. Fix both these problems....
linux-user: refactor do_socketcall()
Refactor do_socketcall() to do argument conversion/checking first,according to a lookup table (which call has how many args) andby calling the right function second with ready-to-go arguments.
This ensures that all arguments are handled as abi_long, according...
linux-user: fixed recvfrom() addrlen
addrlen parameter of recvfrom() of type socklen_t* was read intovariable of type socklen_t, that caused zeroing out of upper 4 byteswhen running s390x on top of x86_64. This patch changes addrlen typeto abi_ulong....
linux-user: fixed getsockopt() optlen
optlen parameter of getsockopt() of type socklen_t* was read intovariable of type socklen_t, that caused zeroing out of upper 4 byteswhen running s390x on top of x86_64. This patch changes optlen typeto abi_ulong....
linux-user: Support the accept4 socketcall
Cc: Riku Voipio <riku.voipio@iki.fi>Signed-off-by: André Hentschel <nerv@dawncrow.de>Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Reviewed-by: Erik de Castro Lopo <erikd@mega-nerd.com>Reviewed-by: Laurent Vivier <laurent@vivier.eu>...
linux-user: pass correct parameter to do_shmctl()
Fix shmctl issue by passing correct parameter buf to do_shmctl().
Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user: create target_structs header to place ipc_perm and shmid_ds
Creating target_structs header in linux-user/$arch/ and makingtarget_ipc_perm and target_shmid_ds its first inhabitants.The struct defintions may/should be further fine-tuned by arch maintainers....
linux-user: Implement handling of 5 POSIX timer syscalls.
Implement timer_create, timer_settime, timer_gettime, timer_getoverrunand timer_delete.
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user: Fix stat64 syscall for SPARC64
Some targets use a stat64 structure for the stat64 syscall while othersuse a stat structure. SPARC64 used the wrong kind.
Instead of extending the conditional compilation in syscall.c, now amacro TARGET_HAS_STRUCT_STAT64 is defined whenever a target has a...
linux-user: add some IPV6 commands in setsockop()
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>
linux-user: correct how SOL_SOCKET is converted from target to host and back
Previous implementation does not take into account that SOL_SOCKET constantcan be arch specific. This change fixes some issues with sendmsg/recvmsg.
Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>...
[v2] linux-user: implement m68k atomic syscalls
With nptl enabled, atomic_cmpxchg_32 and atomic_barriersystem calls are needed. This patch enabled really dummyversions of the system calls, modeled after the m68kkernel code.
With this patch I am able to execute m68k binaries...
linux-user: Handle SOCK_CLOEXEC/NONBLOCK if unavailable on host
If the host lacks SOCK_CLOEXEC, bail out with -EINVAL.If the host lacks SOCK_ONONBLOCK, try to emulate it with fcntl()and O_NONBLOCK.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>...
alpha-linux-user: Fix umount syscall numbers
It has been pointed out on LKML that the alpha umount syscall numbersare named wrong, and a patch to rectify that has been posted for 3.11.
Glibc works around this by treating NR_umount as NR_umount2 ifNR_oldumount exists. That's more complicated than we need in QEMU,...
linux-user: convert /proc/net/route when endianess differs
This patch allows to have IP addresses in correct orderin the case of "netstat -nr" when the endianess of theguest differs from one of the host.
For instance, an m68k guest on an x86_64 host:...
linux-user: Add setsockopt(SO_ATTACH_FILTER)
This is needed to be able to run dhclient.
linux-user: Allow targets to specify a minimum uname release
For newer target architectures, glibc can be picky about the kernelversion: for example, it will not run on an aarch64 system unlessthe kernel reports itself as at least 3.8.0. Accommodate this by...
linux-user: Fix up AArch64 syscall handlers
Some syscall handlers have special code for ARM enabled that we don'tneed on AArch64. Exclude AArch64 in those cases. In other places wecan share struct definitions with other targets or have to provide ourown....
cpu: Use QTAILQ for CPU list
Introduce CPU_FOREACH(), CPU_FOREACH_SAFE() and CPU_NEXT() shorthandmacros.
Signed-off-by: Andreas Färber <afaerber@suse.de>
linux-user: Return success from m68k set_thread_area syscall
The m68k set_thread_area syscall implementation failed to set thereturn value. Correctly set it zero, since this syscall will alwayssucceed.
linux-user: Fix pipe syscall return for SPARC
SPARC is one of the CPUs which has a funny syscall ABI for thepipe syscall; add it to the set of special cases in do_pipe().
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user: Reset copied CPUs in cpu_copy() always
When a new thread gets created, we need to reset non arch specific state toget the new CPU into clean state.
However this reset should happen before the arch specific CPU contents getcopied over. Otherwise we end up having clean reset state in our newly created...
configure: Make NPTL non-optional
Now all linux-user targets support building with NPTL, we can make itmandatory. This is a good idea because: * NPTL is no longer new and experimental; it is completely standard * in practice, linux-user without NPTL is nearly useless for...
linux-user: Enable NPTL for x86-64
Add x86-64 implementation of cpu_set_tls() (like the kernel, wejust have to call do_arch_prctl() to set FS); this allows us toenable NPTL.
linux-user: Add i386 TLS setter
We can easily set the TLS on i386. Add code to do so.
Signed-off-by: Alexander Graf <agraf@suse.de>[PMM: also remove "target_nptl=no" line from configure, for consistency with other patches in this series]Signed-off-by: Peter Maydell <peter.maydell@linaro.org>...
linux-user: Clean up handling of clone() argument order
Linux manages to have three separate orderings of the arguments tothe clone() syscall on different architectures. In the kernel theseare selected via CONFIG_CLONE_BACKWARDS and CONFIG_CLONE_BACKWARDS2....
linux-user: Add missing 'break' in i386 get_thread_area syscall
The i386 code for the get_thread_area syscall was missing a'break' which meant it would have fallen through into theimplementation of the following syscall; add it.
linux-user: Enable NPTL for m68k
For m68k, per-thread data is a purely kernel construct with noCPU level support. Implement it via a field in the TaskState structure,used by cpu_set_tls() and the set_thread_area/get_thread_areasyscalls. This allows us to enable compilation with NPTL....
Merge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into staging
QOM CPUState refactorings
linux-user: Change thread_env to CPUState
cpu: Make first_cpu and next_cpu CPUState
Move next_cpu from CPU_COMMON to CPUState.Move first_cpu variable to qom/cpu.h.
gdbstub needs to use CPUState::env_ptr for now.cpu_copy() no longer needs to save and restore cpu_next.
Acked-by: Paolo Bonzini <pbonzini@redhat.com>...
linux-user: Clean up do_syscall() Coding Style for TARGET_NR_exit
In particular fix 6-/10-char indentation.
linux-user: handle /proc/$$ like /proc/self
Some applications use /proc/$$/... (where $$ is the own pid) instead of/proc/self/... to refer to their own proc files. Extend the interceptionfor open and readlink to handle this case. Also, do the same interception...
linux-user: add SIOCADDRT/SIOCDELRT support
This allows to pass the device name.
You can test this with the "route" command.
WITHOUT this patch:
$ sudo route add -net default gw 10.0.3.1 eth0SIOCADDRT: Bad address$ netstat -nrKernel IP routing table...
linux-user: Fix sys_utimensat (would not compile on old glibc)
Commit c0d472b12e accidentally dropped the definition of__NR_SYS_utimensat even though its use is guarded byCONFIG_UTIMENSAT, not CONFIG_ATFILE. Some older glibc don'thave utimensat() (even if they have the other *at() functions)....
linux-user: improve target_to_host_sock_type conversion
Previous implementation has failed to take into account different value ofSOCK_NONBLOCK on target and host, and existence of SOCK_CLOEXEC.The same conversion has to be applied both for do_socket and do_socketpair,...
linux-user: Allow getdents to be provided by getdents64
Newer architectures may only implement the getdents64 syscall, notgetdents. Provide an implementation of getdents in terms of getdents64so that we can run getdents-using targets on a getdents64-only host....
linux-user: Drop direct use of openat etc syscalls
The linux-user syscall emulation layer currently supports theopenat family of syscalls via two mechanisms: simply callingthe corresponding libc functions, and making direct syscalls.Since glibc has supported these functions since at least glibc...
linux-user: Fix typo in comment
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>Reviewed-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
fix /proc/self/maps output
Add a space at end of line when there is no filename to print, toconform to linux kernel format (see show_map_vma() infs/proc/task_mmu.c).
Signed-off-by: Christophe Lyon <christophe.lyon@linaro.org>Reviewed-by: Peter Maydell <peter.maydell@linaro.org>...
linux-user: fix compile error due to stray colon at end of #ifdef line
Remove a stray colon from the end of a #ifdef line. Some versionsof gcc complain about this: linux-user/syscall.c: In function ‘do_syscall’: linux-user/syscall.c:7606:28: error: extra tokens at end of #ifdef directive [-Werror]...
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.
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.
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.
$ 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.
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>