summaryrefslogtreecommitdiff
path: root/linux-user
AgeCommit message (Collapse)AuthorFilesLines
2017-09-19cpu: make cpu_generic_init() abort QEMU on errorIgor Mammedov1-4/+0
Almost every user of cpu_generic_init() checks for returned NULL and then reports failure in a custom way and aborts process. Some users assume that call can't fail and don't check for failure, though they should have checked for it. In either cases cpu_generic_init() failure is fatal, so instead of checking for failure and reporting it various ways, make cpu_generic_init() report errors in consistent way and terminate QEMU on failure. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <1505318697-77161-3-git-send-email-imammedo@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2017-09-01sparc: embed sparc_def_t into CPUSPARCStateIgor Mammedov1-1/+1
Make CPUSPARCState::def embedded so it would be allocated as part of cpu instance and we won't have to worry about cleaning def pointer up mannualy on cpu destruction. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <1503592308-93913-4-git-send-email-imammedo@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2017-08-08maint: Include bug-reporting info in --help outputEric Blake1-1/+3
These days, many programs are including a bug-reporting address, or better yet, a link to the project web site, at the tail of their --help output. However, we were not very consistent at doing so: only qemu-nbd and qemu-qa mentioned anything, with the latter pointing to an individual person instead of the project. Add a new #define that sets up a uniform string, mentioning both bug reporting instructions and overall project details, and which a downstream vendor could tweak if they want bugs to go to a downstream database. Then use it in all of our binaries which have --help output. The canned text intentionally references http:// instead of https:// because our https website currently causes certificate errors in some browsers. That can be tweaked later once we have resolved the web site issued. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20170803163353.19558-5-eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-08-08Revert "rcu: do not create thread in pthread_atfork callback"Paolo Bonzini1-1/+0
This reverts commit a59629fcc6f603e19b516dc08f75334e5c480bd0. This is not needed anymore because the IOThread mutex is not "magic" anymore (need not kick the CPU thread)and also because fork callbacks are only enabled at the very beginning of QEMU's execution. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-08-01trace-events: fix code style: print 0x before hex numbersVladimir Sementsov-Ogievskiy1-5/+5
The only exception are groups of numers separated by symbols '.', ' ', ':', '/', like 'ab.09.7d'. This patch is made by the following: > find . -name trace-events | xargs python script.py where script.py is the following python script: ========================= #!/usr/bin/env python import sys import re import fileinput rhex = '%[-+ *.0-9]*(?:[hljztL]|ll|hh)?(?:x|X|"\s*PRI[xX][^"]*"?)' rgroup = re.compile('((?:' + rhex + '[.:/ ])+' + rhex + ')') rbad = re.compile('(?<!0x)' + rhex) files = sys.argv[1:] for fname in files: for line in fileinput.input(fname, inplace=True): arr = re.split(rgroup, line) for i in range(0, len(arr), 2): arr[i] = re.sub(rbad, '0x\g<0>', arr[i]) sys.stdout.write(''.join(arr)) ========================= Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Acked-by: Cornelia Huck <cohuck@redhat.com> Message-id: 20170731160135.12101-5-vsementsov@virtuozzo.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2017-07-31Revert "syscall: fix dereference of undefined pointer"Peter Maydell1-1/+0
This reverts commit bc658e4a2e81593f75a3ae34b112be77efbb3e0a. Some versions of gcc warn about this: linux-user/syscall.c: In function ‘do_ioctl_rt’: linux-user/syscall.c:5577:37: error: ‘host_rt_dev_ptr’ may be used uninitialized in this function [-Werror=uninitialized] and in particular the Travis builds fail; they use gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3. Revert the change to fix the travis builds. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-07-31docs: fix broken paths to docs/devel/tracing.txtPhilippe Mathieu-Daudé1-1/+1
With the move of some docs/ to docs/devel/ on ac06724a71, no references were updated. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2017-07-31syscall: check inotify() and eventfd() return valuePhilippe Mathieu-Daudé1-4/+12
linux-user/syscall.c:555:25: warning: Out of bound memory access (accessed memory precedes memory block) target_fd_trans[fd] = trans; ~~~~~~~~~~~~~~~~~~~~^~~~~~~ Reported-by: Clang Static Analyzer Suggested-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2017-07-31syscall: fix use of uninitialized valuesPhilippe Mathieu-Daudé1-0/+1
linux-user/syscall.c:1627:35: warning: 1st function call argument is an uninitialized value target_saddr->sa_family = tswap16(addr->sa_family); ^~~~~~~~~~~~~~~~~~~~~~~~ linux-user/syscall.c:1629:25: warning: The left operand of '==' is a garbage value if (addr->sa_family == AF_NETLINK && len >= sizeof(struct sockaddr_nl)) { ~~~~~~~~~~~~~~~ ^ Reported-by: Clang Static Analyzer Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2017-07-31syscall: fix dereference of undefined pointerPhilippe Mathieu-Daudé1-0/+1
linux-user/syscall.c:5581:9: warning: Dereference of undefined pointer value if (*host_rt_dev_ptr != 0) { ^~~~~~~~~~~~~~~~ Reported-by: Clang Static Analyzer Suggested-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2017-07-31linux-user/sh4: fix incorrect memory writePhilippe Mathieu-Daudé1-1/+1
not hit since 2009! :) linux-user/elfload.c:1102:20: warning: Out of bound memory access (access exceeds upper limit of memory block) (*regs[i]) = tswap32(env->gregs[i]); ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ Reported-by: Clang Static Analyzer Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2017-07-20Replace 'struct ucontext' with 'ucontext_t' typeKhem Raj7-11/+11
glibc used to have: typedef struct ucontext { ... } ucontext_t; glibc now has: typedef struct ucontext_t { ... } ucontext_t; (See https://sourceware.org/bugzilla/show_bug.cgi?id=21457 for detail and rationale for the glibc change) However, QEMU used "struct ucontext" in declarations. This is a private name and compatibility cannot be guaranteed. Switch to only using the standardized type name. Signed-off-by: Khem Raj <raj.khem@gmail.com> Message-id: 20170628204452.41230-1-raj.khem@gmail.com Cc: Kamil Rytarowski <kamil@netbsd.org> Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Laurent Vivier <laurent@vivier.eu> Cc: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [PMM: Rewrote commit message, based mostly on the one from Nathaniel McCallum] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-07-19Merge remote-tracking branch 'remotes/rth/tags/pull-axp-20170718' into stagingPeter Maydell1-11/+14
Queued target/alpha patches # gpg: Signature made Wed 19 Jul 2017 05:42:55 BST # gpg: using RSA key 0xAD1270CC4DD0279B # gpg: Good signature from "Richard Henderson <rth7680@gmail.com>" # gpg: aka "Richard Henderson <rth@redhat.com>" # gpg: aka "Richard Henderson <rth@twiddle.net>" # Primary key fingerprint: 9CB1 8DDA F8E8 49AD 2AFC 16A4 AD12 70CC 4DD0 279B * remotes/rth/tags/pull-axp-20170718: target/alpha: Log temp leaks target/alpha: Fix temp leak in gen_fbcond target/alpha: Fix temp leak in gen_call_pal target/alpha: Fix temp leak in gen_mtpr target/alpha: Fix temp leak in gen_bcond target/alpha: Merge several flag bytes into ENV->FLAGS target/alpha: Copy tb->flags into DisasContext target/alpha: Remove amask from tb->flags Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-07-18target/alpha: Merge several flag bytes into ENV->FLAGSRichard Henderson1-11/+14
The flags are arranged such that we can manipulate them either a whole, or as individual bytes. The computation within cpu_get_tb_cpu_state is now reduced to a single load and mask. Tested-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Richard Henderson <rth@twiddle.net>
2017-07-18linux-user/sh4: Clean env->flags on signal boundariesRichard Henderson1-0/+3
If a signal is delivered during the execution of a delay slot, or a gUSA region, clear those bits from the environment so that the signal handler does not start in that same state. Cleaning the bits on signal return is paranoid good sense. Reviewed-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Richard Henderson <rth@twiddle.net> Message-Id: <20170718200255.31647-10-rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2017-07-18linux-user/sh4: Notice gUSA regions during signal deliveryRichard Henderson1-0/+28
We translate gUSA regions atomically in a parallel context. But in a serial context a gUSA region may be interrupted. In that case, restart the region as the kernel would. Reviewed-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Richard Henderson <rth@twiddle.net> Message-Id: <20170718200255.31647-9-rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2017-07-14qom/cpu: remove host_tid fieldAlex Bennée1-1/+0
This was only used by the gdbstub and even then was only being set for subsequent threads. Rather the continue duplicating the number just make the gdbstub get the information from TaskState structure. Now the tid is correctly reported for all threads the bug I was seeing with "vCont;C04:0;c" packets is fixed as the correct tid is reported to gdb. I moved cpu_gdb_index into the gdbstub to facilitate easy access to the TaskState which is used elsewhere in gdbstub. To prevent BSD failing to build I've included ts_tid into its TaskStruct but not populated it - which was the same state as the old cpu->host_tid. I'll leave it up to the BSD maintainers to actually populate this properly if they want a working gdbstub with user-threads. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Greg Kurz <groug@kaod.org> Reviewed-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20170712105216.747-4-alex.bennee@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-06-29linux-user: Put PPC AT_IGNOREPPC auxv entries in the right placePeter Maydell1-11/+12
The 32-bit PPC auxv is a bit complicated because in the mists of time it used to be 16-aligned rather than directly after the environment. Older glibc versions had code to try to probe for whether it needed alignment or not: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c;hb=e84eabb3871c9b39e59323bf3f6b98c2ca9d1cd0 and the kernel has code which puts some magic entries at the bottom to ensure that the alignment probe fails: http://elixir.free-electrons.com/linux/latest/source/arch/powerpc/include/asm/elf.h#L158 QEMU has similar code too, but it was broken by commit 7c4ee5bcc82e64, which changed elfload.c from filling in the auxv starting at the highest address and working down to starting at the lowest address and working up. This means that the ARCH_DLINFO hook must now be invoked first rather than last, and the entries in it for PPC must be reversed so that the magic AT_IGNOREPPC entries come at the lowest address in the auxv as they should. The effect of this was that if running a guest binary that used an old glibc with the alignment probing the guest ld.so code would segfault if the size of the guest environment and argv happened to put the auxv at an address that triggered the alignment code in the guest glibc. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Tested-by: Richard Henderson <rth@twiddle.net> Message-id: 1498582198-6649-1-git-send-email-peter.maydell@linaro.org
2017-05-29linux-user: add strace support for uinfo structure of rt_sigqueueinfo() and ↵Miloš Stojanović1-2/+111
rt_tgsigqueueinfo() This commit adds support for printing the content of the target_siginfo_t structure in a similar way to how it is printed by the host strace. The pointer to this structure is sent as the last argument of the rt_sigqueueinfo() and rt_tgsigqueueinfo() system calls. For this purpose, print_siginfo() is used and the get_target_siginfo() function is implemented in order to get the information obtained from the pointer into the form that print_siginfo() expects. The get_target_siginfo() function is based on host_to_target_siginfo_noswap() in linux-user mode, but here both arguments are pointers to target_siginfo_t, so instead of converting the information to siginfo_t it just extracts and copies it to a target_siginfo_t structure. Prior to this commit, typical strace output used to look like this: 8307 rt_sigqueueinfo(8307,50,0x00000040007ff6b0) = 0 After this commit, it looks like this: 8307 rt_sigqueueinfo(8307,50,{si_signo=50, si_code=SI_QUEUE, si_pid=8307, si_uid=1000, si_sigval=17716762128}) = 0 Signed-off-by: Miloš Stojanović <Milos.Stojanovic@rt-rk.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2017-05-29linux-user: fix inconsistent spaces in print_siginfo() outputMiloš Stojanović1-6/+6
This patch improves the consistentcy of the output from print_siginfo() by removing spaces around the equal sign of si_pid, si_uid, si_timer1, si_timer2, si_band, si_fd, si_addr, si_status and si_sigval. This way they match si_signo and ci_code. Host strace was used as a reference for this chage. Prior to this commit, typical strace output used to look like this: Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2017-05-29linux-user: add rt_tgsigqueueinfo() straceMiloš Stojanović2-1/+16
This commit improves strace support for syscall rt_tgsigqueueinfo(). Prior to this commit, typical strace output used to look like this: 7775 rt_tgsigqueueinfo(7775,7775,50,1996483164,0,0) = 0 After this commit, it looks like this: 7775 rt_tgsigqueueinfo(7775,7775,50,0x76ffea5c) = 0 Signed-off-by: Miloš Stojanović <Milos.Stojanovic@rt-rk.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2017-05-29linux-user: add support for rt_tgsigqueueinfo() system callMiloš Stojanović1-0/+16
Add a new system call: rt_tgsigqueueinfo(). This system call is similar to rt_sigqueueinfo(), but instead of sending the signal and data to the whole thread group with the ID equal to the argument tgid, it sends it to a single thread within that thread group. The ID of the thread is specified by the tid argument. The implementation is based on the rt_sigqueueinfo() in linux-user mode, where the tid is added as the second argument and the previous second and third argument become arguments three and four, respectively. Signed-off-by: Miloš Stojanović <Milos.Stojanovic@rt-rk.com> Conflicts: linux-user/syscall.c Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2017-05-29linux-user: fix argument type declaration of rt_sigqueinfo() syscallMiloš Stojanović1-1/+1
Change the type of the first argument of rt_sigqueinfo() from int to pid_t in the syscall declaration to match specifications of the system call. Proper spacing is added to satisfy checkpatch.pl. Signed-off-by: Miloš Stojanović <Milos.Stojanovic@rt-rk.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2017-05-29linux-user: fix mismatch of lock/unlock_user() invocations in ↵Miloš Stojanović1-1/+1
rt_sigqueinfo() syscall Change the unlock_user() argument from arg1 to arg3 to match with lock_user(), since arg3 contains the pointer to the siginfo_t structure. Signed-off-by: Miloš Stojanović <Milos.Stojanovic@rt-rk.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2017-05-29linux-user: fix ssetmask() system callMiloš Stojanović1-9/+1
Fix the ssetmask() system call by removing the invocation of sigorset(). The ssetmask() system call should replace the old signal mask with the new and return the old mask. It shouldn't combine the old and the new mask with sigorset(). Fetching the old mask for sigorset() is also no longer needed. The problem was detected after running LTP test group syscalls for the MIPS EL 32 R2 architecture where the test ssetmask01 failed with exit code 1. The test passes now that the ssetmask() system call is fixed. Signed-off-by: Miloš Stojanović <Milos.Stojanovic@rt-rk.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2017-05-29linux-user: add tkill(), tgkill() and rt_sigqueueinfo() straceMiloš Stojanović2-3/+44
Improve strace support for syscall tkill(), tgkill() and rt_sigqueueinfo() by implementing print functions that match arguments types of the system calls and add them to the corresponding starce.list entry. tkill: Prior to this commit, typical strace output used to look like this: 4886 tkill(4886,50,0,4832615904,0,-9151031864016699136) = 0 After this commit, it looks like this: 4886 tkill(4886,50) = 0 tgkill: Prior to this commit, typical strace output used to look like this: 4890 tgkill(4890,4890,50,8,4832630528,4832615904) = 0 After this commit, it looks like this: 4890 tgkill(4890,4890,50) = 0 rt_sigqueueinfo: Prior to this commit, typical strace output used to look like this: 8307 rt_sigqueueinfo(8307,50,1996483164,0,0,50) = 0 After this commit, it looks like this: 8307 rt_sigqueueinfo(8307,50,0x00000040007ff6b0) = 0 Signed-off-by: Miloš Stojanović <Milos.Stojanovic@rt-rk.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2017-05-29linux-user: add strace for getuid(), gettid(), getppid(), geteuid()Miloš Stojanović1-4/+4
Improve strace support for syscalls getuid(), gettid(), getppid() and geteuid(). Since these system calls don't have arguments, "%s()" is added in the corresponding strace.list entry so that no arguments are printed. getuid: Prior to this commit, typical strace output used to look like this: 4894 getuid(4894,0,0,274886293296,-3689348814741910323,4832615904) = 1000 After this commit, it looks like this: 4894 getuid() = 1000 gettid: Prior to this commit, typical strace output used to look like this: 8307 gettid(0,0,64,0,4832630528,4832615840) = 8307 After this commit, it looks like this: 8307 gettid() = 8307 getppid: Prior to this commit, typical strace output used to look like this: 20588 getppid(20588,64,0,4832630528,4832615888,0) = 20625 After this commit, it looks like this: 20588 getppid() = 20625 geteuid: Prior to this commit, typical strace output used to look like this: 20588 geteuid(64,0,0,4832615888,0,-9151031864016699136) = 1000 After this commit, it looks like this: 20588 geteuid() = 1000 Signed-off-by: Miloš Stojanović <Milos.Stojanovic@rt-rk.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2017-05-29linux-user: remove all traces of qemu from /proc/self/cmdlineAndreas Schwab1-40/+7
Instead of post-processing the real contents use the remembered target argv. That removes all traces of qemu, including command line options, and handles QEMU_ARGV0. Signed-off-by: Andreas Schwab <schwab@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2017-05-29linux-user: allocate heap memory for execve argumentsPrasad J Pandit1-2/+5
Arguments passed to execve(2) call from user program could be large, allocating stack memory for them via alloca(3) call would lead to bad behaviour. Use 'g_new0' to allocate memory for such arguments. Reported-by: Jann Horn <jannh@google.com> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2017-05-29linux-user: fix inotifyLaurent Vivier1-0/+29
When a fd is opened using inotify_init(), a read provides one or more inotify_event structures: struct inotify_event { int wd; uint32_t mask; uint32_t cookie; uint32_t len; char name[]; }; The integer fields must be byte-swapped to the target endianness. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2017-05-29linux-user: fix fadvise64_64() on ppcLaurent Vivier1-0/+10
On ppc, advice is arg2, not arg6: long ppc_fadvise64_64(int fd, int advice, u32 offset_high, u32 offset_low, u32 len_high, u32 len_low) Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2017-05-29linux-user: fix eventfdLaurent Vivier1-2/+24
When a fd is opened using eventfd(), a read provides a 64bit counter in the host byte order, and a write increase the internal counter by the provided 64bit value. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2017-05-29linux-user: call fd_trans_target_to_host_data() for write()Laurent Vivier1-1/+11
As for sendmsg() or sendto(), we must call the target to host data translator if it is defined. This is needed for eventfd(): the write() syscall allows to add a value to the internal counter, and so, it must be byte-swapped to the host order. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2017-05-10Merge remote-tracking branch 'mjt/tags/trivial-patches-fetch' into stagingStefan Hajnoczi1-6/+3
trivial patches for 2017-05-10 # gpg: Signature made Wed 10 May 2017 03:19:30 AM EDT # gpg: using RSA key 0x701B4F6B1A693E59 # gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>" # gpg: aka "Michael Tokarev <mjt@corpit.ru>" # gpg: aka "Michael Tokarev <mjt@debian.org>" # Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D 4324 457C E0A0 8044 65C5 # Subkey fingerprint: 7B73 BAD6 8BE7 A2C2 8931 4B22 701B 4F6B 1A69 3E59 * mjt/tags/trivial-patches-fetch: (23 commits) tests: Remove redundant assignment MAINTAINERS: Update paths for AioContext implementation MAINTAINERS: Update paths for main loop jazz_led: fix bad snprintf tests: Ignore another built executable (test-hmp) scripts: Switch to more portable Perl shebang scripts/qemu-binfmt-conf.sh: Fix shell portability issue virtfs: allow a device id to be specified in the -virtfs option hw/core/generic-loader: Fix crash when running without CPU virtio-blk: Remove useless condition around g_free() qemu-doc: Fix broken URLs of amnhltm.zip and dosidle210.zip use _Static_assert in QEMU_BUILD_BUG_ON channel-file: fix wrong parameter comments block: Make 'replication_state' an enum util: Use g_malloc/g_free in envlist.c qga: fix compiler warnings (clang 5) device_tree: fix compiler warnings (clang 5) usb-ccid: make ccid_write_data_block() cope with null buffers tests: Ignore more test executables Add 'none' as type for drive's if option ... Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2017-05-07util: Use g_malloc/g_free in envlist.cSaurav Sachidanand1-6/+3
Change malloc/strdup/free to g_malloc/g_strdup/g_free in util/envlist.c. Remove NULL checks for pointers returned from g_malloc and g_strdup as they exit in case of failure. Also, update calls to envlist_create to reflect this. Free array and array contents returned by envlist_to_environ using g_free in bsd-user/main.c and linux-user/main.c. Update comments to reflect change in semantics. Signed-off-by: Saurav Sachidanand <sauravsachidanand@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2017-05-04target/openrisc: implement shadow registersStafford Horne5-22/+23
Shadow registers are part of the openrisc spec along with sr[cid], as part of the fast context switching feature. When exceptions occur, instead of having to save registers to the stack if enabled the CID will increment and a new set of registers will be available. This patch only implements shadow registers which can be used as extra scratch registers via the mfspr and mtspr if required. This is implemented in a way where it would be easy to add on the fast context switching, currently cid is hardcoded to 0. This is need for openrisc linux smp kernels to boot correctly. Signed-off-by: Stafford Horne <shorne@gmail.com>
2017-02-28Merge remote-tracking branch ↵Peter Maydell1-0/+1
'remotes/pmaydell/tags/pull-target-arm-20170228' into staging target-arm queue: * raspi2: implement RNG module * raspi2: implement new SD card controller (but don't wire it up) * sdhci: bugfixes for block transfers * virt: fix cpu object reference leak * Add missing fp_access_check() to aarch64 crypto instructions * cputlb: Don't assume do_unassigned_access() never returns * virt: Add a user option to disallow ITS instantiation * i.MX timers: fix reset handling * ARMv7M NVIC: rewrite to fix broken priority handling and masking * exynos: Fix proper mapping of CPUs by providing real cluster ID * exynos: Fix Linux kernel division by zero for PLLs # gpg: Signature made Tue 28 Feb 2017 12:40:51 GMT # gpg: using RSA key 0x3C2525ED14360CDE # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" # gpg: aka "Peter Maydell <pmaydell@gmail.com>" # gpg: aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83 15CF 3C25 25ED 1436 0CDE * remotes/pmaydell/tags/pull-target-arm-20170228: (27 commits) hw/arm/exynos: Fix proper mapping of CPUs by providing real cluster ID hw/arm/exynos: Fix Linux kernel division by zero for PLLs bcm2835_sdhost: add bcm2835 sdhost controller armv7m: Allow SHCSR writes to change pending and active bits armv7m: Raise correct kind of UsageFault for attempts to execute ARM code armv7m: Check exception return consistency armv7m: Extract "exception taken" code into functions armv7m: VECTCLRACTIVE and VECTRESET are UNPREDICTABLE armv7m: Simpler and faster exception start armv7m: Remove unused armv7m_nvic_acknowledge_irq() return value armv7m: Escalate exceptions to HardFault if necessary arm: gic: Remove references to NVIC armv7m: Fix condition check for taking exceptions armv7m: Rewrite NVIC to not use any GIC code armv7m: Implement reading and writing of PRIGROUP armv7m: Rename nvic_state to NVICState ARM i.MX timers: fix reset handling hw/arm/virt: Add a user option to disallow ITS instantiation cputlb: Don't assume do_unassigned_access() never returns Add missing fp_access_check() to aarch64 crypto instructions ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-02-28armv7m: Raise correct kind of UsageFault for attempts to execute ARM codePeter Maydell1-0/+1
M profile doesn't implement ARM, and the architecturally required behaviour for attempts to execute with the Thumb bit clear is to generate a UsageFault with the CFSR INVSTATE bit set. We were incorrectly implementing this as generating an UNDEFINSTR UsageFault; fix this. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
2017-02-27syscall: fixed mincore(2) not failing with ENOMEMFranklin \"Snaipe\" Mathieu1-3/+8
The current implementation of the mincore(2) syscall sets errno to EFAULT when the region identified by the first two parameters is invalid. This goes against the man page specification, where mincore(2) should only fail with EFAULT when the third parameter is an invalid address; and fail with ENOMEM when the checked region does not point to mapped memory. Signed-off-by: Franklin "Snaipe" Mathieu <snaipe@diacritic.io> Cc: Riku Voipio <riku.voipio@linaro.org> Cc: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20170217085800.28873-2-snaipe@diacritic.io> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2017-02-27linux-user: fix do_rt_sigreturn on m68k linux userspace emulationMichael Karcher1-2/+1
do_rt_sigreturn uses an uninitialised local variable instead of fetching the old signal mask directly from the signal frame when restoring the mask, so the signal mask is undefined after do_rt_sigreturn. As the signal frame data is in target-endian order, target_to_host_sigset instead of target_to_host_sigset_internal is required. do_sigreturn is correct in using target_to_host_sigset_internal, because get_user already did the endianness conversion. Signed-off-by: Michael Karcher <karcher@physik.fu-berlin.de> Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20170225110517.2832-3-laurent@vivier.eu>
2017-02-27linux-user: correctly manage SR in ucontextLaurent Vivier1-2/+3
Use cpu_m68k_get_ccr()/cpu_m68k_set_ccr() to setup and restore correctly the value of SR in the ucontext structure Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20170225110517.2832-2-laurent@vivier.eu>
2017-02-27linux-user: Add signal handling support for x86_64Pranith Kumar1-51/+227
Note that x86_64 has only _rt signal handlers. This implementation attempts to share code with the x86_32 implementation. CC: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Allan Wirth <awirth@akamai.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20170226165345.8757-1-bobby.prani@gmail.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2017-02-27linux-user: Add sockopts for IPv6 ping and IPv6 tracerouteHelge Deller2-1/+139
Add the neccessary sockopts for ping and traceroute on IPv6. This fixes the following qemu warnings with IPv6: Unsupported ancillary data: 0/2 Unsupported ancillary data: 0/11 Unsupported ancillary data: 41/25 Unsupported setsockopt level=0 optname=12 Unsupported setsockopt level=41 optname=16 Unsupported setsockopt level=41 optname=25 Unsupported setsockopt level=41 optname=50 Unsupported setsockopt level=41 optname=51 Unsupported setsockopt level=41 optname=8 Unsupported setsockopt level=58 optname=1 Tested with hppa-linux-user (big-endian) on x86_64 (little-endian). Signed-off-by: Helge Deller <deller@gmx.de> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20170218223130.GA25278@ls3530.fritz.box> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2017-02-27linux-user: fix fork()Laurent Vivier1-2/+3
Since commit 5ea2fc8 ("linux-user: Sanity check clone flags"), trying to run fork() fails with old distro on some architectures. This is the case with HP-PA and Debian 5 (Lenny). It fails on: if ((flags & CSIGNAL) != TARGET_SIGCHLD) { return -TARGET_EINVAL; } because flags is 17, whereas on HP-PA, SIGCHLD is 18. 17 is the SIGCHLD value of my host (x86_64). It appears that for TARGET_NR_fork and TARGET_NR_vfork, QEMU calls do_fork() with SIGCHLD instead of TARGET_SIGCHLD. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20170216173707.16209-1-laurent@vivier.eu>
2017-02-22target-ppc, tcg: fix usermode segfault with pthread_create()Sam Bobroff1-1/+2
Programs run under qemu-ppc64 on an x86_64 host currently segfault if they use pthread_create() due to the adjustment made to the NIP in commit bd6fefe71cec5a0c7d2be4ac96307f25db56abf9. This patch changes cpu_loop() to set the NIP back to the pre-incremented value before calling do_syscall(), which causes the correct address to be used for the new thread and corrects the fault. Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-02-16linux-user: Add FICLONE and FICLONERANGE ioctlsHelge Deller3-0/+15
Add missing FICLONE and FICLONERANGE ioctls. Signed-off-by: Helge Deller <deller@gmx.de> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20170211222602.GA6399@ls3530.fritz.box> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2017-02-16linux-user: Use correct types in load_symbols()Peter Maydell1-7/+15
Coverity doesn't like the code in load_symbols() which assumes it can use 'int' for a variable that might hold an offset into the guest ELF file, because in a 64-bit guest that could overflow. Guest binaries with 2GB sections aren't very likely and this isn't a security issue because we fully trust the guest linux-user binary anyway, but we might as well use the right types, which will placate Coverity. Use uint64_t to hold section sizes, and bail out if the symbol table is too large rather than just overflowing an int. (Coverity issue CID1005776) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <1486249533-5260-1-git-send-email-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2017-02-16linux-user: fill target sigcontext struct accordinglyJose Ricardo Ziviani1-0/+5
A segfault is noticed when an emulated program uses any of ucontext regs fields. Risu detected this issue in the following operation when handling a signal: ucontext_t *uc = (ucontext_t*)uc; uc->uc_mcontext.regs->nip += 4; but this works fine: uc->uc_mcontext.gp_regs[PT_NIP] += 4; This patch set regs to a valid location as well as other sigcontext fields. Signed-off-by: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <1485900317-3256-1-git-send-email-joserz@linux.vnet.ibm.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2017-02-16linux-user: fix tcg/mmap testMarc-André Lureau1-3/+3
tests/tcg/mmap test fails with values other than default target page size. When creating a map beyond EOF, extra anonymous pages are added up to the target page boundary. Currently, this operation is performed only when qemu_real_host_page_size < TARGET_PAGE_SIZE, but it should be performed if the configured page size (qemu -p) is larger than qemu_real_host_page_size too. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> [pranith: dropped checkpatch changes] Signed-off-by: Pranith Kumar <bobby.prani@gmail.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20170119151533.29328-2-bobby.prani@gmail.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2017-02-16linux-user: fix settime old value locationMarc-André Lureau1-2/+6
old_value is the 4th argument of timer_settime(), not the 2nd. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20170119151533.29328-1-bobby.prani@gmail.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>