QEMU With E2K User Support
Go to file
Mike Frysinger f17f4989fa linux-user: fix readlink handling with magic exe symlink
The current code always returns the length of the path when it should
be returning the number of bytes it wrote to the output string.

Further, readlink is not supposed to append a NUL byte, but the current
snprintf logic will always do just that.

Even further, if you pass in a length of 0, you're suppoesd to get back
an error (EINVAL), but the current logic just returns 0.

Further still, if there was an error reading the symlink, we should not
go ahead and try to read the target buffer as it is garbage.

Simple test for the first two issues:
$ cat test.c
int main() {
    char buf[50];
    size_t len;
    for (len = 0; len < 10; ++len) {
        memset(buf, '!', sizeof(buf));
        ssize_t ret = readlink("/proc/self/exe", buf, len);
        buf[20] = '\0';
        printf("readlink(/proc/self/exe, {%s}, %zu) = %zi\n", buf, len, ret);
    }
    return 0;
}

Now compare the output of the native:
$ gcc test.c -o /tmp/x
$ /tmp/x
$ strace /tmp/x

With what qemu does:
$ armv7a-cros-linux-gnueabi-gcc test.c -o /tmp/x -static
$ qemu-arm /tmp/x
$ qemu-arm -strace /tmp/x

Signed-off-by: Mike Frysinger <vapier@chromium.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2014-08-22 15:06:33 +03:00
audio audio: Drop superfluous conditionals around g_free() 2014-06-13 12:34:54 +02:00
backends SCSI changes that enable sending vendor-specific commands via virtio-scsi. 2014-08-19 13:00:57 +01:00
block qcow2: fix new_blocks double-free in alloc_refcount_block() 2014-08-15 18:03:26 +01:00
bsd-user bsd-user: Fix syscall format, add strace support for more syscalls 2014-06-11 00:25:06 +01:00
default-configs pc: implement pc-dimm device abstraction 2014-06-19 16:41:47 +03:00
disas disas/libvixl: prepend the include path of libvixl header files 2014-07-08 12:45:57 +01:00
docs SCSI changes that enable sending vendor-specific commands via virtio-scsi. 2014-08-19 13:00:57 +01:00
dtc@bc895d6d09 dtc: add submodule 2013-04-18 13:50:53 +02:00
fpu fpu: softfloat: drop INLINE macro 2014-06-23 11:00:12 -04:00
fsdev virtfs-proxy-helper: fix call to accept 2014-04-28 08:55:32 +04:00
gdb-xml target-arm: Support fp registers in gdb stub 2013-12-17 19:42:32 +00:00
hw arm: stellaris: Remove misleading address_space_mem var 2014-08-19 19:02:40 +01:00
include linux-user: /proc/self/maps content 2014-08-22 15:06:33 +03:00
libcacard vscclient: Add required headers to fix build on FreeBSD 2014-06-24 20:01:24 +04:00
libdecnumber libdecnumber: Fix decNumberSetBCD 2014-06-16 13:24:29 +02:00
linux-headers linux-headers: update linux headers to kvm/next 2014-06-16 13:24:41 +02:00
linux-user linux-user: fix readlink handling with magic exe symlink 2014-08-22 15:06:33 +03:00
net tap-bsd: implement a FreeBSD only version of tap_open 2014-08-01 15:57:48 +00:00
pc-bios pc-bios/s390-ccw: update binary 2014-07-08 15:08:03 +02:00
pixman@97336fad32 qapi: move include files to include/qobject/ 2012-12-19 08:31:31 +01:00
po po: Add Chinese translation 2014-08-09 00:06:41 +04:00
qapi QMP: Add support for Archipelago 2014-08-15 15:07:14 +02:00
qga channel-posix: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK) 2014-08-15 18:03:13 +01:00
qobject json-lexer: fix escaped backslash in single-quoted string 2014-06-23 11:01:24 -04:00
qom qom: object: move unparenting to the child property's release callback 2014-08-17 23:25:24 +02:00
roms pseries: Update SLOF firmware image to qemu-slof-20140630 2014-07-08 12:10:36 +02:00
scripts trace: teach lttng backend to use format strings 2014-08-12 14:26:12 +01:00
slirp Increase maximum number of session of the internal TFTP server. 2014-06-24 20:01:24 +04:00
stubs monitor: fix use after free 2014-08-18 14:39:10 -04:00
sysconfigs/target Eliminate cpus-x86_64.conf file 2012-09-21 15:12:58 +02:00
target-alpha trace: [tcg] Include TCG-tracing header on all targets 2014-08-12 14:26:12 +01:00
target-arm arm: cortex-a9: Fix cache-line size and associativity 2014-08-19 19:02:40 +01:00
target-cris trace: [tcg] Include TCG-tracing header on all targets 2014-08-12 14:26:12 +01:00
target-i386 linux-user: Fix syscall instruction usermode emulation on X86_64 2014-08-22 15:06:33 +03:00
target-lm32 trace: [tcg] Include TCG-tracing header on all targets 2014-08-12 14:26:12 +01:00
target-m68k trace: [tcg] Include TCG-tracing header on all targets 2014-08-12 14:26:12 +01:00
target-microblaze trace: [tcg] Include TCG-tracing header on all targets 2014-08-12 14:26:12 +01:00
target-mips trace: [tcg] Include TCG-tracing header on all targets 2014-08-12 14:26:12 +01:00
target-moxie softmmu: introduce cpu_ldst.h 2014-06-05 16:10:33 +02:00
target-openrisc trace: [tcg] Include TCG-tracing header on all targets 2014-08-12 14:26:12 +01:00
target-ppc trace: [tcg] Include TCG-tracing header on all targets 2014-08-12 14:26:12 +01:00
target-s390x trace: [tcg] Include TCG-tracing header on all targets 2014-08-12 14:26:12 +01:00
target-sh4 trace: [tcg] Include TCG-tracing header on all targets 2014-08-12 14:26:12 +01:00
target-sparc target-sparc64: implement Short Floating-Point Store Instructions 2014-08-17 13:24:27 +01:00
target-unicore32 trace: [tcg] Include TCG-tracing header on all targets 2014-08-12 14:26:12 +01:00
target-xtensa trace: [tcg] Include TCG-tracing header on all targets 2014-08-12 14:26:12 +01:00
tcg tcg/ppc: Fix support for 64-bit PPC MacOSX hosts 2014-06-29 11:38:50 +01:00
tests image-fuzzer: Reduce number of generator functions in __init__ 2014-08-15 18:03:14 +01:00
trace trace: [tcg] Generate TCG tracing routines 2014-08-12 14:26:12 +01:00
ui spice: don't use 'Yoda conditions' 2014-08-15 18:54:07 +04:00
util trivial patches for 2014-08-15 2014-08-15 18:44:48 +01:00
.exrc qemu: add .exrc 2012-09-07 09:02:44 +03:00
.gitignore trace: [tcg] Generate TCG tracing routines 2014-08-12 14:26:12 +01:00
.gitmodules PPC: Add u-boot firmware for e500 2014-06-16 13:24:35 +02:00
.mailmap Update mailmap 2013-09-05 09:40:31 -05:00
.travis.yml trace: Multi-backend tracing 2014-06-09 15:43:40 +02:00
CODING_STYLE CODING_STYLE: Section about conditional statement 2014-08-15 18:54:06 +04:00
COPYING COPYING: update from FSF 2008-10-12 17:54:42 +00:00
COPYING.LIB Update FSF address in GPL/LGPL boilerplate 2009-01-04 22:05:52 +00:00
Changelog Use qemu-project.org domain name 2013-10-11 09:34:56 -07:00
HACKING HACKING: Document vaddr type usage 2013-07-23 02:41:31 +02:00
LICENSE LICENSE: clarify 2013-08-12 09:15:12 -05:00
MAINTAINERS block: Support Archipelago as a QEMU block backend 2014-08-15 15:07:14 +02:00
Makefile Tracing pull request 2014-08-15 16:37:17 +01:00
Makefile.objs Tracing pull request 2014-08-15 16:37:17 +01:00
Makefile.target trace: [tcg] Define TCG tracing helper routines 2014-08-12 14:26:12 +01:00
README Use qemu-project.org domain name 2013-10-11 09:34:56 -07:00
VERSION Open 2.2 development tree 2014-08-01 18:30:08 +01:00
aio-posix.c AioContext: speed up aio_notify 2014-07-09 15:50:11 +02:00
aio-win32.c block: drop aio functions that operate on the main AioContext 2014-07-09 15:50:11 +02:00
arch_init.c Show length mismatch error is hex 2014-08-09 00:06:32 +04:00
async.c AioContext: speed up aio_notify 2014-07-09 15:50:11 +02:00
balloon.c qapi event: convert BALLOON_CHANGE 2014-06-23 11:12:28 -04:00
block-migration.c block: Use bdrv_nb_sectors() where sectors, not bytes are wanted 2014-08-15 15:07:13 +02:00
block.c block: Catch !bs->drv in bdrv_check() 2014-08-15 15:07:16 +02:00
blockdev-nbd.c nbd: Shutdown socket before closing. 2014-06-30 12:50:12 +02:00
blockdev.c block: add backing-file option to block-stream 2014-07-01 10:47:01 +02:00
blockjob.c block: prefer aio_poll to qemu_aio_wait 2014-07-09 15:50:11 +02:00
bt-host.c sysemu: avoid proliferation of include/ subdirectories 2013-04-15 18:19:25 +02:00
bt-vhci.c sysemu: avoid proliferation of include/ subdirectories 2013-04-15 18:19:25 +02:00
configure Block patches 2014-08-15 14:49:50 +01:00
coroutine-gthread.c glib-compat.h: add new thread API emulation on top of pre-2.31 API 2014-06-10 07:44:01 +02:00
coroutine-sigaltstack.c Merge remote-tracking branch 'kwolf/for-anthony' into staging 2013-02-26 07:44:39 -06:00
coroutine-ucontext.c Fix warnings suppressors to honor --disable-werror 2013-04-17 10:28:04 -05:00
coroutine-win32.c coroutine-win32.c: Add noinline attribute to work around gcc bug 2014-06-26 14:08:14 +01:00
cpu-exec.c trace: add some tcg tracing support 2014-08-12 14:26:12 +01:00
cpus.c monitor: Add drift info to 'info jit' 2014-08-07 15:09:48 +02:00
cputlb.c softmmu: introduce cpu_ldst.h 2014-06-05 16:10:33 +02:00
device-hotplug.c blockdev: Remove unused DriveInfo reference count 2014-06-16 17:23:19 +08:00
device_tree.c device_tree: qemu_fdt_setprop: Rename val_array arg 2013-12-20 01:58:12 +01:00
disas.c monitor: QEMU Monitor Instruction Disassembly Incorrect for PowerPC LE Mode 2014-06-16 13:24:26 +02:00
dma-helpers.c dma-helpers: Fix too long qiov 2014-07-14 12:03:21 +02:00
dump.c dump.c: Fix memory leak issue in cleanup processing for dump_init() 2014-08-18 14:39:10 -04:00
exec.c SCSI changes that enable sending vendor-specific commands via virtio-scsi. 2014-08-19 13:00:57 +01:00
gdbstub.c exec: Change cpu_breakpoint_{insert,remove{,_by_ref,_all}} argument 2014-03-13 19:20:48 +01:00
hmp-commands.hx Add the vhost-user netdev backend to the command line 2014-06-19 18:44:18 +03:00
hmp.c block: add backing-file option to block-stream 2014-07-01 10:47:01 +02:00
hmp.h hmp: add info memdev 2014-06-19 18:44:21 +03:00
iohandler.c iohandler.c: Properly initialize sigaction struct 2014-05-24 00:07:29 +04:00
ioport.c memory: convert memory_region_destroy to object_unparent 2014-08-18 12:06:20 +02:00
iothread.c AioContext: do not rely on aio_poll(ctx, true) result to end a loop 2014-07-14 12:03:20 +02:00
kvm-all.c kvm-all: Use 'tmpcpu' instead of 'cpu' in sub-looping to avoid 'cpu' be NULL 2014-07-22 12:38:17 +02:00
kvm-stub.c Add kvm_eventfds_enabled function 2014-06-19 16:41:54 +03:00
main-loop.c block: drop aio functions that operate on the main AioContext 2014-07-09 15:50:11 +02:00
memory.c Revert "memory: Use canonical path component as the name" 2014-08-19 20:05:46 +01:00
memory_mapping.c cpu: Use QTAILQ for CPU list 2013-09-03 12:25:55 +02:00
migration-exec.c aio / timers: Untangle include files 2013-08-22 19:10:27 +02:00
migration-fd.c aio / timers: Untangle include files 2013-08-22 19:10:27 +02:00
migration-rdma.c rdma: bug fixes 2014-06-23 19:09:50 +02:00
migration-tcp.c Coverity: Fix failure path for qemu_accept in migration 2014-05-05 22:15:03 +02:00
migration-unix.c Coverity: Fix failure path for qemu_accept in migration 2014-05-05 22:15:03 +02:00
migration.c migration: catch unknown flags in ram_load 2014-06-16 04:55:27 +02:00
module-common.c module: implement module loading 2014-02-20 13:14:18 +01:00
monitor.c monitor: fix use after free 2014-08-18 14:39:10 -04:00
nbd.c nbd: Handle NBD_OPT_LIST option. 2014-06-30 12:50:17 +02:00
numa.c numa: show hex number in error message for consistency and prefix them with 0x 2014-08-14 13:22:07 +02:00
os-posix.c oslib-posix: Fix build on FreeBSD 2014-03-13 14:34:16 +00:00
os-win32.c util: Split out exec_dir from os_find_datadir 2014-02-20 13:12:54 +01:00
page_cache.c migration: Plug memory leak in migrate-set-cache-size command 2014-06-10 19:54:43 +04:00
qapi-schema.json backends: Introduce chr-testdev 2014-08-06 17:53:05 +02:00
qdev-monitor.c trivial patches for 2014-08-15 2014-08-15 18:44:48 +01:00
qdict-test-data.txt Introduce QDict test data file 2009-09-04 09:37:34 -05:00
qemu-bridge-helper.c qemu-bridge-helper: Fix fd leak in main() 2014-06-27 10:39:10 +02:00
qemu-char.c Block pull request 2014-08-18 11:59:27 +01:00
qemu-coroutine-io.c aio / timers: Untangle include files 2013-08-22 19:10:27 +02:00
qemu-coroutine-lock.c coroutine: remove qemu_co_queue_wait_insert_head 2013-12-02 17:11:49 +01:00
qemu-coroutine-sleep.c coroutine: add co_aio_sleep_ns() to allow sleep in block drivers 2013-10-30 12:22:09 +01:00
qemu-coroutine.c coroutine: make pool size dynamic 2014-08-15 15:07:14 +02:00
qemu-doc.texi doc: slirp supports ICMP echo if enabled in Linux 2014-07-18 17:45:37 +04:00
qemu-file.c Make qemu_peek_buffer loop until it gets it's data 2014-05-05 22:15:03 +02:00
qemu-img-cmds.hx qemu-img: add -l for snapshot in convert 2013-12-04 15:19:00 +01:00
qemu-img.c Block patches 2014-08-15 14:49:50 +01:00
qemu-img.texi Fix nocow typos in manpage 2014-07-07 09:15:29 +02:00
qemu-io-cmds.c block: prefer aio_poll to qemu_aio_wait 2014-07-09 15:50:11 +02:00
qemu-io.c trace: Multi-backend tracing 2014-06-09 15:43:40 +02:00
qemu-log.c qemu-log: default to stderr for logging output 2013-02-26 13:31:47 -06:00
qemu-nbd.c nbd: Shutdown socket before closing. 2014-06-30 12:50:12 +02:00
qemu-nbd.texi nbd: Miscellaneous typo fixes. 2014-05-24 00:07:29 +04:00
qemu-options-wrapper.h vl.c: In qemu -h output, only print options for the arch we are running as 2011-12-19 10:27:33 -06:00
qemu-options.h vl.c: Move option generation logic into a wrapper file 2011-12-19 10:27:33 -06:00
qemu-options.hx Block pull request 2014-08-18 11:59:27 +01:00
qemu-seccomp.c seccomp: add semctl() to the syscall whitelist 2014-08-21 10:29:16 +02:00
qemu-tech.texi qemu-tech.texi: update implemented xtensa features list 2012-11-29 13:00:52 -06:00
qemu-timer.c vl.c: remove init_clocks call from main 2014-05-09 20:57:32 +02:00
qemu.nsi nsis: Improved support for parallel installation of 32 and 64 bit code 2013-11-07 07:02:44 +01:00
qemu.sasl sasl: Avoid 'Could not find keytab file' in syslog 2014-03-15 13:54:18 +04:00
qmp-commands.hx block: add backing-file option to block-stream 2014-07-01 10:47:01 +02:00
qmp.c qmp: hide "hotplugged" device property from device-list-properties 2014-08-15 15:07:13 +02:00
qtest.c icount: Add QemuOpts for icount 2014-08-06 17:53:07 +02:00
rules.mak build-sys: introduce install-prog macro to install&strip binaries and use it 2014-06-24 20:01:24 +04:00
savevm.c savevm: check vmsd for migratability status 2014-06-25 23:54:57 +02:00
softmmu_template.h softmmu: move softmmu_template.h out of include/ 2014-06-05 16:10:33 +02:00
spice-qemu-char.c qemu-char: introduce qemu_chr_alloc 2014-06-23 11:12:28 -04:00
tcg-runtime.c tcg: Push tcg-runtime routines into exec/helper-* 2014-05-28 09:33:54 -07:00
tci.c Merge remote-tracking branch 'remotes/bonzini/softmmu-smap' into staging 2014-06-05 21:06:14 +01:00
thread-pool.c thread-pool: avoid deadlock in nested aio_poll() calls 2014-08-15 15:07:14 +02:00
thunk.c exec: move include files to include/exec/ 2012-12-19 08:31:31 +01:00
tpm.c Use error_is_set() only when necessary 2014-02-17 11:57:23 -05:00
trace-events virtio-rng: add some trace events 2014-08-12 14:29:55 +01:00
translate-all.c trace: add some tcg tracing support 2014-08-12 14:26:12 +01:00
translate-all.h translate-all: Change tb_check_watchpoint() argument to CPUState 2014-03-13 19:20:48 +01:00
user-exec.c softmmu: introduce cpu_ldst.h 2014-06-05 16:10:33 +02:00
version.rc Use qemu-project.org domain name 2013-10-11 09:34:56 -07:00
vl.c vl: free err 2014-08-15 18:54:07 +04:00
vmstate.c vmstate: Add preallocation for migrating arrays (VMS_ALLOC flag) 2014-06-27 13:48:27 +02:00
xbzrle.c xbzrle.c: Avoid undefined behaviour with signed arithmetic 2014-04-18 10:33:36 +04:00
xen-common-stub.c xen: factor out common functions 2014-05-07 16:16:43 +00:00
xen-common.c xen: factor out common functions 2014-05-07 16:16:43 +00:00
xen-hvm-stub.c xen-hvm: Fix xen_hvm_init() to adjust pc memory layout 2014-06-23 17:50:04 +03:00
xen-hvm.c xen: fix usage of ENODATA 2014-08-01 15:57:28 +00:00
xen-mapcache.c xen: build on ARM 2014-07-07 10:37:40 +00:00

README

Read the documentation in qemu-doc.html or on http://wiki.qemu-project.org

- QEMU team