Skip to contentSkip to conversation

Misc changes for 2017-01-12

GIT PULL Paolo Bonzini 3 participants 15 messages Jan 15, 2018 – Jan 16, 2018

lore
Share & tools
lore
#0 lore raw

The following changes since commit 997eba28a3ed5400a80f754bf3a1c8044b75b9ff:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180111' into staging (2018-01-11 14:34:41 +0000)

are available in the git repository at:

git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to ff9adba50bf8a4c080b8aee9be2314ef179a7b5f:

ucontext: annotate coroutine stack for ASAN (2018-01-12 15:21:14 +0100)

----------------------------------------------------------------
* QemuMutex tracing improvements (Alex)
* ram_addr_t optimization (David)
* SCSI fixes (Fam, Stefan, me)
* do {} while (0) fixes (Eric)
* KVM fix for PMU (Jan)
* memory leak fixes from ASAN (Marc-André)
* migration fix for HPET, icount, loadvm (Maria, Pavel)
* hflags fixes (me, Tao)
* block/iscsi uninitialized variable (Peter L.)
* full support for GMainContexts in character devices (Peter Xu)
* more boot-serial-test (Thomas)
* Memory leak fix (Zhecheng)

----------------------------------------------------------------
Alex Bennée (4):
scripts/qemu-gdb: add simple tcg lock status helper scripts/qemu-gdb/timers.py: new helper to dump timer state util/qemu-thread-*: add qemu_lock, locked and unlock trace events scripts/analyse-locks-simpletrace.py: script to analyse lock times

Dr. David Alan Gilbert (3):
cpu_physical_memory_sync_dirty_bitmap: Another alignment fix
find_ram_offset: Add comments and tracing
find_ram_offset: Align ram_addr_t allocation on long boundaries

Eric Blake (7):
net: Drop unusual use of do { } while (0);
mips: Tweak location of ';' in macros
chardev: Use goto/label instead of do/break/while(0)
chardev: Clean up previous patch indentation
tests: Avoid 'do/while(false); ' in vhost-user-bridge
maint: Fix macros with broken 'do/while(0); ' usage
checkpatch: Enforce proper do/while (0) style

Fam Zheng (1):
scsi-generic: Add share-rw option

Haozhong Zhang (1):
pc: fail memory hot-plug/unplug with -no-acpi and Q35 machine type

Jan Dakinevich (1):
i386/cpu/kvm: look at PMU's CPUID before setting MSRs

Marc-André Lureau (18):
build-sys: fix qemu-ga -pthread linking
build-sys: silence make by default or V=0
build-sys: add a rule to print a variable
build-sys: compile with -Og or -O1 when --enable-debug tests/docker: add some sanitizers to fedora dockerfile tests/docker: add test-debug
build-sys: add some sanitizers when --enable-debug if possible
tests: fix check-qobject leak
vl: fix direct firmware directories leak
readline: add a free function
tests: fix migration-test leak
crypto: fix stack-buffer-overflow error
qemu-config: fix leak in query-command-line-options
tests: fix qmp-test leak
tests: fix coroutine leak in /basic/entered
mips: fix potential fopen(NULL,...)
disas/s390: fix global-buffer-overflow
ucontext: annotate coroutine stack for ASAN

Paolo Bonzini (3):
scsi: fix scsi_convert_sense crash when in_buf == NULL && in_len == 0
target-i386: update hflags on Hypervisor.framework
cpus: unify qemu_*_wait_io_event

Pavel Dovgalyuk (3):
hpet: recover timer offset correctly
icount: fixed saving/restoring of icount warp timers
cpu: flush TB cache when loading VMState

Peter Lieven (1):
block/iscsi: fix initialization of iTask in iscsi_co_get_block_status

Peter Xu (3):
chardev: use backend chr context when watch for fe
chardev: let g_idle_add() be with chardev gcontext
chardev: introduce qemu_chr_timeout_add_ms()

Stefan Hajnoczi (1):
scsi-disk: release AioContext in unaligned WRITE SAME case

Tao Wu (3):
target/i386: move hflags update code to a function target/i386: hax: change to use x86_update_hflags target/i386: hax: Move x86_update_hflags.

Thomas Huth (3):
tests/boot-serial-test: Add tests for microblaze boards tests/boot-serial-test: Add a test for the moxiesim machine tests/boot-serial-test: Add support for the raspi2 machine

linzhecheng (1):
irq: fix memory leak

 .travis.yml                            |   3 +-
 Makefile                               |   7 +-
 audio/paaudio.c                        |   4 +-
 block/iscsi.c                          |   3 +-
 chardev/char-fe.c                      |   2 +-
 chardev/char-pty.c                     |  64 ++++++++--------
 chardev/char-serial.c                  |  75 +++++++++---------
 chardev/char-socket.c                  |  28 ++++---
 chardev/char.c                         |  18 +++++
 configure                              |  60 ++++++++++++++-
 cpus.c                                 | 134 ++++++++++++++++++++-------------
 crypto/ivgen-essiv.c                   |   2 +-
 disas/s390.c                           |  16 ++--
 docs/devel/build-system.txt            |  13 ++++
 exec.c                                 |  40 ++++++++--
 hw/adc/stm32f2xx_adc.c                 |   2 +-
 hw/block/m25p80.c                      |   2 +-
 hw/char/cadence_uart.c                 |   2 +-
 hw/char/stm32f2xx_usart.c              |   2 +-
 hw/char/terminal3270.c                 |  28 ++++---
 hw/display/cg3.c                       |   2 +-
 hw/display/dpcd.c                      |   2 +-
 hw/display/xlnx_dp.c                   |   2 +-
 hw/dma/pl330.c                         |   2 +-
 hw/dma/xlnx-zynq-devcfg.c              |   2 +-
 hw/dma/xlnx_dpdma.c                    |   2 +-
 hw/i2c/i2c-ddc.c                       |   2 +-
 hw/i386/pc.c                           |  18 ++++-
 hw/misc/auxbus.c                       |   2 +-
 hw/misc/macio/mac_dbdma.c              |   4 +-
 hw/misc/mmio_interface.c               |   2 +-
 hw/misc/stm32f2xx_syscfg.c             |   2 +-
 hw/misc/zynq_slcr.c                    |   2 +-
 hw/net/cadence_gem.c                   |   2 +-
 hw/net/pcnet.c                         |  20 ++---
 hw/nvram/ds1225y.c                     |   4 +-
 hw/scsi/scsi-disk.c                    |   1 +
 hw/scsi/scsi-generic.c                 |   9 +++
 hw/ssi/mss-spi.c                       |   2 +-
 hw/ssi/stm32f2xx_spi.c                 |   2 +-
 hw/ssi/xilinx_spi.c                    |   2 +-
 hw/ssi/xilinx_spips.c                  |   2 +-
 hw/timer/a9gtimer.c                    |   2 +-
 hw/timer/cadence_ttc.c                 |   2 +-
 hw/timer/hpet.c                        |  30 +++++++-
 hw/timer/mss-timer.c                   |   2 +-
 hw/timer/stm32f2xx_timer.c             |   2 +-
 hw/tpm/tpm_passthrough.c               |   2 +-
 hw/tpm/tpm_tis.c                       |   2 +-
 include/chardev/char.h                 |   3 +
 include/exec/ram_addr.h                |   5 +-
 include/hw/compat.h                    |   6 +-
 include/qemu/compiler.h                |   4 +
 include/qemu/readline.h                |   1 +
 include/qemu/thread.h                  |  39 +++++++++-
 migration/rdma.c                       |   2 +-
 monitor.c                              |   2 +-
 rules.mak                              |   2 +
 scripts/analyse-locks-simpletrace.py   |  99 ++++++++++++++++++++++++
 scripts/checkpatch.pl                  |   5 ++
 scripts/qemu-gdb.py                    |   4 +-
 scripts/qemugdb/tcg.py                 |  46 +++++++++++
 scripts/qemugdb/timers.py              |  54 +++++++++++++
 scsi/utils.c                           |  12 +--
 target/arm/translate-a64.c             |   2 +-
 target/i386/cpu.c                      |  42 +++++++++++
 target/i386/cpu.h                      |   2 +
 target/i386/hax-all.c                  |  54 +------------
 target/i386/hvf/x86hvf.c               |   2 +-
 target/i386/kvm.c                      | 121 ++++++++++++-----------------
 target/mips/msa_helper.c               |  34 +++++----
 target/s390x/kvm.c                     |   2 +-
 tests/Makefile.include                 |   5 ++
 tests/acpi-utils.h                     |   8 +-
 tests/boot-serial-test.c               |  37 +++++++++
 tests/check-qobject.c                  |   2 +
 tests/docker/dockerfiles/fedora.docker |   4 +-
 tests/docker/test-clang                |   2 +-
 tests/docker/test-debug                |  26 +++++++
 tests/docker/test-mingw                |   2 -
 tests/migration-test.c                 |   3 +-
 tests/qmp-test.c                       |   3 +-
 tests/tcg/test-mmap.c                  |   2 +-
 tests/test-coroutine.c                 |   1 -
 tests/vhost-user-bridge.c              |   6 +-
 trace-events                           |   4 +
 ui/sdl_zoom_template.h                 |   8 +-
 util/coroutine-ucontext.c              |  48 ++++++++++++
 util/qemu-config.c                     |   3 +-
 util/qemu-thread-posix.c               |  21 +++---
 util/qemu-thread-win32.c               |  20 ++---
 util/readline.c                        |  18 ++++-
 util/trace-events                      |   7 +-
 vl.c                                   |   9 ++-
 94 files changed, 1000 insertions(+), 417 deletions(-)
 create mode 100755 scripts/analyse-locks-simpletrace.py
 create mode 100644 scripts/qemugdb/tcg.py
 create mode 100644 scripts/qemugdb/timers.py
 create mode 100755 tests/docker/test-debug
Signature · 1 line
1.8.3.1
#1 lore raw

[Qemu-devel] [PULL 46/53] cpu_physical_memory_sync_dirty_bitmap: Another alignment fix

From: "Dr. David Alan Gilbert" <[email protected]>

This code has an optimised, word aligned version, and a boring unaligned version. My commit f70d345 fixed one alignment issue, but there's another.

The optimised version operates on 'longs' dealing with (typically) 64 pages at a time, replacing the whole long by a 0 and counting the bits. If the Ramblock is less than 64bits in length that long can contain bits representing two different RAMBlocks, but the code will update the bmap belinging to the 1st RAMBlock only while having updated the total dirty page count for both.

This probably didn't matter prior to 6b6712ef which split the dirty bitmap by RAMBlock, but now they're separate RAMBlocks we end up with a count that doesn't match the state in the bitmaps.

Symptom:
Migration showing a few dirty pages left to be sent constantly Seen on aarch64 and x86 with x86+ovmf

Fixes 6b6712efccd383b48a909bee0b29e079a57601ec
---
 include/exec/ram_addr.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
include/exec/ram_addr.h +3 -2
index 6cbc02a..7633ef6 100644
@@ -391,9 +391,10 @@ uint64_t cpu_physical_memory_sync_dirty_bitmap(RAMBlock *rb,
     uint64_t num_dirty = 0;
     unsigned long *dest = rb->bmap;
 
-    /* start address is aligned at the start of a word? */
+    /* start address and length is aligned at the start of a word? */
     if (((word * BITS_PER_LONG) << TARGET_PAGE_BITS) ==
-         (start + rb->offset)) {
+         (start + rb->offset) &&
+        !(length & ((BITS_PER_LONG << TARGET_PAGE_BITS) - 1))) {
         int k;
         int nr = BITS_TO_LONGS(length >> TARGET_PAGE_BITS);
         unsigned long * const *src;
Signature · 1 line
1.8.3.1
#2 lore raw

[Qemu-devel] [PULL 53/53] ucontext: annotate coroutine stack for ASAN

In reply to Paolo Bonzini

From: Marc-André Lureau <[email protected]>

It helps ASAN to detect more leaks on coroutine stacks, as found in the following patch.

A similar work would need to be done for sigaltstack & windows fibers to have similar coverage. Since ucontext is preferred, I didn't bother checking the other coroutine implementations for now.

---
 .travis.yml               |  3 ++-
 configure                 | 41 ++++++++++++++++++++++++++++++++++++++--
 include/qemu/compiler.h   |  4 ++++
 util/coroutine-ucontext.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 93 insertions(+), 3 deletions(-)
.travis.yml +2 -1
index f583839..f2291e8 100644
@@ -13,12 +13,13 @@ addons:
       - libattr1-dev
       - libbrlapi-dev
       - libcap-ng-dev
+      - libgcc-6-dev
       - libgnutls-dev
       - libgtk-3-dev
       - libiscsi-dev
       - liblttng-ust-dev
-      - libnfs-dev
       - libncurses5-dev
+      - libnfs-dev
       - libnss3-dev
       - libpixman-1-dev
       - libpng12-dev
configure +39 -2

63 lines not on this page · raw message

include/qemu/compiler.h +4 -0
index 340e5fd..5fcc4f7 100644
@@ -111,4 +111,8 @@
 #define GCC_FMT_ATTR(n, m)
 #endif
 
+#ifndef __has_feature
+#define __has_feature(x) 0 /* compatibility with non-clang compilers */
+#endif
+
 #endif /* COMPILER_H */
util/coroutine-ucontext.c +48 -0

101 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#3 lore raw
In reply to Paolo Bonzini
Quoted 13 lines · Paolo Bonzini

The following changes since commit 997eba28a3ed5400a80f754bf3a1c8044b75b9ff:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180111' into staging (2018-01-11 14:34:41 +0000)

are available in the git repository at:

git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to ff9adba50bf8a4c080b8aee9be2314ef179a7b5f:

ucontext: annotate coroutine stack for ASAN (2018-01-12 15:21:14 +0100)

Quoted 13 lines

----------------------------------------------------------------
* QemuMutex tracing improvements (Alex)
* ram_addr_t optimization (David)
* SCSI fixes (Fam, Stefan, me)
* do {} while (0) fixes (Eric)
* KVM fix for PMU (Jan)
* memory leak fixes from ASAN (Marc-André)
* migration fix for HPET, icount, loadvm (Maria, Pavel)
* hflags fixes (me, Tao)
* block/iscsi uninitialized variable (Peter L.)
* full support for GMainContexts in character devices (Peter Xu)
* more boot-serial-test (Thomas)
* Memory leak fix (Zhecheng)

Various build failures, I'm afraid:

x86-64/Linux/gcc:

configure produces an error message:

ERROR: ASAN build enabled, but ASAN header is too old.
Without code annotation, the report may be inferior.

even though this configure did not explicitly request ASAN. Then configure seems to exit successfully anyway, since the build proceeds.

For some reason the build creates config-target.h a lot:

make: Leaving directory '/home/petmay01/linaro/qemu-for-merges/build/alldbg'

  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h

[snip more lines]
GEN config-target.h
GEN config-target.h
make: Entering directory '/home/petmay01/linaro/qemu-for-merges/build/all'
GIT ui/keycodemapdb dtc capstone
make: Leaving directory '/home/petmay01/linaro/qemu-for-merges/build/all'
make: Entering directory '/home/petmay01/linaro/qemu-for-merges/build/all'
GEN qapi-event.h
[etc]

Then it runs configure again, this time without the ERROR message, and eventually fails with:

CC hw/display/exynos4210_fimd.o
/home/petmay01/linaro/qemu-for-merges/hw/display/exynos4210_fimd.c: In function ‘fimd_get_buffer_id’:
/home/petmay01/linaro/qemu-for-merges/hw/display/exynos4210_fimd.c:1105:5:
error: case label does not reduce to an integer constant

     case FIMD_WINCON_BUF2_STAT:
     ^

On sparc64 host configure fails:

config-host.mak is out-of-date, running configure

ERROR: configure test passed without -Werror but failed with -Werror.
This is probably a bug in the configure script. The failing command will be at the bottom of config.log.
You can run configure with --disable-werror to bypass this check.

The bottom of config.log is:

cc -DHAS_LIBSSH2_SFTP_FSYNC -pthread -I/usr/include/glib-2.0 -I/usr/lib/sparc64-linux-gnu/glib-2.0/include -DNCURSES_WIDECHAR -D_GNU_SOURCE -D_DEFAULT_SOURCE -I/usr/include/ncursesw -m64 -mcpu=ultrasparc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/include/p11-kit-1 -I/usr/include/libpng16 -I$(SRC_PATH)/capstone/include -fsanitize=address -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -g
cc1: warning: -fsanitize=address not supported for this target cc -Werror -DHAS_LIBSSH2_SFTP_FSYNC -pthread -I/usr/include/glib-2.0 -I/usr/lib/sparc64-linux-gnu/glib-2.0/include -DNCURSES_WIDECHAR -D_GNU_SOURCE -D_DEFAULT_SOURCE -I/usr/include/ncursesw -m64 -mcpu=ultrasparc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/include/p11-kit-1 -I/usr/include/libpng16 -I$(SRC_PATH)/capstone/include -fsanitize=address -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -g
cc1: error: -fsanitize=address not supported for this target [-Werror]

thanks
-- PMM

#4 lore raw

Hi

Quoted 28 lines · Peter Maydell
Quoted 13 lines · Paolo Bonzini

The following changes since commit 997eba28a3ed5400a80f754bf3a1c8044b75b9ff:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180111' into staging (2018-01-11 14:34:41 +0000)

are available in the git repository at:

git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to ff9adba50bf8a4c080b8aee9be2314ef179a7b5f:

ucontext: annotate coroutine stack for ASAN (2018-01-12 15:21:14 +0100)

Quoted 13 lines

----------------------------------------------------------------
* QemuMutex tracing improvements (Alex)
* ram_addr_t optimization (David)
* SCSI fixes (Fam, Stefan, me)
* do {} while (0) fixes (Eric)
* KVM fix for PMU (Jan)
* memory leak fixes from ASAN (Marc-André)
* migration fix for HPET, icount, loadvm (Maria, Pavel)
* hflags fixes (me, Tao)
* block/iscsi uninitialized variable (Peter L.)
* full support for GMainContexts in character devices (Peter Xu)
* more boot-serial-test (Thomas)
* Memory leak fix (Zhecheng)

Quoted 2 lines

Various build failures, I'm afraid:

damn, sorry..

Quoted 10 lines

x86-64/Linux/gcc:

configure produces an error message:

ERROR: ASAN build enabled, but ASAN header is too old.
Without code annotation, the report may be inferior.

even though this configure did not explicitly request ASAN. Then configure seems to exit successfully anyway, since the build proceeds.

ASAN is enabled by default if available when --enable-debug. We could add more flags if that helps.

Quoted 27 lines

For some reason the build creates config-target.h a lot:

make: Leaving directory '/home/petmay01/linaro/qemu-for-merges/build/alldbg'

  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
  GEN     config-target.h
Quoted 9 lines

[snip more lines]
GEN config-target.h
GEN config-target.h
make: Entering directory '/home/petmay01/linaro/qemu-for-merges/build/all'
GIT ui/keycodemapdb dtc capstone
make: Leaving directory '/home/petmay01/linaro/qemu-for-merges/build/all'
make: Entering directory '/home/petmay01/linaro/qemu-for-merges/build/all'
GEN qapi-event.h
[etc]

One per target no? (the build should be more silent than before)

Quoted 10 lines

Then it runs configure again, this time without the ERROR message, and eventually fails with:

CC hw/display/exynos4210_fimd.o
/home/petmay01/linaro/qemu-for-merges/hw/display/exynos4210_fimd.c: In function ‘fimd_get_buffer_id’:
/home/petmay01/linaro/qemu-for-merges/hw/display/exynos4210_fimd.c:1105:5:
error: case label does not reduce to an integer constant
case FIMD_WINCON_BUF2_STAT:

never saw that error, hmm interesting. This is related to -fsanitize=address ? Is this on Debian stable?

Quoted 41 lines
     ^

On sparc64 host configure fails:

config-host.mak is out-of-date, running configure

ERROR: configure test passed without -Werror but failed with -Werror.
This is probably a bug in the configure script. The failing command will be at the bottom of config.log.
You can run configure with --disable-werror to bypass this check.

The bottom of config.log is:

cc -DHAS_LIBSSH2_SFTP_FSYNC -pthread -I/usr/include/glib-2.0

(quoted diff) +0 -12
-I/usr/lib/sparc64-linux-gnu/glib-2.0/include -DNCURSES_WIDECHAR
-D_GNU_SOURCE -D_DEFAULT_SOURCE -I/usr/include/ncursesw -m64
-mcpu=ultrasparc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall
-Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing
-fno-common -fwrapv -Wexpansion-to-defined -Wendif-labels
-Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body
-Wnested-externs -Wformat-security -Wformat-y2k -Winit-self
-Wignored-qualifiers -Wold-style-declaration -Wold-style-definition
-Wtype-limits -fstack-protector-strong -I/usr/include/p11-kit-1
-I/usr/include/libpng16 -I$(SRC_PATH)/capstone/include
-fsanitize=address -o config-temp/qemu-conf.exe

config-temp/qemu-conf.c -m64 -g
cc1: warning: -fsanitize=address not supported for this target cc -Werror -DHAS_LIBSSH2_SFTP_FSYNC -pthread -I/usr/include/glib-2.0

(quoted diff) +0 -12
-I/usr/lib/sparc64-linux-gnu/glib-2.0/include -DNCURSES_WIDECHAR
-D_GNU_SOURCE -D_DEFAULT_SOURCE -I/usr/include/ncursesw -m64
-mcpu=ultrasparc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall
-Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing
-fno-common -fwrapv -Wexpansion-to-defined -Wendif-labels
-Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body
-Wnested-externs -Wformat-security -Wformat-y2k -Winit-self
-Wignored-qualifiers -Wold-style-declaration -Wold-style-definition
-Wtype-limits -fstack-protector-strong -I/usr/include/p11-kit-1
-I/usr/include/libpng16 -I$(SRC_PATH)/capstone/include
-fsanitize=address -o config-temp/qemu-conf.exe
Quoted 2 lines

config-temp/qemu-conf.c -m64 -g
cc1: error: -fsanitize=address not supported for this target [-Werror]

Hmm, I guess the check -fsanitize=address doesn't return an error unless -Werror is given. Perhaps it needs:

configure +2 -2
index f5550f3289..ba68c550c9 100755
@@ -5190,7 +5190,7 @@ fi
 
 have_asan=no
 write_c_skeleton
-if compile_prog "-fsanitize=address" ""; then
+if compile_prog "-Werror -fsanitize=address" ""; then
     have_asan=yes
 fi
 
@@ -5207,7 +5207,7 @@ int main(void) {
   return 0;
 }
 EOF
-if compile_prog "-fsanitize=address" "" ; then
+if compile_prog "-Werror -fsanitize=address" "" ; then
     have_asan_iface_fiber=yes
 fi
 
Signature · 1 line
Marc-André Lureau
#5 lore raw
Quoted 44 lines · Marc-André Lureau

Hi

Quoted 28 lines · Peter Maydell
Quoted 13 lines · Paolo Bonzini

The following changes since commit 997eba28a3ed5400a80f754bf3a1c8044b75b9ff:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180111' into staging (2018-01-11 14:34:41 +0000)

are available in the git repository at:

git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to ff9adba50bf8a4c080b8aee9be2314ef179a7b5f:

ucontext: annotate coroutine stack for ASAN (2018-01-12 15:21:14 +0100)

Quoted 13 lines

----------------------------------------------------------------
* QemuMutex tracing improvements (Alex)
* ram_addr_t optimization (David)
* SCSI fixes (Fam, Stefan, me)
* do {} while (0) fixes (Eric)
* KVM fix for PMU (Jan)
* memory leak fixes from ASAN (Marc-André)
* migration fix for HPET, icount, loadvm (Maria, Pavel)
* hflags fixes (me, Tao)
* block/iscsi uninitialized variable (Peter L.)
* full support for GMainContexts in character devices (Peter Xu)
* more boot-serial-test (Thomas)
* Memory leak fix (Zhecheng)

Quoted 2 lines

Various build failures, I'm afraid:

damn, sorry..

Quoted 7 lines

x86-64/Linux/gcc:

configure produces an error message:

ERROR: ASAN build enabled, but ASAN header is too old.
Without code annotation, the report may be inferior.

Quoted 6 lines
Quoted 3 lines

even though this configure did not explicitly request ASAN. Then configure seems to exit successfully anyway, since the build proceeds.

ASAN is enabled by default if available when --enable-debug. We could add more flags if that helps.

Configure switches should work like this:
* default: use feature if present, but don't complain if not present or not usable
* --enable-foo: use feature. if feature not present, complain and fail configure
* --disable-foo: don't test for or use feature

Quoted 3 lines
Quoted 1 line

For some reason the build creates config-target.h a lot:

One per target no? (the build should be more silent than before)

Oh, I guess that makes sense. It's a bit odd that the message neither gives the target part of the filename nor has those entering/leaving directory messages...

Quoted 11 lines
Quoted 10 lines

Then it runs configure again, this time without the ERROR message, and eventually fails with:

CC hw/display/exynos4210_fimd.o
/home/petmay01/linaro/qemu-for-merges/hw/display/exynos4210_fimd.c: In function ‘fimd_get_buffer_id’:
/home/petmay01/linaro/qemu-for-merges/hw/display/exynos4210_fimd.c:1105:5:
error: case label does not reduce to an integer constant
case FIMD_WINCON_BUF2_STAT:

Quoted 2 lines

never saw that error, hmm interesting. This is related to -fsanitize=address ? Is this on Debian stable?

Ubuntu xenial (16.04.3 LTS). No idea if it's related to the sanitizer or not.

Quoted 22 lines
Quoted 4 lines
     ^

On sparc64 host configure fails:

Hmm, I guess the check -fsanitize=address doesn't return an error unless -Werror is given. Perhaps it needs:

configure +1 -1
index f5550f3289..ba68c550c9 100755
@@ -5190,7 +5190,7 @@ fi
 
 have_asan=no
 write_c_skeleton
-if compile_prog "-fsanitize=address" ""; then
+if compile_prog "-Werror -fsanitize=address" ""; then
     have_asan=yes
 fi
 

configure int main(void) { · line 5213

Quoted 8 lines
configure +1 -1
@@ -5207,7 +5207,7 @@ int main(void) {
   return 0;
 }
 EOF
-if compile_prog "-fsanitize=address" "" ; then
+if compile_prog "-Werror -fsanitize=address" "" ; then
     have_asan_iface_fiber=yes
 fi
 

Looks plausible.

thanks
-- PMM

#6 lore raw
Quoted 9 lines · Peter Maydell
Quoted 2 lines

ASAN is enabled by default if available when --enable-debug. We could add more flags if that helps.

Configure switches should work like this:
* default: use feature if present, but don't complain if not present or not usable
* --enable-foo: use feature. if feature not present, complain and fail configure
* --disable-foo: don't test for or use feature

However, --enable-debug has never worked like this (the "default" part)...

Paolo

#7 lore raw
Quoted 11 lines · Paolo Bonzini
Quoted 9 lines · Peter Maydell
Quoted 2 lines

ASAN is enabled by default if available when --enable-debug. We could add more flags if that helps.

Configure switches should work like this:
* default: use feature if present, but don't complain if not present or not usable
* --enable-foo: use feature. if feature not present, complain and fail configure
* --disable-foo: don't test for or use feature

Quoted 1 line

However, --enable-debug has never worked like this (the "default" part)...

True, but -g, no optimization isn't really something we want to default to :-) I think the general principle that unless the user specifically said they cared about the address sanitizer we shouldn't complain if it happens not to work on this host is still a good one.

thanks
-- PMM

#8 lore raw
Quoted 12 lines · Peter Maydell
Quoted 11 lines · Paolo Bonzini
Quoted 9 lines · Peter Maydell
Quoted 2 lines

ASAN is enabled by default if available when --enable-debug. We could add more flags if that helps.

Configure switches should work like this:
* default: use feature if present, but don't complain if not present or not usable
* --enable-foo: use feature. if feature not present, complain and fail configure
* --disable-foo: don't test for or use feature

Quoted 4 lines
Quoted 1 line

However, --enable-debug has never worked like this (the "default" part)...

True, but -g, no optimization isn't really something we want to default to :-)

Same for ASAN. :-)

Quoted 3 lines

I think the general principle that unless the user specifically said they cared about the address sanitizer we shouldn't complain if it happens not to work on this host is still a good one.

Yes, I agree.

So we need two options:

* --enable-asan defaults to not used, but also fails configure if ASAN is not available/usable.

* if we want to have --enable-debug enable ASAN, it should however _not_ fail configure if ASAN is not available/usable. (I am not sure anymore it's a good idea).

The questions are:

* should fiber support be required for --enable-asan? What is the difference in the quality of the reports?

* if not, and assuming --enable-debug tries to enable ASAN, should --enable-debug complain if fiber support is not required? Should --enable-debug enable ASAN if fiber support is not available?

* if --enable-debug does *not* try to enable ASAN, should test-debug add --enable-asn? (I think so).

Paolo

#9 lore raw

Hi

Quoted 24 lines · Paolo Bonzini
Quoted 12 lines · Peter Maydell
Quoted 11 lines · Paolo Bonzini
Quoted 9 lines · Peter Maydell
Quoted 2 lines

ASAN is enabled by default if available when --enable-debug. We could add more flags if that helps.

Configure switches should work like this:
* default: use feature if present, but don't complain if not present or not usable
* --enable-foo: use feature. if feature not present, complain and fail configure
* --disable-foo: don't test for or use feature

Quoted 4 lines
Quoted 1 line

However, --enable-debug has never worked like this (the "default" part)...

True, but -g, no optimization isn't really something we want to default to :-)

Same for ASAN. :-)

Quoted 3 lines

I think the general principle that unless the user specifically said they cared about the address sanitizer we shouldn't complain if it happens not to work on this host is still a good one.

Quoted 6 lines

Yes, I agree.

So we need two options:

* --enable-asan defaults to not used, but also fails configure if ASAN is not available/usable.

and --enable-ubsan etc ...

I wish we would avoid the multiplication of configure options, and use good default values instead for --enable-debug. But if it's not possible, let's add more options. However, it would be great if ASAN can be enabled by default, it seems too few developers care, even though it should be strongly recommended.

Quoted 9 lines

* if we want to have --enable-debug enable ASAN, it should however _not_ fail configure if ASAN is not available/usable. (I am not sure anymore it's a good idea).

The questions are:

* should fiber support be required for --enable-asan? What is the difference in the quality of the reports?

It's not required, but helps to detect more leaks. It also removes some warnings in some cases:

Before:

elmarco@boraha:~/src/qemu/build (asan *%)$ tests/test-coroutine -p /basic/lifecycle
/basic/lifecycle: ==20781==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==20781==WARNING: ASan is ignoring requested __asan_handle_no_return:
stack top: 0x7ffcb184d000; bottom 0x7ff6c4cfd000; size: 0x0005ecb50000 (25446121472)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
OK

After:

tests/test-coroutine -p /basic/lifecycle
/basic/lifecycle: ==21110==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
OK

Quoted 3 lines

* if not, and assuming --enable-debug tries to enable ASAN, should --enable-debug complain if fiber support is not required? Should --enable-debug enable ASAN if fiber support is not available?

I propose to simply print a warning during configure

Quoted 3 lines

* if --enable-debug does *not* try to enable ASAN, should test-debug add --enable-asn? (I think so).

The other way around?

(tbh, I am not fond of all the configure options - if you need fine-grained configuration, you can overwrite the various *FLAGS..)

Signature · 1 line
Marc-André Lureau
#10 lore raw
Quoted 34 lines · Marc-André Lureau

Hi

Quoted 24 lines · Paolo Bonzini
Quoted 12 lines · Peter Maydell
Quoted 11 lines · Paolo Bonzini
Quoted 9 lines · Peter Maydell
Quoted 2 lines

ASAN is enabled by default if available when --enable-debug. We could add more flags if that helps.

Configure switches should work like this:
* default: use feature if present, but don't complain if not present or not usable
* --enable-foo: use feature. if feature not present, complain and fail configure
* --disable-foo: don't test for or use feature

Quoted 4 lines
Quoted 1 line

However, --enable-debug has never worked like this (the "default" part)...

True, but -g, no optimization isn't really something we want to default to :-)

Same for ASAN. :-)

Quoted 3 lines

I think the general principle that unless the user specifically said they cared about the address sanitizer we shouldn't complain if it happens not to work on this host is still a good one.

Quoted 6 lines

Yes, I agree.

So we need two options:

* --enable-asan defaults to not used, but also fails configure if ASAN is not available/usable.

Quoted 7 lines

and --enable-ubsan etc ...

I wish we would avoid the multiplication of configure options, and use good default values instead for --enable-debug. But if it's not possible, let's add more options. However, it would be great if ASAN can be enabled by default, it seems too few developers care, even though it should be strongly recommended.

We can add --enable-sanitizer then instead of being specific to ASAN. It could also support --enable-sanitizer=asan,ubsan but that's for later.

Quoted 5 lines
Quoted 5 lines

* if we want to have --enable-debug enable ASAN, it should however _not_ fail configure if ASAN is not available/usable. (I am not sure anymore it's a good idea).

Quoted 7 lines
Quoted 4 lines

The questions are:

* should fiber support be required for --enable-asan? What is the difference in the quality of the reports?

It's not required, but helps to detect more leaks. It also removes some warnings in some cases:

Ok, if it's not a flood of warnings it's okay.

Quoted 6 lines
Quoted 4 lines

* if not, and assuming --enable-debug tries to enable ASAN, should --enable-debug complain if fiber support is not required? Should --enable-debug enable ASAN if fiber support is not available?

I propose to simply print a warning during configure

Yes, it could do the same as --enable-asan.

Quoted 4 lines
Quoted 2 lines

* if --enable-debug does *not* try to enable ASAN, should test-debug add --enable-asn? (I think so).

The other way around?

I mean - IMO, test-debug should enable sanitizers even if --enable-sanitizer and --enable-debug are completely separate.

Paolo

#11 lore raw
Quoted 8 lines · Paolo Bonzini
Quoted 5 lines · Marc-André Lureau
Quoted 3 lines

* if not, and assuming --enable-debug tries to enable ASAN, should --enable-debug complain if fiber support is not required? Should --enable-debug enable ASAN if fiber support is not available?

I propose to simply print a warning during configure

Yes, it could do the same as --enable-asan.

The thing you want to avoid here is having one of my standard build configs produce new text saying 'warning' or 'error', because that will flag up to me as a build failure and I'll bounce the pullreq...

thanks
-- PMM

#12 lore raw
In reply to Peter Maydell

Hi

Quoted 53 lines · Peter Maydell
Quoted 44 lines · Marc-André Lureau

Hi

Quoted 28 lines · Peter Maydell
Quoted 13 lines · Paolo Bonzini

The following changes since commit 997eba28a3ed5400a80f754bf3a1c8044b75b9ff:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180111' into staging (2018-01-11 14:34:41 +0000)

are available in the git repository at:

git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to ff9adba50bf8a4c080b8aee9be2314ef179a7b5f:

ucontext: annotate coroutine stack for ASAN (2018-01-12 15:21:14 +0100)

Quoted 13 lines

----------------------------------------------------------------
* QemuMutex tracing improvements (Alex)
* ram_addr_t optimization (David)
* SCSI fixes (Fam, Stefan, me)
* do {} while (0) fixes (Eric)
* KVM fix for PMU (Jan)
* memory leak fixes from ASAN (Marc-André)
* migration fix for HPET, icount, loadvm (Maria, Pavel)
* hflags fixes (me, Tao)
* block/iscsi uninitialized variable (Peter L.)
* full support for GMainContexts in character devices (Peter Xu)
* more boot-serial-test (Thomas)
* Memory leak fix (Zhecheng)

Quoted 2 lines

Various build failures, I'm afraid:

damn, sorry..

Quoted 7 lines

x86-64/Linux/gcc:

configure produces an error message:

ERROR: ASAN build enabled, but ASAN header is too old.
Without code annotation, the report may be inferior.

Quoted 6 lines
Quoted 3 lines

even though this configure did not explicitly request ASAN. Then configure seems to exit successfully anyway, since the build proceeds.

ASAN is enabled by default if available when --enable-debug. We could add more flags if that helps.

Quoted 6 lines

Configure switches should work like this:
* default: use feature if present, but don't complain if not present or not usable
* --enable-foo: use feature. if feature not present, complain and fail configure
* --disable-foo: don't test for or use feature

Would that be enough to drop the "ERROR:" prefix ?

Quoted 21 lines
Quoted 3 lines
Quoted 1 line

For some reason the build creates config-target.h a lot:

One per target no? (the build should be more silent than before)

Oh, I guess that makes sense. It's a bit odd that the message neither gives the target part of the filename nor has those entering/leaving directory messages...

Quoted 13 lines
Quoted 10 lines

Then it runs configure again, this time without the ERROR message, and eventually fails with:

CC hw/display/exynos4210_fimd.o
/home/petmay01/linaro/qemu-for-merges/hw/display/exynos4210_fimd.c: In function ‘fimd_get_buffer_id’:
/home/petmay01/linaro/qemu-for-merges/hw/display/exynos4210_fimd.c:1105:5:
error: case label does not reduce to an integer constant
case FIMD_WINCON_BUF2_STAT:

never saw that error, hmm interesting. This is related to -fsanitize=address ? Is this on Debian stable?

Interesting, looks like a bug in gcc ubsan that doesn't happen with recent versions (related to
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80550 but probably a different bug). Adding a cast is enough:

-#define FIMD_WINCON_BUF2_STAT ((0 << 21) | (1 << 31))
+#define FIMD_WINCON_BUF2_STAT (uint32_t)((0 << 21) | (1 << 31))

It looks like there are no other cases like this

Quoted 25 lines

Ubuntu xenial (16.04.3 LTS). No idea if it's related to the sanitizer or not.

Quoted 21 lines
Quoted 4 lines
     ^

On sparc64 host configure fails:

Hmm, I guess the check -fsanitize=address doesn't return an error unless -Werror is given. Perhaps it needs:

configure +1 -1
index f5550f3289..ba68c550c9 100755
@@ -5190,7 +5190,7 @@ fi
 
 have_asan=no
 write_c_skeleton
-if compile_prog "-fsanitize=address" ""; then
+if compile_prog "-Werror -fsanitize=address" ""; then
     have_asan=yes
 fi
 
Quoted 11 lines

configure int main(void) { · line 5213

Quoted 9 lines
configure +1 -1
@@ -5207,7 +5207,7 @@ int main(void) {
   return 0;
 }
 EOF
-if compile_prog "-fsanitize=address" "" ; then
+if compile_prog "-Werror -fsanitize=address" "" ; then
     have_asan_iface_fiber=yes
 fi
 

Looks plausible.

Actually, it probably needs also $CPU_CFLAGS

Paolo, would you drop "build-sys: add some sanitizers when --enable-debug if possible" & "ucontext: annotate coroutine stack for ASAN" from the series? I'll send a new version for those 2.

Thanks

Signature · 1 line
Marc-André Lureau
#13 lore raw
Quoted 9 lines · Marc-André Lureau

Interesting, looks like a bug in gcc ubsan that doesn't happen with recent versions (related to
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80550 but probably a different bug). Adding a cast is enough:

(quoted diff) +1 -1
-#define FIMD_WINCON_BUF2_STAT       ((0 << 21) | (1 << 31))
+#define FIMD_WINCON_BUF2_STAT       (uint32_t)((0 << 21) | (1 << 31))

It looks like there are no other cases like this

Rather than casting it's probably simpler to use "1U" to get that shift to be the right type.

thanks
-- PMM

#14 lore raw
In reply to Marc-André Lureau
Quoted 136 lines · Marc-André Lureau

Hi

Quoted 53 lines · Peter Maydell
Quoted 44 lines · Marc-André Lureau

Hi

Quoted 28 lines · Peter Maydell
Quoted 13 lines · Paolo Bonzini

The following changes since commit 997eba28a3ed5400a80f754bf3a1c8044b75b9ff:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180111' into staging (2018-01-11 14:34:41 +0000)

are available in the git repository at:

git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to ff9adba50bf8a4c080b8aee9be2314ef179a7b5f:

ucontext: annotate coroutine stack for ASAN (2018-01-12 15:21:14 +0100)

Quoted 13 lines

----------------------------------------------------------------
* QemuMutex tracing improvements (Alex)
* ram_addr_t optimization (David)
* SCSI fixes (Fam, Stefan, me)
* do {} while (0) fixes (Eric)
* KVM fix for PMU (Jan)
* memory leak fixes from ASAN (Marc-André)
* migration fix for HPET, icount, loadvm (Maria, Pavel)
* hflags fixes (me, Tao)
* block/iscsi uninitialized variable (Peter L.)
* full support for GMainContexts in character devices (Peter Xu)
* more boot-serial-test (Thomas)
* Memory leak fix (Zhecheng)

Quoted 2 lines

Various build failures, I'm afraid:

damn, sorry..

Quoted 7 lines

x86-64/Linux/gcc:

configure produces an error message:

ERROR: ASAN build enabled, but ASAN header is too old.
Without code annotation, the report may be inferior.

Quoted 6 lines
Quoted 3 lines

even though this configure did not explicitly request ASAN. Then configure seems to exit successfully anyway, since the build proceeds.

ASAN is enabled by default if available when --enable-debug. We could add more flags if that helps.

Quoted 6 lines

Configure switches should work like this:
* default: use feature if present, but don't complain if not present or not usable
* --enable-foo: use feature. if feature not present, complain and fail configure
* --disable-foo: don't test for or use feature

Would that be enough to drop the "ERROR:" prefix ?

Quoted 21 lines
Quoted 3 lines
Quoted 1 line

For some reason the build creates config-target.h a lot:

One per target no? (the build should be more silent than before)

Oh, I guess that makes sense. It's a bit odd that the message neither gives the target part of the filename nor has those entering/leaving directory messages...

Quoted 13 lines
Quoted 10 lines

Then it runs configure again, this time without the ERROR message, and eventually fails with:

CC hw/display/exynos4210_fimd.o
/home/petmay01/linaro/qemu-for-merges/hw/display/exynos4210_fimd.c: In function ‘fimd_get_buffer_id’:
/home/petmay01/linaro/qemu-for-merges/hw/display/exynos4210_fimd.c:1105:5:
error: case label does not reduce to an integer constant
case FIMD_WINCON_BUF2_STAT:

never saw that error, hmm interesting. This is related to -fsanitize=address ? Is this on Debian stable?

Interesting, looks like a bug in gcc ubsan that doesn't happen with recent versions (related to
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80550 but probably a different bug). Adding a cast is enough:

(quoted diff) +1 -1
-#define FIMD_WINCON_BUF2_STAT       ((0 << 21) | (1 << 31))
+#define FIMD_WINCON_BUF2_STAT       (uint32_t)((0 << 21) | (1 << 31))

It looks like there are no other cases like this

Quoted 25 lines

Ubuntu xenial (16.04.3 LTS). No idea if it's related to the sanitizer or not.

Quoted 21 lines
Quoted 4 lines
     ^

On sparc64 host configure fails:

Hmm, I guess the check -fsanitize=address doesn't return an error unless -Werror is given. Perhaps it needs:

configure +1 -1
index f5550f3289..ba68c550c9 100755
@@ -5190,7 +5190,7 @@ fi
 
 have_asan=no
 write_c_skeleton
-if compile_prog "-fsanitize=address" ""; then
+if compile_prog "-Werror -fsanitize=address" ""; then
     have_asan=yes
 fi
 
Quoted 11 lines

configure int main(void) { · line 5213

Quoted 9 lines
configure +1 -1
@@ -5207,7 +5207,7 @@ int main(void) {
   return 0;
 }
 EOF
-if compile_prog "-fsanitize=address" "" ; then
+if compile_prog "-Werror -fsanitize=address" "" ; then
     have_asan_iface_fiber=yes
 fi
 

Looks plausible.

Quoted 5 lines

Actually, it probably needs also $CPU_CFLAGS

Paolo, would you drop "build-sys: add some sanitizers when --enable-debug if possible" & "ucontext: annotate coroutine stack for ASAN" from the series? I'll send a new version for those 2.

Yes, that was already my plan. Thanks for confirming!

Paolo