Statistics
| Branch: | Revision:

root / linux-user / syscall.c @ 5a37532d

History | View | Annotate | Download (278.7 kB)

# Date Author Comment
c7128c9f 04/19/2013 10:48 am Petar Jovanovic

linux-user: change do_semop to return target errno when unsuccessful

do_semop() is called from two places, and one of these fails to convert
return error to target errno when semop fails. This patch changes the
function to always return target errno in case of an unsuccessful call....

9ab709be 04/19/2013 10:48 am Andreas Schwab

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 <>
Reviewed-by: Peter Maydell <>
Signed-off-by: Riku Voipio <>

03903ffc 04/19/2013 10:48 am Andreas Schwab

linux-user: fix setgroups/getgroups for non-UID16 archs

Don't assume target_id is a short.

Signed-off-by: Andreas Schwab <>
Signed-off-by: Riku Voipio <>

5947c697 04/12/2013 03:33 pm Petar Jovanovic

linux-user: pass correct host flags to eventfd2 call

This change makes conversion of TARGET_O_NONBLOCK and TARGET_O_CLOEXEC flags
to host flags before calling eventfd for TARGET_NR_eventfd2.

Signed-off-by: Petar Jovanovic <>
Reviewed-by: Peter Maydell <>...

e9a970a8 03/11/2013 02:35 pm Peter Maydell

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_list
syscalls means we cannot implement them in QEMU. Make get_robust_list
silently return ENOSYS rather than using the default "print message and...

a94b4987 03/11/2013 02:34 pm Peter Maydell

linux-user: Implement accept4

Implement the accept4 syscall (which is identical to accept
but has an additional flags argument).

Signed-off-by: Peter Maydell <>
Reviewed-by: Richard Henderson <>
Signed-off-by: Riku Voipio <>

a8fd1aba 03/11/2013 02:34 pm Peter Maydell

linux-user: Implement sendfile and sendfile64

Implement the sendfile and sendfile64 syscalls. This implementation
passes all the LTP test cases for these syscalls.

Signed-off-by: Peter Maydell <>
Reviewed-by: Richard Henderson <>...

dfae8e00 03/11/2013 02:34 pm Peter Maydell

linux-user: make bogus negative iovec lengths fail EINVAL

If the guest passes us a bogus negative length for an iovec, fail
EINVAL rather than proceeding blindly forward. This fixes some of
the error cases tests for readv and writev in the LTP.

Signed-off-by: Peter Maydell <>...

f2b79ce9 03/11/2013 01:05 pm Dillon Amburgey

linux-user: Support setgroups syscall with no groups

Signed-off-by: Dillon Amburgey <>
Reviewed-by: Peter Maydell <>
Signed-off-by: Riku Voipio <>

cce246e0 03/11/2013 01:04 pm John Rigby

linux-user/syscall.c: handle FUTEX_WAIT_BITSET in do_futex

Upstream libc has recently changed to start using
FUTEX_WAIT_BITSET instead of FUTEX_WAIT and this
is causing do_futex to return -TARGET_ENOSYS.

Pass bitset in val3 to sys_futex which will be
ignored by kernel for the FUTEX_WAIT case....

0d34282f 02/16/2013 03:50 pm Andreas Färber

cpu: Move host_tid field to CPUState

Change gdbstub's cpu_index() argument to CPUState now that CPUArchState
is no longer used.

Signed-off-by: Andreas Färber <>

bd4bd24e 02/07/2013 12:39 am Anthony Liguori

Merge branch 'for-linux-user' of https://git.gitorious.org/qemu-m68k/qemu-m68k into staging

5c099537 02/01/2013 11:53 pm Paolo Bonzini

cpu: do not use object_delete

CPUs are never added to the composition tree, so delete is achieved
simply by removing the last references to them.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Anthony Liguori <>

79dd77de 01/30/2013 01:13 pm Laurent Vivier

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 --debug
using 1723744788 as msg key
msg_key=1723744788
1723744788:431...

1b09aeb9 01/30/2013 01:13 pm Laurent Vivier

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 TIMEO
568 setsockopt(3,SOL_SOCKET,SO_SNDTIMEO,{1,0},8) = 0
568 setsockopt(3,SOL_SOCKET,SO_RCVTIMEO,{1,0},8) = 0...

c07ecc68 01/30/2013 01:13 pm Laurent Vivier

linux-user: correct reboot()

According to man reboot(2), the 4th argument is only used with
LINUX_REBOOT_CMD_RESTART2. In other cases, trying to convert
the value can generate EFAULT.

Signed-off-by: Laurent Vivier <>
Reviewed-by: Peter Maydell <>

9468a5d4 01/16/2013 06:15 pm Laurent Vivier

alpha-linux-user: Correct select

Alpha, like s390x, passes all select arguments in registers.

Signed-off-by: Laurent Vivier <>
Signed-off-by: Richard Henderson <>

2ba7f730 01/16/2013 06:13 pm Laurent Vivier

alpha-linux-user: Translate fcntl l_type

The values of F_RDLCK, F_WRLCK, F_UNLCK, F_EXLCK, F_SHLCK
differ between alpha and other linux architectures.

This patch allows to run "dpkg" (database lock).

Signed-off-by: Laurent Vivier <>
Signed-off-by: Richard Henderson <>

586b0bef 01/04/2013 03:38 pm John Spencer

linux-user/syscall.c: remove forward declarations

instead use the correct headers that define these functions.

Requested-by: Stefan Weil <>
Signed-off-by: John Spencer <>
Reviewed-by: Amos Kong <>...

27dd7730 12/20/2012 01:15 am Anthony Liguori

Merge remote-tracking branch 'bonzini/header-dirs' into staging

  • bonzini/header-dirs: (45 commits)
    janitor: move remaining public headers to include/
    hw: move executable format header files to hw/
    fpu: move public header file to include/fpu
    softmmu: move remaining include files to include/ subdirectories...
1de7afc9 12/19/2012 09:32 am Paolo Bonzini

misc: move include files to include/qemu/

Signed-off-by: Paolo Bonzini <>

c56dc774 12/18/2012 06:22 pm John Spencer

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.h
additionally to grp.h, the wrong declaration causes a build error....

24c35a50 12/08/2012 08:49 pm Peter Maydell

linux-user: Merge pread/pwrite into pread64/pwrite64

The Linux syscalls underlying pread() and pwrite() take a 64 bit
offset on all architectures, even if some of them name the syscall
"pread/pwrite" rather than "pread64/pwrite64" for historical reasons....

41a05a45 10/19/2012 09:28 pm Aurelien Jarno

Merge branch 'linux-user-for-upstream' of git://git.linaro.org/people/rikuvoipio/qemu

  • 'linux-user-for-upstream' of git://git.linaro.org/people/rikuvoipio/qemu:
    linux-user: register align p{read, write}64
    linux-user: ppc: mark as long long aligned
    tcg: Remove TCG_TARGET_HAS_GUEST_BASE define...
a5b3bdcb 10/19/2012 02:24 pm Edgar E. Iglesias

microblaze: Support setting of TLS ptr

Signed-off-by: Edgar E. Iglesias <>

ae017a5b 10/12/2012 02:42 pm Alexander Graf

linux-user: register align p{read, write}64

pread64 and pwrite64 pass 64bit parameters which for some architectures need
to 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....

4a1def4e 10/12/2012 02:38 pm Alexander Graf

linux-user: ppc: mark as long long aligned

The SysV PPC32 ABI dictates that long long (64bit) parameters are pass in odd/even
register 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....

a05c6409 10/12/2012 02:01 pm Richard Henderson

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 <>
Signed-off-by: Riku Voipio <>

3d21d29c 10/12/2012 01:59 pm Richard Henderson

linux-user: Implement gethostname

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>
Signed-off-by: Riku Voipio <>

f287b2c2 10/12/2012 01:59 pm Richard Henderson

linux-user: Perform more checks on iovec lists

Validate count between 0 and IOV_MAX. Limit total length of
operation in the same way the kernel does.

Signed-off-by: Richard Henderson <>
Signed-off-by: Riku Voipio <>

229d3376 10/12/2012 01:58 pm Alexander Graf

linux-user: fix statfs

The statfs syscall should always memset(0) its full struct extent before
writing to it. Newer versions of the syscall use one of the reserved fields
for flags, which would otherwise get stale values from uncleaned memory.

This fixes libarchive for me, which got confused about the return value of...

1bdd7c7e 10/12/2012 01:58 pm Alexander Graf

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 not
initialized in non-primary threads.

However, ts->info is, and the stack layout information we're looking...

ad11ad77 09/23/2012 09:35 am Stefan Weil

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 also
replaced by g_free....

333858b7 08/27/2012 10:17 am Dmitry V. Levin

linux-user: fix emulation of getdents

In case when TARGET_ABI_BITS 32 && HOST_LONG_BITS 64, the last
byte of the target dirent structure (aka d_type byte) was never copied
from the host dirent structure, thus breaking everything that relies
on valid d_type value, e.g. glob(3)....

0d07fe47 08/22/2012 06:47 pm Jim Meyering

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 <>
Signed-off-by: Anthony Liguori <>

ca619067 08/14/2012 10:26 pm Jing Huang

linux-user: pass sockaddr from host to target

Signed-off-by: Jing Huang <>
Reviewed-by: Peter Maydell <>
Signed-off-by: Peter Maydell <>

920394db 08/14/2012 10:26 pm Jing Huang

linux-user: make do_setsockopt support SOL_RAW ICMP_FILTER socket option

Signed-off-by: Jing Huang <>
Reviewed-by: Peter Maydell <>
Signed-off-by: Peter Maydell <>

aebf5bc7 08/14/2012 10:26 pm Jing Huang

linux-user: make host_to_target_cmsg support SO_TIMESTAMP cmsg_type

Signed-off-by: Jing Huang <>
Reviewed-by: Peter Maydell <>
Signed-off-by: Peter Maydell <>

dd6e957a 08/13/2012 02:45 pm Peter Maydell

linux-user: Move target_to_host_errno_table[] setup out of ioctl loop

The code to initialise the target_to_host_errno_table[] array was
accidentally inside the loop through checking and initialising all
the supported ioctls. This was harmless but meant that we reinitialised the...

95c09828 08/04/2012 07:37 pm Richard Henderson

alpha-linux-user: Fix the getpriority syscall

Alpha uses unbiased priority values in the syscall, with the a3
return value signaling error conditions. Therefore, properly
interpret the libc getpriority as needed for the guest rather
than passing the host value through unchanged....

6e06d515 08/04/2012 07:37 pm Richard Henderson

alpha-linux-user: Handle TARGET_SSI_IEEE_RAISE_EXCEPTION properly

We weren't aggregating the exceptions, nor raising signals properly.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

afc8763f 08/04/2012 07:37 pm Richard Henderson

linux-user: Handle O_SYNC, O_NOATIME, O_CLOEXEC, O_PATH

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

e7ea6cbe 08/04/2012 07:37 pm Richard Henderson

linux-user: Translate pipe2 flags; add to strace

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

0229f5a3 08/04/2012 07:37 pm Richard Henderson

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.

Reviewed-by: Peter Maydell <>
Signed-off-by: Richard Henderson <>

d962783e 07/28/2012 12:13 am Jia Liu

target-or32: Add linux user support

Add QEMU OpenRISC linux user support.

Signed-off-by: Jia Liu <>
Signed-off-by: Blue Swirl <>

ff18b762 06/05/2012 12:00 am Andreas Färber

linux-user: Use cpu_reset() after cpu_init() / cpu_copy()

Eliminates cpu_state_reset() usage.

Signed-off-by: Andreas Färber <>

1a49ef2a 05/03/2012 05:31 pm Alexander Graf

linux-user: fix emulation of /proc/self/maps

Improve the emulation of /proc/self/maps by reading the underlying
host maps file and passing lines through with addresses adjusted
to be guest addresses. This is necessary to avoid false triggers
of the glibc check that a format string containing '%n' is not in...

209c4849 05/03/2012 05:31 pm Andreas Färber

linux-user: Clean up interim solution for exit syscall

After all target CPUs have been QOM'ified, we no longer need an #ifdef
to switch between object_delete() and g_free() in NPTL thread exit.

Signed-off-by: Andreas Färber <>
Signed-off-by: Riku Voipio <>

11ea4090 04/15/2012 07:54 pm Andreas Färber

linux-user: Fix exit syscall with QOM CPU

For QOM'ified CPUs we cannot g_free() CPUArchState, we must
object_delete() the object it is embedded into.

Fixes LP#982321 (invalid free() while executing pacman with qemu-arm).

Reported-by: Serge Schneider <>...

56e904ec 04/06/2012 06:49 pm Alexander Graf

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 <>
Signed-off-by: Riku Voipio <>

20249ae1 04/06/2012 06:49 pm Alexander Graf

linux-user: fix fallocate

Fallocate gets off_t parameters passed in, so we should also read them out
accordingly.

Signed-off-by: Alexander Graf <>


v1 -> v2:

- unbreak 64-bit guests

Signed-off-by: Riku Voipio <>

1e6722f8 04/06/2012 06:49 pm Peter Maydell

linux-user/syscall.c: Fix indentation in prctl handling

Clean up the odd indentation of this switch statement before
we double its size by adding new cases to it.

Signed-off-by: Peter Maydell <>
Signed-off-by: Riku Voipio <>

db9526b1 04/06/2012 06:49 pm Peter Maydell

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.

Signed-off-by: Peter Maydell <>
Signed-off-by: Riku Voipio <>

e0e65bee 04/06/2012 06:49 pm Fabio Erculiani

linux-user: improve fake /proc/self/stat making `ps` not segfault.

With the current fake /proc/self/stat implementation `ps` is
segfaulting because it expects to read PID and argv0 as first and
second field respectively, with the latter being enclosed between...

9349b4f9 03/14/2012 11:20 pm Andreas Färber

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...

1bba0dc9 03/14/2012 11:20 pm Andreas Färber

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 static
functions with strongly typed argument to indirect.

Signed-off-by: Andreas Färber <>...

3a0c6c4a 02/10/2012 12:48 pm Paul Brook

linux-user: brk() debugging

Fix format type mismatches in do_brk debug printfs.

Signed-off-by: Paul Brook <>
Signed-off-by: Stefan Hajnoczi <>

a6f79cc9 02/10/2012 12:44 pm Ulrich Hecht

linux-user: fail execve() if env/args too big

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...

36c08d49 02/02/2012 05:51 pm Alexander Graf

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 /proc
which means linux-user guests see qemu's stack there.

Fake the file with a constructed maps entry that exposes the guest's...

480b8e7d 02/02/2012 05:51 pm Alexander Graf

linux-user: fake /proc/self/stat

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...

257450ee 02/02/2012 05:51 pm Alexander Graf

linux-user: fake /proc/self/auxv

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...

583359a6 02/02/2012 05:51 pm Akos PASZTORY

linux-user: add SO_PEERCRED support for getsockopt

Signed-off-by: Akos PASZTORY <>
Signed-off-by: Riku Voipio <>

962b289e 02/02/2012 05:51 pm Alexander Graf

linux-user: fix QEMU_STRACE=1 segfault

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...

5379557b 02/02/2012 05:51 pm Alexander Graf

linux-user: fix wait* syscall status returns

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);...
e3c33ec6 02/02/2012 05:51 pm Peter Maydell

linux-user: Allow NULL value pointer in setxattr and getxattr

It's valid to pass a NULL value pointer to setxattr, so don't
fail this case EFAULT.

Signed-off-by: Peter Maydell <>
Signed-off-by: Riku Voipio <>

30297b55 02/02/2012 05:51 pm Peter Maydell

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.

Signed-off-by: Peter Maydell <>
Signed-off-by: Riku Voipio <>

fb5590f7 02/02/2012 05:51 pm Peter Maydell

linux-user: Implement *listxattr syscalls

Implement listxattr, flistxattr and llistxattr syscalls.

Signed-off-by: Peter Maydell <>
Signed-off-by: Riku Voipio <>

3be14d05 02/02/2012 05:51 pm Alexander Graf

linux-user: add open() hijack infrastructure

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....

31b63193 12/06/2011 12:08 pm Peter Maydell

linux-user/syscall.c: Don't skip stracing for fcntl64 failure case

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....

3a93113a 12/06/2011 11:56 am Dong Xu Wang

fix typo: delete redundant semicolon

Double semicolons should be single.

Signed-off-by: Dong Xu Wang <>
Signed-off-by: Stefan Hajnoczi <>

4f26f2b6 11/09/2011 08:06 pm Avi Kivity

configure: fix detection for xattr.h on modern distributions

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....

0f6b4d21 10/27/2011 02:42 pm Alexander Graf

linux-user: implement reboot syscall

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()...

cbb21eed 10/27/2011 02:42 pm Matthias Braun

linux-user: fix abi_(u)long, target_ulong mismatch

abi_(u)long might be different from target_ulong, so don't use tswapl
but introduce a new tswapal

Signed-off-by: Matthias Braun <>
Signed-off-by: Riku Voipio <>

f4c69010 10/27/2011 02:42 pm Alexander Graf

linux-user: fix openat

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,...

11ddeea9 09/26/2011 03:59 pm Anthony Liguori

Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging

b2bedb21 09/16/2011 04:25 pm Stefan Weil

Remove blanks before \n in output strings

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...

5a61cb60 09/09/2011 11:56 am Stefan Weil

Fix include statements for qemu-common.h

  • 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....
a790ae38 09/09/2011 10:48 am An-Cheng Huang

linux-user: Implement setxattr/getxattr/removexattr syscalls

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....

70afc343 09/09/2011 10:45 am Cédric VINCENT

linux-user: Fix initialization of the heap contents when allocating new pages

Technically the new mmapped pages are already initialized to zero
since they are anonymous, however we have to take care with the
contents that come from the remaining part of the previous page: it...

7267c094 08/21/2011 07:01 am Anthony Liguori

Use glib memory allocation and free functions

qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <>

00aa0040 07/25/2011 05:38 pm Blue Swirl

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]...

48e515d4 07/13/2011 05:38 pm Riku Voipio

linux-user: make MIPS and ARM eabi use same argument reordering

MIPS uses similar calling convention than ARM eabi, where when using
64-bit values some registers are skipped. This patch makes MIPS and ARM
eabi share the argument reordering code.

This affects ftruncate64, creating insane sized fails (or just failing)....

e22b7015 07/12/2011 02:42 pm Wesley W. Terpstra

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 a
near infinite loop trying to close all the file descriptors from 0 to...

95b33b2f 07/12/2011 02:38 pm Wesley W. Terpstra

mips: rlimit incorrectly converts values

Byte swap was applied in the wrong order with testing for
RLIM_INFINITY. On mips bigendian from an amd64 system this results in
infinity being misinterpretted as 2^31-1.

This is a serious bug because it causes setrlimit stack size to kill...

8f04eeb3 07/11/2011 04:35 pm Peter Maydell

linux-user/syscall.c: Enforce pselect6 sigset size restrictions

Enforce the same restriction on the size of the sigset passed to
pselect6 as the Linux kernel does. This is both correct and silences
a gcc 4.6 warning about a write-only variable.

Signed-off-by: Peter Maydell <>...

163a05a8 07/11/2011 04:34 pm Peter Maydell

linux-user: Implement prlimit64 syscall

Implement the prlimit64 syscall.

Slightly modified to apply upstream -Riku

Signed-off-by: Peter Maydell <>
Signed-off-by: Riku Voipio <>

bc088ba1 06/21/2011 08:30 pm Juan Quintela

linux-user: syscall should use sanitized arg1

Looking at the other architectures, we should be using "how" not "arg1".

Signed-off-by: Juan Quintela <>
[: remove unnecessary initialisation of how]
Signed-off-by: Peter Maydell <>...

5945cfcb 06/21/2011 08:30 pm Peter Maydell

linux-user: Bump do_syscall() up to 8 syscall arguments

On 32 bit MIPS a few syscalls have 7 arguments, and so to call
them via NR_syscall the guest needs to be able to pass 8 arguments
to do_syscall(). Raise the number of arguments do_syscall() takes
accordingly....

bfcedc57 06/21/2011 08:30 pm Riku Voipio

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 it
by reading the correct arguments when on mips.

Signed-off-by: Riku Voipio <>

4d1de87c 06/21/2011 08:30 pm vincent

linux-user: Fix the computation of the requested heap size

There were several remaining bugs in the previous implementation of
do_brk():

1. the value of "new_alloc_size" was one page too large when the
requested brk was aligned on a host page boundary....
055e0906 06/21/2011 08:30 pm Mike Frysinger

linux-user: add pselect6 syscall support

Some architectures (like Blackfin) only implement pselect6 (and skip
select/newselect). So add support for it.

Signed-off-by: Mike Frysinger <>
Signed-off-by: Riku Voipio <>

1add8698 06/21/2011 08:30 pm Juan Quintela

syscall: really return ret code

We assign ret with the error code, but then return 0 unconditionally.

Signed-off-by: Juan Quintela <>
Signed-off-by: Peter Maydell <>
Signed-off-by: Riku Voipio <>

00faf08c 06/21/2011 08:29 pm Peter Maydell

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 a
large size is likely to overwrite important things like qemu itself
or the host libc. So we drop MAP_FIXED and handle "mapped but at...

a4c075f1 05/20/2011 06:35 pm Ulrich Hecht

s390x: s390x-linux-user support

This patch adds support for running s390x binaries in the linux-user emulation
code.

Signed-off-by: Ulrich Hecht <>
Signed-off-by: Alexander Graf <>

67bd9ede 05/08/2011 12:59 pm Stefan Weil

linux-user: Replace deprecated function

Function bzero is deprecated, so replace it by function memset.

Signed-off-by: Stefan Weil <>
Signed-off-by: Stefan Hajnoczi <>

e95d3bf0 05/02/2011 10:00 am Mike McCormack

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 <>
Reviewed-by: Stefan Hajnoczi <>...

cd18f05e 05/02/2011 10:00 am Mike McCormack

Don't zero out buffer in sched_getaffinity

The kernel doesn't fill the buffer provided to sched_getaffinity
with zero bytes, so neither should QEMU.

Signed-off-by: Mike McCormack <>
Reviewed-by: Stefan Hajnoczi <>...

86fcd946 04/26/2011 10:15 am Laurent Vivier

linux-user: add ioctl(SIOCGIWNAME, ...) support.

Allow to run properly following program from linux-user:

/* cc -o wifi wifi.c */

#include &lt;stdio.h&gt;
#include &lt;sys/ioctl.h&gt;
#include &lt;sys/types.h&gt;
#include &lt;sys/socket.h&gt;
#include &lt;linux/wireless.h&gt;
#include &lt;netinet/in.h&gt;...
42a39fbe 04/26/2011 10:15 am Alexander Graf

linux-user: add s390x to llseek list

We keep a list of host architectures that do llseek with the same
syscall as lseek. S390x is one of them, so let's add it to the list.

Original-patch-by: Ulrich Hecht <>
Signed-off-by: Alexander Graf <>...

0c866a7e 04/26/2011 10:15 am Riku Voipio

linux-user: untie syscalls from UID16

Quite a number of uid/gid related syscalls are only defined on systems
with USE_UID16 defined. This is apperently based on the idea that these
system calls would never be called on non-UID16 systems. Make these
syscalls available for all architectures that define them....