From e66ab9c9b9836f37866605acd2e1efda422b0e31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Salva=20Peir=C3=B3?=
Date: Tue, 8 Sep 2015 08:40:20 +0200 Subject: [PATCH] tests/nec-usb-xhci-test.c --- tests/Makefile | 2 + tests/nec-usb-xhci-test.c | 102 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 tests/nec-usb-xhci-test.c diff --git a/tests/Makefile b/tests/Makefile index 34c6136..08ae505 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -416,6 +416,8 @@ tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o qemu-char.o qemu-timer.o tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o libqemuutil.a libqemustub.a tests/test-write-threshold$(EXESUF): tests/test-write-threshold.o $(block-obj-y) libqemuutil.a libqemustub.a +tests/nec-usb-xhci-test$(EXESUF): tests/nec-usb-xhci-test.o $(libqos-pc-obj-y) $(qtest-obj-y) tests/libqtest.o libqemuutil.a libqemustub.a + ifeq ($(CONFIG_POSIX),y) LIBS += -lutil diff --git a/tests/nec-usb-xhci-test.c b/tests/nec-usb-xhci-test.c new file mode 100644 index 0000000..b7b09f1 --- /dev/null +++ b/tests/nec-usb-xhci-test.c @@ -0,0 +1,102 @@ +/* + * QTest testcase for nec-usb-xhci crash on writeb to bar 0 + * + * Copyright (c) 2015 Salva Peiró + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +/* + Steps to reproduce the scenario: + + 1) Compile with: + make tests/nec-usb-xhci-test + + 2) Run with: + QTEST_QEMU_BINARY=i386-softmmu/qemu-system-i386 tests/nec-usb-xhci-test + + 3) Output: + /i386/nec-usb-xhci/writeb: + dev 1234:1111 bar 2 [0xe0000000/4096] + dev 1033:194 bar 0 [0xe0001000/16384] + Broken pipe + + Program received signal SIGSEGV, Segmentation fault. + 0x0000000000000000 in ?? () + (db) bt + #0 0x0000000000000000 in ?? () + #1 0x00007f4f2651af83 in memory_region_oldmmio_write_accessor (attrs=..., mask=