Statistics
| Branch: | Revision:

root / linux-user / syscall.c @ 0b959cf5

History | View | Annotate | Download (284.4 kB)

# Date Author Comment
20d155bc 11/07/2013 08:02 am Stefan Weil

linux-user: Fix stat64 syscall for SPARC64

Some targets use a stat64 structure for the stat64 syscall while others
use a stat structure. SPARC64 used the wrong kind.

Instead of extending the conditional compilation in syscall.c, now a
macro TARGET_HAS_STRUCT_STAT64 is defined whenever a target has a...

0d78b3b5 09/24/2013 10:47 am Laurent Vivier

linux-user: add some IPV6 commands in setsockop()

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

dbf4f796 09/24/2013 10:47 am Petar Jovanovic

linux-user: correct how SOL_SOCKET is converted from target to host and back

Previous implementation does not take into account that SOL_SOCKET constant
can be arch specific. This change fixes some issues with sendmsg/recvmsg.

Signed-off-by: Petar Jovanovic <>...

89aaf1a6 09/24/2013 10:47 am Riku Voipio

[v2] linux-user: implement m68k atomic syscalls

With nptl enabled, atomic_cmpxchg_32 and atomic_barrier
system calls are needed. This patch enabled really dummy
versions of the system calls, modeled after the m68k
kernel code.

With this patch I am able to execute m68k binaries...

53d09b76 09/24/2013 10:47 am Edgar E. Iglesias

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

8070e7be 09/24/2013 10:47 am Richard Henderson

alpha-linux-user: Fix umount syscall numbers

It has been pointed out on LKML that the alpha umount syscall numbers
are 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 if
NR_oldumount exists. That's more complicated than we need in QEMU,...

de6b9933 09/24/2013 10:47 am Laurent Vivier

linux-user: convert /proc/net/route when endianess differs

This patch allows to have IP addresses in correct order
in the case of "netstat -nr" when the endianess of the
guest differs from one of the host.

For instance, an m68k guest on an x86_64 host:
...

f57d4192 09/24/2013 10:47 am Laurent Vivier

linux-user: Add setsockopt(SO_ATTACH_FILTER)

This is needed to be able to run dhclient.

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

4a24a758 09/10/2013 09:11 pm Peter Maydell

linux-user: Allow targets to specify a minimum uname release

For newer target architectures, glibc can be picky about the kernel
version: for example, it will not run on an aarch64 system unless
the kernel reports itself as at least 3.8.0. Accommodate this by...

09701199 09/10/2013 09:11 pm Alexander Graf

linux-user: Fix up AArch64 syscall handlers

Some syscall handlers have special code for ARM enabled that we don't
need on AArch64. Exclude AArch64 in those cases. In other places we
can share struct definitions with other targets or have to provide our
own....

bdc44640 09/03/2013 01:25 pm Andreas Färber

cpu: Use QTAILQ for CPU list

Introduce CPU_FOREACH(), CPU_FOREACH_SAFE() and CPU_NEXT() shorthand
macros.

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

95c1eb19 07/30/2013 03:56 am Peter Maydell

linux-user: Return success from m68k set_thread_area syscall

The m68k set_thread_area syscall implementation failed to set the
return value. Correctly set it zero, since this syscall will always
succeed.

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

82f05b69 07/23/2013 05:28 pm Peter Maydell

linux-user: Fix pipe syscall return for SPARC

SPARC is one of the CPUs which has a funny syscall ABI for the
pipe syscall; add it to the set of special cases in do_pipe().

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

b24c882b 07/23/2013 05:28 pm Alexander Graf

linux-user: Reset copied CPUs in cpu_copy() always

When a new thread gets created, we need to reset non arch specific state to
get the new CPU into clean state.

However this reset should happen before the arch specific CPU contents get
copied over. Otherwise we end up having clean reset state in our newly created...

24cb36a6 07/22/2013 09:54 pm Peter Maydell

configure: Make NPTL non-optional

Now all linux-user targets support building with NPTL, we can make it
mandatory. 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...

2667e71c 07/22/2013 09:54 pm Peter Maydell

linux-user: Enable NPTL for x86-64

Add x86-64 implementation of cpu_set_tls() (like the kernel, we
just have to call do_arch_prctl() to set FS); this allows us to
enable NPTL.

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

bc22eb44 07/22/2013 09:54 pm Alexander Graf

linux-user: Add i386 TLS setter

We can easily set the TLS on i386. Add code to do so.

Signed-off-by: Alexander Graf <>
[PMM: also remove "target_nptl=no" line from configure, for
consistency with other patches in this series]
Signed-off-by: Peter Maydell <>...

4ce6243d 07/22/2013 09:54 pm Peter Maydell

linux-user: Clean up handling of clone() argument order

Linux manages to have three separate orderings of the arguments to
the clone() syscall on different architectures. In the kernel these
are selected via CONFIG_CLONE_BACKWARDS and CONFIG_CLONE_BACKWARDS2....

d312bbe1 07/22/2013 09:54 pm Peter Maydell

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 the
implementation of the following syscall; add it.

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

1ccd9374 07/22/2013 09:54 pm Peter Maydell

linux-user: Enable NPTL for m68k

For m68k, per-thread data is a purely kernel construct with no
CPU level support. Implement it via a field in the TaskState structure,
used by cpu_set_tls() and the set_thread_area/get_thread_area
syscalls. This allows us to enable compilation with NPTL....

51455c59 07/10/2013 06:54 pm Anthony Liguori

Merge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into staging

QOM CPUState refactorings

  • Fix for OpenRISCCPU subclasses
  • Fix for gdbstub CPU selection
  • Move linux-user CPU functions into new header
  • CPUState part 10 refactoring: first_cpu, next_cpu, cpu_single_env et al....
a2247f8e 07/09/2013 10:33 pm Andreas Färber

linux-user: Change thread_env to CPUState

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

182735ef 07/09/2013 10:32 pm Andreas Färber

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

9b056fcc 07/09/2013 10:20 pm Andreas Färber

linux-user: Clean up do_syscall() Coding Style for TARGET_NR_exit

In particular fix 6-/10-char indentation.

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

463d8e73 07/05/2013 03:45 pm Andreas Schwab

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 interception
for open and readlink to handle this case. Also, do the same interception...

7ff7b666 07/05/2013 03:45 pm Laurent Vivier

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 eth0
SIOCADDRT: Bad address
$ netstat -nr
Kernel IP routing table...

1acae9f2 07/05/2013 03:45 pm Peter Maydell

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 by
CONFIG_UTIMENSAT, not CONFIG_ATFILE. Some older glibc don't
have utimensat() (even if they have the other *at() functions)....

f651e6ae 07/05/2013 03:45 pm Petar Jovanovic

linux-user: improve target_to_host_sock_type conversion

Previous implementation has failed to take into account different value of
SOCK_NONBLOCK on target and host, and existence of SOCK_CLOEXEC.
The same conversion has to be applied both for do_socket and do_socketpair,...

3307e236 06/12/2013 06:20 pm Peter Maydell

linux-user: Allow getdents to be provided by getdents64

Newer architectures may only implement the getdents64 syscall, not
getdents. Provide an implementation of getdents in terms of getdents64
so that we can run getdents-using targets on a getdents64-only host....

c0d472b1 06/12/2013 06:20 pm Peter Maydell

linux-user: Drop direct use of openat etc syscalls

The linux-user syscall emulation layer currently supports the
openat family of syscalls via two mechanisms: simply calling
the corresponding libc functions, and making direct syscalls.
Since glibc has supported these functions since at least glibc...

d2d6b857 06/01/2013 01:25 pm Lei Li

linux-user: Fix typo in comment

Signed-off-by: Lei Li <>
Reviewed-by: Stefan Weil <>
Signed-off-by: Michael Tokarev <>

e24fed4e 05/18/2013 03:35 pm Christophe Lyon

fix /proc/self/maps output

Add a space at end of line when there is no filename to print, to
conform to linux kernel format (see show_map_vma() in
fs/proc/task_mmu.c).

Signed-off-by: Christophe Lyon <>
Reviewed-by: Peter Maydell <>...

7edd2cf1 04/26/2013 12:52 pm Peter Maydell

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

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