[Bug 1880355] [NEW] Length restrictions for fw_cfg_dma_transfer?

2020-05-23 Thread Alexander Bulekov
Public bug reported: For me, this takes close to 3 minutes at 100% CPU: echo "outl 0x518 0x9596" | ./i386-softmmu/qemu-system-i386 -M q35 -m 32 -nographic -accel qtest -monitor none -serial none -qtest stdio #0 phys_page_find (d=0x60635d80, addr=136728041144404) at /exec.c:338 #1 addre

Re: [RFC PATCH v2] hw/i386/vmport: Allow QTest use without crashing

2020-05-23 Thread Alexander Bulekov
On 200518 1231, Philippe Mathieu-Daudé wrote: > Trying libFuzzer on the vmport device, we get: > > AddressSanitizer:DEADLYSIGNAL > = > ==29476==ERROR: AddressSanitizer: SEGV on unknown address 0x8840 > (pc 0x56448bec4d7

[PATCH RFC v3 08/11] KVM: Simplify dirty log sync in kvm_set_phys_mem

2020-05-23 Thread Peter Xu
kvm_physical_sync_dirty_bitmap() on the whole section is inaccurate, because the section can be a superset of the memslot that we're working on. The result is that if the section covers multiple kvm memslots, we could be doing the synchronization for multiple times for each kvmslot in the section.

[PATCH RFC v3 11/11] KVM: Dirty ring support

2020-05-23 Thread Peter Xu
KVM dirty ring is a new interface to pass over dirty bits from kernel to the userspace. Instead of using a bitmap for each memory region, the dirty ring contains an array of dirtied GPAs to fetch (in the form of offset in slots). For each vcpu there will be one dirty ring that binds to it. kvm_di

[PATCH RFC v3 06/11] KVM: Provide helper to get kvm dirty log

2020-05-23 Thread Peter Xu
Provide a helper kvm_slot_get_dirty_log() to make the function kvm_physical_sync_dirty_bitmap() clearer. We can even cache the as_id into KVMSlot when it is created, so that we don't even need to pass it down every time. Since at it, remove return value of kvm_physical_sync_dirty_bitmap() because

[PATCH RFC v3 10/11] KVM: Add dirty-gfn-count property

2020-05-23 Thread Peter Xu
Add a parameter for dirty gfn count for dirty rings. If zero, dirty ring is disabled. Otherwise dirty ring will be enabled with the per-vcpu gfn count as specified. If dirty ring cannot be enabled due to unsupported kernel or illegal parameter, it'll fallback to dirty logging. By default, dirty

[PATCH RFC v3 09/11] KVM: Cache kvm slot dirty bitmap size

2020-05-23 Thread Peter Xu
Cache it too because we'll reference it more frequently in the future. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu --- accel/kvm/kvm-all.c | 1 + include/sysemu/kvm_int.h | 1 + 2 files changed, 2 insertions(+) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index f

[PATCH RFC v3 05/11] KVM: Create the KVMSlot dirty bitmap on flag changes

2020-05-23 Thread Peter Xu
Previously we have two places that will create the per KVMSlot dirty bitmap: 1. When a newly created KVMSlot has dirty logging enabled, 2. When the first log_sync() happens for a memory slot. The 2nd case is lazy-init, while the 1st case is not (which is a fix of what the 2nd case missed). T

[PATCH RFC v3 07/11] KVM: Provide helper to sync dirty bitmap from slot to ramblock

2020-05-23 Thread Peter Xu
kvm_physical_sync_dirty_bitmap() calculates the ramblock offset in an awkward way from the MemoryRegionSection that passed in from the caller. The truth is for each KVMSlot the ramblock offset never change for the lifecycle. Cache the ramblock offset for each KVMSlot into the structure when the K

[PATCH RFC v3 03/11] KVM: Fixup kvm_log_clear_one_slot() ioctl return check

2020-05-23 Thread Peter Xu
kvm_vm_ioctl() handles the errno trick already for ioctl() on returning -1 for errors. Fix this. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu --- accel/kvm/kvm-all.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.

[PATCH RFC v3 02/11] memory: Introduce log_sync_global() to memory listener

2020-05-23 Thread Peter Xu
Some of the memory listener may want to do log synchronization without being able to specify a range of memory to sync but always globally. Such a memory listener should provide this new method instead of the log_sync() method. Obviously we can also achieve similar thing when we put the global syn

[PATCH RFC v3 01/11] linux-headers: Update

2020-05-23 Thread Peter Xu
Signed-off-by: Peter Xu --- linux-headers/asm-x86/kvm.h | 1 + linux-headers/linux/kvm.h | 53 + 2 files changed, 54 insertions(+) diff --git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h index 3f3f780c8c..99b15ce39e 100644 --- a/linux-headers

[PATCH RFC v3 04/11] KVM: Use a big lock to replace per-kml slots_lock

2020-05-23 Thread Peter Xu
Per-kml slots_lock will bring some trouble if we want to take all slots_lock of all the KMLs, especially when we're in a context that we could have taken some of the KML slots_lock, then we even need to figure out what we've taken and what we need to take. Make this simple by merging all KML slots

[PATCH RFC v3 00/11] KVM: Dirty ring support (QEMU part)

2020-05-23 Thread Peter Xu
I kept the dirty sync in kvm_set_phys_mem() for kvmslot removals, left a comment on the known issue about strict dirty sync so we can fix it someday in the future together with dirty log and dirty ring. v3: - added "KVM: Use a big lock to replace per-kml slots_lock" this is preparing for the las

Re: [PATCH RFC 0/4] vl: Sync dirty bitmap when system resets

2020-05-23 Thread Peter Xu
On Sat, May 02, 2020 at 05:04:23PM -0400, Peter Xu wrote: > Paolo, > > Do you have any opinion on this series? Or more generally comments on what's > your preference to fix the known dirty sync issue with memslot removal would > be > welcomed too. For my own opinion, I prefer the approach with

Re: [PATCH 10/19] include/qemu: Added tsan.h for annotations.

2020-05-23 Thread Emilio G. Cota
On Sat, May 23, 2020 at 13:20:15 -0400, Emilio G. Cota wrote: > On Fri, May 22, 2020 at 12:07:46 -0400, Robert Foley wrote: > > These annotations will allow us to give tsan > > additional hints. For example, we can inform > > tsan about reads/writes to ignore to silence certain > > classes of warn

Re: [PATCH 00/19] Add Thread Sanitizer support to QEMU

2020-05-23 Thread Emilio G. Cota
On Fri, May 22, 2020 at 12:07:36 -0400, Robert Foley wrote: > This patch series continues the work done by Emilio Cota and others to add > Thread Sanitizer (TSan) support to QEMU. > > The starting point for this work was Emilio's branch here: > https://github.com/cota/qemu/commits/tsan > specifica

Re: [PATCH 15/19] qht: Fix tsan warnings.

2020-05-23 Thread Emilio G. Cota
On Fri, May 22, 2020 at 12:07:51 -0400, Robert Foley wrote: > For example: > WARNING: ThreadSanitizer: data race (pid=23406) > Atomic read of size 4 at 0x7b13e3c8 by thread T7: > #0 __tsan_atomic32_load (qemu-system-aarch64+0x39a36c) > #1 qht_do_lookup util/qht.c:495:17 (qemu-system-

Re: [PATCH] pci: Display PCI IRQ pin in "info pci"

2020-05-23 Thread Peter Xu
On Tue, Mar 17, 2020 at 03:59:08PM -0400, Peter Xu wrote: > Sometimes it would be good to be able to read the pin number along > with the IRQ number allocated. Since we'll dump the IRQ number, no > reason to not dump the pin information. For example, the vfio-pci > device will overwrite the pin w

Re: [PATCH 0/8] memory: Sanity checks memory transaction when releasing BQL

2020-05-23 Thread Peter Xu
On Tue, Apr 21, 2020 at 12:21:00PM -0400, Peter Xu wrote: > This is a continuous work of previous discussion on memory transactions [1]. > It should be helpful to fail QEMU far earlier if there's misuse of BQL against > the QEMU memory model. > > One example is run_on_cpu() during memory commit.

Re: [PATCH 19/19] docs: Added details on TSan to testing.rst

2020-05-23 Thread Emilio G. Cota
On Fri, May 22, 2020 at 12:07:55 -0400, Robert Foley wrote: > This includes details on how to build and test with TSan > both inside a docker and outside. > > Signed-off-by: Robert Foley Reviewed-by: Emilio G. Cota E.

Re: [PATCH 17/19] util: Added tsan annotate for thread name.

2020-05-23 Thread Emilio G. Cota
On Fri, May 22, 2020 at 12:07:53 -0400, Robert Foley wrote: > This allows us to see the name of the thread in tsan > warning reports such as this: > > Thread T7 'CPU 1/TCG' (tid=24317, running) created by main thread at: > > Signed-off-by: Robert Foley Reviewed-by: Emilio G. Cota

[PATCH] audio/mixeng: fix clang 10+ warning

2020-05-23 Thread Volker Rümelin
The code in CONV_NATURAL_FLOAT() and CLIP_NATURAL_FLOAT() seems to use the constant 2^31-0.5 to convert float to integer and back. But the float type lacks the required precision and the constant used for the conversion is 2^31. This is equiva- lent to a [-1.f, 1.f] <-> [INT32_MIN, INT32_MAX + 1] m

[PATCH 0/1] audio/mixeng: fix clang 10+ warning

2020-05-23 Thread Volker Rümelin
This is another attempt to silence the clang 10 warning in audio/mixeng.c. The problem was first reported here: https://lists.nongnu.org/archive/html/qemu-devel/2020-03/msg02270.html This is Philippe's RFC patch and a discussion: https://lists.nongnu.org/archive/html/qemu-devel/2020-05/msg00264.h

[Bug 1859713] Re: ARM v8.3a pauth not working

2020-05-23 Thread Philippe Mathieu-Daudé
Apparently this fixed bug is the official CVE-2020-10702: https://security-tracker.debian.org/tracker/CVE-2020-10702 ** CVE added: https://cve.mitre.org/cgi-bin/cvename.cgi?name=2020-10702 -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QE

Re: [PATCH 14/19] util/async: Fixed tsan warnings

2020-05-23 Thread Emilio G. Cota
On Fri, May 22, 2020 at 12:07:50 -0400, Robert Foley wrote: > For example: > Atomic write of size 8 at 0x7b4800113c28 by main thread (mutexes: write > M30): > #0 __tsan_atomic64_exchange (qemu-system-aarch64+0x386f85) > #1 aio_bh_poll util/async.c:146:5 (qemu-system-aarch64+0xcd1f61) >

Re: [PATCH 13/19] accel/tcg: Fixed tsan warnings.

2020-05-23 Thread Emilio G. Cota
On Fri, May 22, 2020 at 12:07:49 -0400, Robert Foley wrote: > For example: > WARNING: ThreadSanitizer: data race (pid=35425) > Write of size 4 at 0x7bbc00ac by main thread (mutexes: write M875): > #0 cpu_reset_interrupt hw/core/cpu.c:107:28 (qemu-system-aarch64+0x843790) > #1 arm_cpu_

[Bug 1880332] [NEW] Possible regression in QEMU 5.0.0 after CVE-2020-10702 (segmentation fault)

2020-05-23 Thread Héctor Molinero Fernández
Public bug reported: I've come across a very specific situation, but I'm sure it could be replicated in other cases. In QEMU 5.0.0 when I use user emulation with a cURL binary for aarch64 and connect to a server using TLS 1.2 and ECDHE-ECDSA-CHACHA20-POLY1305 cypher a segmentation fault occurs.

[PATCH 2/3] hw/display/artist: Refactor artist_rop8() to avoid buffer over-run

2020-05-23 Thread Philippe Mathieu-Daudé
Invalid I/O writes can craft an offset out of the vram_buffer range. Instead of passing an unsafe pointer to artist_rop8(), pass the vram_buffer and the offset. We can now check if the offset is in range before accessing it. We avoid: Program terminated with signal SIGSEGV, Segmentation fault.

[PATCH 0/3] hw/display/artist: Fix out-of-buffer accesses found while fuzzing

2020-05-23 Thread Philippe Mathieu-Daudé
Fix various out-of-range buffer access in the artist device emulation. Bugs found using libFuzzer (docs/devel/fuzzing.txt). Philippe Mathieu-Daudé (3): hw/display/artist: Check offset in draw_line to avoid buffer over-run hw/display/artist: Refactor artist_rop8() to avoid buffer over-run hw/

[PATCH 1/3] hw/display/artist: Check offset in draw_line to avoid buffer over-run

2020-05-23 Thread Philippe Mathieu-Daudé
Invalid I/O writes can craft an offset out of the vram_buffer range. We avoid: Program terminated with signal SIGSEGV, Segmentation fault. 284 *dst &= ~plane_mask; (gdb) bt #0 0x55d5dccdc5c0 in artist_rop8 (s=0x55d5defee510, dst=0x7f8e84ed8216 , val=0 '\000') at hw/disp

[PATCH 3/3] hw/display/artist: Check offset in block_move to avoid buffer over-read

2020-05-23 Thread Philippe Mathieu-Daudé
Invalid I/O writes can craft an offset out of the vram_buffer range. We avoid: Program terminated with signal SIGSEGV, Segmentation fault. 519 artist_rop8(s, buf, dst + column, buf->data[src + column]); (gdb) bt #0 0x55fa83b05e0a in block_move (s=0x55fa8647e510, sour

Re: [Bug 1880326] [NEW] memory writes make artist_rop8() crash

2020-05-23 Thread Philippe Mathieu-Daudé
On 5/23/20 8:03 PM, Philippe Mathieu-Daudé wrote: > Public bug reported: > > As of commit d19f1ab0, LLVM libFuzzer found: > > = > ==6814==ERROR: AddressSanitizer: heap-buffer-overflow on address > 0x7fd89f97bd5a at pc 0x55dc44594db5

[Bug 1880326] [NEW] memory writes make artist_rop8() crash

2020-05-23 Thread Philippe Mathieu-Daudé
Public bug reported: As of commit d19f1ab0, LLVM libFuzzer found: = ==6814==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7fd89f97bd5a at pc 0x55dc44594db5 bp 0x7ffd6f461b40 sp 0x7ffd6f461b38 READ of size 1 at 0x7fd89f9

Re: [PATCH 12/19] configure: added tsan support for blacklist.

2020-05-23 Thread Emilio G. Cota
On Fri, May 22, 2020 at 12:07:48 -0400, Robert Foley wrote: > Initially put several files into blacklist that were > causing the most problems, namely bitops.c and bitmap.c. > > Signed-off-by: Robert Foley > --- > configure | 3 ++- > tests/tsan/blacklist.tsan | 5 + > 2 file

Re: [PATCH 0/7] hw/sparc/leon3: Few fixes and disable HelenOS test

2020-05-23 Thread Philippe Mathieu-Daudé
ping? On 5/11/20 9:03 AM, Philippe Mathieu-Daudé wrote: > On 4/14/20 12:00 PM, KONRAD Frederic wrote: >> Le 4/13/20 à 11:07 PM, Philippe Mathieu-Daudé a écrit : >>> [Cc'ing Peter] >>> >>> On 4/13/20 12:12 PM, KONRAD Frederic wrote: Le 4/11/20 à 7:30 PM, Philippe Mathieu-Daudé a écrit : >

Re: [PATCH 11/19] accel/tcg: Fixed tsan warnings related to parallel_cpus

2020-05-23 Thread Emilio G. Cota
On Fri, May 22, 2020 at 12:07:47 -0400, Robert Foley wrote: > Fixed several tsan warnings. e.g. > > WARNING: ThreadSanitizer: data race (pid=35425) > Read of size 1 at 0x557cd83aee28 by thread T7: > #0 curr_cflags include/exec/exec-all.h:460:13 > (qemu-system-aarch64+0x4b7f27) > #1 cpu_

Re: [PATCH 10/19] include/qemu: Added tsan.h for annotations.

2020-05-23 Thread Emilio G. Cota
On Fri, May 22, 2020 at 12:07:46 -0400, Robert Foley wrote: > These annotations will allow us to give tsan > additional hints. For example, we can inform > tsan about reads/writes to ignore to silence certain > classes of warnings. > We can also annotate threads so that the proper thread > naming

Re: [PATCH 18/19] target/arm: Fix tsan warning in cpu.c

2020-05-23 Thread Emilio G. Cota
On Fri, May 22, 2020 at 23:36:18 +0100, Peter Maydell wrote: > So is this: > (a) a TSan false positive, because we've analysed the use > of this struct field and know it's not a race because > [details], but which we're choosing to silence in this way > (b) an actual race for which the

Re: [PATCH 01/19] configure: add --enable-tsan flag + fiber annotations for coroutine-ucontext

2020-05-23 Thread Philippe Mathieu-Daudé
Hi Robert, On 5/22/20 6:07 PM, Robert Foley wrote: > From: Lingfeng Yang > > We tried running QEMU under tsan in 2016, but tsan's lack of support for > longjmp-based fibers was a blocker: > https://groups.google.com/forum/#!topic/thread-sanitizer/se0YuzfWazw > > Fortunately, thread sanitizer

Re: [PATCH v3] linux-user: syscall: ioctls: support DRM_IOCTL_VERSION

2020-05-23 Thread no-reply
Patchew URL: https://patchew.org/QEMU/20200523132442.22538-1-cheng...@emindsoft.com.cn/ Hi, This series failed the docker-mingw@fedora build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally. === TEST SCRIPT BEG

[PATCH v3] linux-user: syscall: ioctls: support DRM_IOCTL_VERSION

2020-05-23 Thread chengang
From: Chen Gang Another DRM_IOCTL_* commands will be done later. Signed-off-by: Chen Gang --- configure | 18 +++ linux-user/ioctls.h| 3 ++ linux-user/syscall.c | 61 ++ linux-user/syscall_defs.h | 15 ++ lin

Re: [Bug 1880225] Re: Emulation of some arm programs fail with "Assertion `have_guest_base' failed."

2020-05-23 Thread Alex Bennée
Aleksandar Markovic <1880...@bugs.launchpad.net> writes: > The problem may be in int_guest_commpage() - it returns false. > >>From gdb debugging session: > > (gdb) p addr > $1 = (void *) 0xb7ffd000 > (gdb) p want > $2 = (void *) 0x > (gdb) n > 398 if (addr != want) { > (gdb) p qemu_h

[Bug 1880287] [NEW] gcc crashes in hppa emulation

2020-05-23 Thread Helge Deller
Public bug reported: There seems to be a translation bug in the qemu-hppa (qemu v5.0.0) emulation: A stripped down testcase (taken from Linux kernel build) is attached. In there is "a.sh", a shell script which calls gcc-9 (fails with both debian gcc-9.3.0-11 or gcc-9.3.0-12). and "a.iii", the pre

[Bug 1880225] Re: Emulation of some arm programs fail with "Assertion `have_guest_base' failed."

2020-05-23 Thread Alex Bennée
** Changed in: qemu Status: New => Confirmed ** Changed in: qemu Assignee: (unassigned) => Alex Bennée (ajbennee) -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1880225 Title: Emulation

[Bug 1880225] Re: Emulation of some arm programs fail with "Assertion `have_guest_base' failed."

2020-05-23 Thread Aleksandar Markovic
The problem may be in int_guest_commpage() - it returns false. >From gdb debugging session: (gdb) p addr $1 = (void *) 0xb7ffd000 (gdb) p want $2 = (void *) 0x (gdb) n 398 if (addr != want) { (gdb) p qemu_host_page_size $3 = 4096 (gdb) l 393 394 if (addr == MAP_FAILED

Re: [Bug 1880225] Re: Emulation of some arm programs fail with "Assertion `have_guest_base' failed."

2020-05-23 Thread Alex Bennée
Aleksandar Markovic <1880...@bugs.launchpad.net> writes: > I just want to stress once again that the test was performed on a 32-bit > Intel host. Ahh - OK that makes sense. I'll see if I can replicate. -- Alex Bennée

[PATCH 1/1] util/oslib: Returns real thread identifier on FreeBSD and NetBSD

2020-05-23 Thread David CARLIER
Hi this is my first contribution hope it s useful . Regards. >From ca7fcd85e0453f7173ce73732905463bc259ee32 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 23 May 2020 08:17:51 +0100 Subject: [PATCH] util/oslib: returns real thread identifier on FreeBSD and NetBSD Signed-off-by: David Ca