aboutsummaryrefslogtreecommitdiffstats
path: root/linux-user
AgeCommit message (Collapse)AuthorFilesLines
2012-02-10linux-user: brk() debuggingPaul Brook1-7/+9
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>
2012-02-10linux-user: fail execve() if env/args too bigUlrich Hecht1-0/+9
If the host's page size is equal to or smaller than the target's, native execve() will fail appropriately with E2BIG if called with too big an environment for the target to handle. It may falsely succeed, however, if the host's page size is bigger, and feed the executed target process an environment that is too big for it to handle, at which point QEMU barfs and exits, confusing procmail's autoconf script and causing the build to fail. This patch makes sure that execve() will return E2BIG if the environment is too large for the target. Signed-off-by: Ulrich Hecht <uli@suse.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-02-02linux-user: Fix sa_flags byte swaps for mipsAndreas Färber1-0/+8
sa_flags is uint32_t for mips{,n32,64}, so don't use tswapal(). edited by Riku Voipio: likewise on alpha Reported-by: Khansa Butt <khansa@kics.edu.pk> Suggested-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Andreas Färber <afaerber@suse.de> Cc: Ehsan Ul Haq <ehsan.ulhaq@kics.edu.pk> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-02-02linux-user: Define TARGET_QEMU_ESIGRETURN for mips64Andreas Färber1-0/+3
Copied from mips/syscall.h. Signed-off-by: Khansa Butt <khansa@kics.edu.pk> Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-02-02linux-user: Define TARGET_QEMU_ESIGRETURN for mipsn32Andreas Färber1-0/+3
Copied from mips/syscall.h. Signed-off-by: Ulrich Hecht <uli@suse.de> Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-02-02linux-user: Implement *listxattr syscallsPeter Maydell1-1/+35
Implement listxattr, flistxattr and llistxattr syscalls. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-02-02linux-user/syscall.c: Implement f and l versions of set/get/removexattrPeter Maydell1-9/+70
Implement the f and l versions (operate on fd, don't follow links) of the setxattr, getxattr and removexattr syscalls. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-02-02linux-user: Allow NULL value pointer in setxattr and getxattrPeter Maydell1-6/+18
It's valid to pass a NULL value pointer to setxattr, so don't fail this case EFAULT. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-02-02linux-user: fix wait* syscall status returnsAlexander Graf1-2/+2
When calling wait4 or waitpid with a status pointer and WNOHANG, the syscall can potentially not modify the status pointer input. Now if we have guest code like: int status = 0; waitpid(pid, &status, WNOHANG); if (status) <breakage> then we have to make sure that in case status did not change we actually return the guest's initialized status variable instead of our own uninitialized. We fail to do so today, as we proxy everything through an uninitialized status variable which for me ended up always containing the last error code. This patch fixes some test cases when building yast2-core in OBS for ARM. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-02-02linux-user/strace.c: Correct errno printing for mmap etcPeter Maydell1-5/+4
Correct the printing of errnos for syscalls which are handled via print_syscall_ret_addr (mmap, mmap2, brk, shmat): errnos are returned as negative returned values at this level, not via the host 'errno' variable. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-02-02linux-user: fix QEMU_STRACE=1 segfaultAlexander Graf2-4/+17
While debugging some issues with QEMU_STRACE I stumbled over segmentation faults that were pretty reproducible. Turns out we tried to treat a normal return value as errno, resulting in an access over array boundaries for the resolution. Fix this by allowing failure to resolve invalid errnos into strings. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-02-02linux-user: add SO_PEERCRED support for getsockoptAkos PASZTORY2-1/+39
Signed-off-by: Akos PASZTORY <akos.pasztory@gmail.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-02-02linux-user/main.c: Add option to user-mode emulation so that user can ↵陳韋任1-0/+7
specify log file name QEMU linux user-mode's default log file name is "/tmp/qemu.log". In order to change the log file name, user need to modify the source code then recompile QEMU. This patch allow user use "-D logfile" option to specify the log file name. Signed-off-by: Chen Wen-Ren <chenwj@iis.sinica.edu.tw> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-02-02linux-user: fake /proc/self/auxvAlexander Graf1-0/+30
Gtk tries to read /proc/self/auxv to find its auxv table instead of taking it from its own program memory space. However, when running with linux-user, we see the host's auxv which clearly exposes wrong information. so let's instead expose the guest memory backed auxv tables via /proc/self/auxv as well. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-02-02linux-user: fake /proc/self/statAlexander Graf1-0/+26
The boehm gc finds the program's stack starting pointer by checking /proc/self/stat. Unfortunately, so far it reads qemu's stack pointer which clearly is wrong. So let's instead fake the file so the guest program sees the right address. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-02-02linux-user: fake /proc/self/mapsAlexander Graf1-0/+15
glibc's pthread_attr_getstack tries to find the stack range from /proc/self/maps. Unfortunately, /proc is usually the host's /proc which means linux-user guests see qemu's stack there. Fake the file with a constructed maps entry that exposes the guest's stack range. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-02-02linux-user: add open() hijack infrastructureAlexander Graf1-3/+49
There are a number of files in /proc that expose host information to the guest program. This patch adds infrastructure to override the open() syscall for guest programs to enable us to on the fly generate guest sensible files. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-02-02linux-user: save auxv lengthAlexander Graf2-11/+5
We create our own AUXV segment on stack and save a pointer to it. However we don't save the length of it, so any code that wants to do anything useful with it later on has to walk it again. Instead, let's remember the length of our AUXV segment. This simplifies later uses by a lot. (edited by Riku to apply to qemu HEAD) Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2012-02-02linux-user: stack_base is now mandatory on all targetsRiku Voipio1-1/+1
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-01-10elf: Improve symbol lookup (optimize, fix for bsd-user)Stefan Weil1-7/+4
Coverity complained about local variable key which was only partially initiated. Only key.st_value was set. As this was also the only part of key which was used in function symfind, the code could be optimized by directly passing a pointer to orig_addr. In bsd-user/elfload.c, fix ec822001a2f26eef8701194714f6482b6d852de2 was missing. This was a simple replacement of > by >= in symfind, so I fixed it here without creating an additional patch. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-12-14Fix spelling in comments, documentation and messagesStefan Weil1-1/+1
accidently->accidentally annother->another choosen->chosen consideres->considers decriptor->descriptor developement->development paramter->parameter preceed->precede preceeding->preceding priviledge->privilege propogation->propagation substraction->subtraction throught->through upto->up to usefull->useful Fix also grammar in posix-aio-compat.c Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-06linux-user/syscall.c: Don't skip stracing for fcntl64 failure casePeter Maydell1-2/+4
In an fcntl64 failure path, we were returning directly rather than simply breaking out of the switch statement. This skips the strace code for printing the syscall return value, so don't do that. Acked-by: Alexander Graf <agraf@suse.de> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-06linux-user/arm/nwfpe/fpopcode.h: Fix non-UTF-8 charactersPeter Maydell1-17/+17
Fix some stray non-UTF-8 characters used in some ASCII art tables by converting them to plain ASCII '|' instead. Reviewed-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-06linux-user/cpu-uname.c: Convert to UTF-8Peter Maydell1-1/+1
Convert comment from ISO-8859-1 encoding to UTF-8 to match the rest of QEMU's source code. Reviewed-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-06fix typo: delete redundant semicolonDong Xu Wang1-1/+1
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>
2011-12-02fix spelling in linux-user sub directoryDong Xu Wang5-8/+8
Cc: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-11-11linux-user/elfload.c: Don't memset(NULL..) if malloc() failedPeter Maydell2-4/+3
If a malloc() in copy_elf_strings() failed we would call memset() before the "did malloc fail?" check. Fix this by moving to the glib alloc/free routines for this memory so we can use g_try_malloc0 rather than having a separate memset(). Spotted by Coverity (see bug 887883). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-11-09configure: fix detection for xattr.h on modern distributionsAvi Kivity1-1/+1
Modern distributions place xattr.h in /usr/include/sys, and fold libattr.so into libc. They also don't have an ENOATTR. Make configure detect this, and add a qemu-xattr.h file that directs the #include to the right place. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-10-31Merge remote-tracking branch 'riku/linux-user-for-upstream' into stagingAnthony Liguori9-175/+193
2011-10-27ppc64-linux-user: Fix syscall return type.Richard Henderson1-10/+3
Use target_ulong instead of hard-coded uint32_t. Remove the disabled printf's that are redundant with -strace. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2011-10-27ppc64-linux-user: Properly interpret the entry function descriptor.Richard Henderson1-4/+4
Don't confuse the load address with the load bias. They're equal for ET_DYN objects (i.e. ld.so) but different for ET_EXEC objects (i.e. statically linked). Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2011-10-27sparc-linux-user: Add some missing syscall numbersRichard Henderson1-0/+3
Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-10-27sparc-linux-user: Fixup sending SIGSEGVRichard Henderson1-2/+2
Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2011-10-27sparc-linux-user: Handle SIGILL.Richard Henderson1-0/+9
Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2011-10-27linux-user: implement reboot syscallAlexander Graf1-1/+7
For OBS, we're running a full cross-guest inside of a VM. When a build is done there, we reboot the guest as shutdown mechanism. Unfortunately, reboot is not implemented in linux-user. So this mechanism fails, spilling unpretty warnings. This patch implements sys_reboot() emulation. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-10-27linux-user: fix openatAlexander Graf1-13/+1
When running openat using qemu-arm, we stumbled over invalid permissions on the created files. The reason for this is that the mode parameter gets treates as an O_... flag, which it isn't - it's a permission bitmask. This patch removes the needless translation of the mode parameter, rendering permission passing of openat() to work with linux-user. Reported-by: Dirk Mueller <dmueller@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-10-27linux-user: fix abi_(u)long, target_ulong mismatchMatthias Braun6-143/+157
abi_(u)long might be different from target_ulong, so don't use tswapl but introduce a new tswapal Signed-off-by: Matthias Braun <matze@braunis.de> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-10-27linux-user: fix rlimit syscalls on sparc(64)Matthias Braun1-1/+6
Signed-off-by: Matthias Braun <matze@braunis.de> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-10-27linux-user: fix TARGET_RLIM_INFINITY declarationMatthias Braun1-1/+1
Signed-off-by: Matthias Braun <matze@braunis.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2011-10-26target-sparc: Change fpr representation to doubles.Richard Henderson1-12/+16
This allows a more efficient representation for 64-bit hosts. It should be about the same for 32-bit hosts, as we can still access the individual pieces of the double. Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-10-21linux-user: Fix broken "-version" optionPeter Maydell1-11/+8
Fix the "-version" option, which was accidentally broken in commit fc9c541: * exit after printing version information rather than proceeding blithely onward (and likely printing the full usage message) * correct the cut-n-paste error in the usage message for it * don't insist on the presence of a following argument for options which don't take an argument (this was preventing 'qemu-arm -version' from working) * remove a spurious argc check from the beginning of main() which meant 'QEMU_VERSION=1 qemu-arm' didn't work. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-10-05linux-user: Remove unused codeStefan Weil1-4/+1
The code is unused since 8 years, so remove it. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-09-26Merge remote-tracking branch 'riku/linux-user-for-upstream' into stagingAnthony Liguori4-220/+579
2011-09-16Remove blanks before \n in output stringsStefan Weil1-1/+1
Those blanks violate the coding conventions, see scripts/checkpatch.pl. Blanks missing after colons in the changed lines were added. This patch does not try to fix tabs, long lines and other problems in the changed lines, therefore checkpatch.pl reports many violations. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-09Fix include statements for qemu-common.hStefan Weil1-2/+1
* qemu-common.h is not a system include file, so it should be included with "" instead of <>. Otherwise incremental builds might fail because only local include files are checked for changes. * linux-user/syscall.c included the file twice. Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Jan Kiszka <jan.kiszka@siemens.com> Acked-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-09-09introduce environment variables for all qemu-user optionsJohannes Schauer1-207/+348
(Edits by Riku Voipio to apply to current HEAD) Rework option parsing code for linux-user in a table-driven manner to allow environment variables for all commandline options. Also generate usage() output from option table. Fix complains from checkpatch.pl, also have envlist global Signed-off-by: Johannes Schauer <j.schauer@email.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2011-09-09linux-user: Implement setxattr/getxattr/removexattr syscallsAn-Cheng Huang1-3/+51
This patch implements the setxattr, getxattr, and removexattr syscalls if CONFIG_ATTR is enabled. Note that since libattr uses indirect syscalls for these, this change depends on the fix for indirect syscall handling on MIPS. Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: An-Cheng Huang <ancheng@ubnt.com>
2011-09-09linux-user: Verify MIPS syscall argumentsAn-Cheng Huang1-5/+17
On MIPS, some syscall arguments are taken from the stack. This patch adds verification such that do_syscall() is only invoked if all arguments have been successfully taken from the stack. Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: An-Cheng Huang <ancheng@ubnt.com>
2011-09-09linux-user: Fix MIPS indirect syscall handlingAn-Cheng Huang1-1/+1
Change the number of argument for MIPS sys_syscall from 0 to 8. This allows arguments for indirect syscalls to be processed correctly. Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: An-Cheng Huang <ancheng@ubnt.com>
2011-09-09linux-user: Exit with an error if we couldn't set up gdbserverPeter Maydell1-1/+5
If gdbserver_start() fails (usually because we couldn't bind to the requested TCP port) then exit qemu rather than blithely continuing. This brings the linux-user behaviour in to line with system mode. Signed-off-by: Riku Voipio <riku.voipio@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>