From nobody Fri Oct 24 09:56:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518730276117168.37706278696066; Thu, 15 Feb 2018 13:31:16 -0800 (PST) Received: from localhost ([::1]:33531 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emR7b-0002Av-BH for importer@patchew.org; Thu, 15 Feb 2018 16:31:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47402) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emR2f-0005qI-PE for qemu-devel@nongnu.org; Thu, 15 Feb 2018 16:26:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emR2c-0000lp-Ji for qemu-devel@nongnu.org; Thu, 15 Feb 2018 16:26:09 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:42844 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1emR2c-0000jb-Fa for qemu-devel@nongnu.org; Thu, 15 Feb 2018 16:26:06 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0E8008424D for ; Thu, 15 Feb 2018 21:26:01 +0000 (UTC) Received: from localhost (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5FDA213AEE2; Thu, 15 Feb 2018 21:26:00 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Thu, 15 Feb 2018 22:25:47 +0100 Message-Id: <20180215212552.26997-2-marcandre.lureau@redhat.com> In-Reply-To: <20180215212552.26997-1-marcandre.lureau@redhat.com> References: <20180215212552.26997-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 15 Feb 2018 21:26:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 15 Feb 2018 21:26:01 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'marcandre.lureau@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 1/6] build-sys: fix -fsanitize=address check X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Since 218bb57dd79d6843e0592c30a82ea8c1fddc74a5, the -fsanitize=3Daddress check fails with: config-temp/qemu-conf.c:3:20: error: integer overflow in expression [-Werro= r=3Doverflow] return INT32_MIN / -1; Interestingly, UBSAN check doesn't produce a compile time warning. Use a test that doesn't have compile time warnings, and make it specific to UBSAN check. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Emilio G. Cota --- configure | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/configure b/configure index 913e14839d..cc610823e1 100755 --- a/configure +++ b/configure @@ -5306,25 +5306,27 @@ fi ########################################## # checks for sanitizers =20 -# we could use a simple skeleton for flags checks, but this also -# detect the static linking issue of ubsan, see also: -# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D84285 -cat > $TMPC << EOF -#include -int main(void) { - return INT32_MIN / -1; -} -EOF - have_asan=3Dno have_ubsan=3Dno have_asan_iface_h=3Dno have_asan_iface_fiber=3Dno =20 if test "$sanitizers" =3D "yes" ; then + write_c_skeleton if compile_prog "$CPU_CFLAGS -Werror -fsanitize=3Daddress" ""; then have_asan=3Dyes fi + + # we could use a simple skeleton for flags checks, but this also + # detect the static linking issue of ubsan, see also: + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D84285 + cat > $TMPC << EOF +#include +int main(void) { + void *tmp =3D malloc(10); + return *(int *)(tmp + 2); +} +EOF if compile_prog "$CPU_CFLAGS -Werror -fsanitize=3Dundefined" ""; then have_ubsan=3Dyes fi --=20 2.16.1.73.g5832b7e9f2 From nobody Fri Oct 24 09:56:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518730109744105.54785194631063; Thu, 15 Feb 2018 13:28:29 -0800 (PST) Received: from localhost ([::1]:33348 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emR4l-0007Jk-6I for importer@patchew.org; Thu, 15 Feb 2018 16:28:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47404) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emR2f-0005qK-Pj for qemu-devel@nongnu.org; Thu, 15 Feb 2018 16:26:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emR2c-0000lq-K7 for qemu-devel@nongnu.org; Thu, 15 Feb 2018 16:26:09 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:42842 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1emR2c-0000jd-ES for qemu-devel@nongnu.org; Thu, 15 Feb 2018 16:26:06 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C1CFA84250 for ; Thu, 15 Feb 2018 21:26:02 +0000 (UTC) Received: from localhost (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 689382026E04; Thu, 15 Feb 2018 21:26:02 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Thu, 15 Feb 2018 22:25:48 +0100 Message-Id: <20180215212552.26997-3-marcandre.lureau@redhat.com> In-Reply-To: <20180215212552.26997-1-marcandre.lureau@redhat.com> References: <20180215212552.26997-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 15 Feb 2018 21:26:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 15 Feb 2018 21:26:02 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'marcandre.lureau@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 2/6] lockable: workaround GCC link issue with ASAN X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Current GCC has an optimization bug when compiling with ASAN. See also GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D84307 Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/qemu/lockable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/qemu/lockable.h b/include/qemu/lockable.h index b6ed6c89ec..84ea794bcf 100644 --- a/include/qemu/lockable.h +++ b/include/qemu/lockable.h @@ -28,7 +28,7 @@ struct QemuLockable { * to QEMU_MAKE_LOCKABLE. For optimized builds, we can rely on dead-code = elimination * from the compiler, and give the errors already at link time. */ -#ifdef __OPTIMIZE__ +#if defined(__OPTIMIZE__) && !defined(__SANITIZE_ADDRESS__) void unknown_lock_type(void *); #else static inline void unknown_lock_type(void *unused) --=20 2.16.1.73.g5832b7e9f2 From nobody Fri Oct 24 09:56:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518730259864541.7504550165262; Thu, 15 Feb 2018 13:30:59 -0800 (PST) Received: from localhost ([::1]:33496 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emR7L-00021m-2T for importer@patchew.org; Thu, 15 Feb 2018 16:30:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emR2f-0005qN-Q6 for qemu-devel@nongnu.org; Thu, 15 Feb 2018 16:26:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emR2c-0000m0-Kv for qemu-devel@nongnu.org; Thu, 15 Feb 2018 16:26:09 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37684 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1emR2c-0000ja-FD for qemu-devel@nongnu.org; Thu, 15 Feb 2018 16:26:06 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5D9454023112 for ; Thu, 15 Feb 2018 21:26:04 +0000 (UTC) Received: from localhost (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id DED75213AEE4; Thu, 15 Feb 2018 21:26:03 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Thu, 15 Feb 2018 22:25:49 +0100 Message-Id: <20180215212552.26997-4-marcandre.lureau@redhat.com> In-Reply-To: <20180215212552.26997-1-marcandre.lureau@redhat.com> References: <20180215212552.26997-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 15 Feb 2018 21:26:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 15 Feb 2018 21:26:04 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'marcandre.lureau@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 3/6] vhost-user-test: add back memfd check X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This revert commit fb68096da3d35e64c88cd610c1fa42766c58e92a, and modify test_read_guest_mem() to use different chardev names, when using memfd (_test_server_free(), where the chardev is removed, runs in idle). Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Maxime Coquelin --- tests/vhost-user-test.c | 93 +++++++++++++++++++++++++++++++++++----------= ---- 1 file changed, 66 insertions(+), 27 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index a217353e2c..67e5f7f858 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -18,6 +18,7 @@ #include "qemu/range.h" #include "qemu/sockets.h" #include "chardev/char-fe.h" +#include "qemu/memfd.h" #include "sysemu/sysemu.h" #include "libqos/libqos.h" #include "libqos/pci-pc.h" @@ -40,23 +41,14 @@ #define HAVE_MONOTONIC_TIME #endif =20 -#define QEMU_CMD_MEM " -m %d -object memory-backend-file,id=3Dmem,size= =3D%dM,"\ +#define QEMU_CMD_MEM " -m %d -object memory-backend-file,id=3Dmem,size= =3D%dM," \ "mem-path=3D%s,share=3Don -numa node,memdev=3Dmem" +#define QEMU_CMD_MEMFD " -m %d -object memory-backend-memfd,id=3Dmem,size= =3D%dM," \ + " -numa node,memdev=3Dmem" #define QEMU_CMD_CHR " -chardev socket,id=3D%s,path=3D%s%s" #define QEMU_CMD_NETDEV " -netdev vhost-user,id=3Dnet0,chardev=3D%s,vhostf= orce" #define QEMU_CMD_NET " -device virtio-net-pci,netdev=3Dnet0" =20 -#define QEMU_CMD QEMU_CMD_MEM QEMU_CMD_CHR \ - QEMU_CMD_NETDEV QEMU_CMD_NET - -#define GET_QEMU_CMD(s) \ - g_strdup_printf(QEMU_CMD, 512, 512, (root), (s)->chr_name, \ - (s)->socket_path, "", (s)->chr_name) - -#define GET_QEMU_CMDE(s, mem, chr_opts, extra, ...) \ - g_strdup_printf(QEMU_CMD extra, (mem), (mem), (root), (s)->chr_name, \ - (s)->socket_path, (chr_opts), (s)->chr_name, ##__VA_AR= GS__) - #define HUGETLBFS_MAGIC 0x958458f6 =20 /*********** FROM hw/virtio/vhost-user.c *********************************= ****/ @@ -175,6 +167,33 @@ static void test_server_listen(TestServer *server); static const char *tmpfs; static const char *root; =20 +enum test_memfd { + TEST_MEMFD_AUTO, + TEST_MEMFD_YES, + TEST_MEMFD_NO, +}; + +static char *get_qemu_cmd(TestServer *s, + int mem, enum test_memfd memfd, const char *mem_= path, + const char *chr_opts, const char *extra) +{ + if (memfd =3D=3D TEST_MEMFD_AUTO && qemu_memfd_check()) { + memfd =3D TEST_MEMFD_YES; + } + + if (memfd =3D=3D TEST_MEMFD_YES) { + return g_strdup_printf(QEMU_CMD_MEMFD QEMU_CMD_CHR + QEMU_CMD_NETDEV QEMU_CMD_NET "%s", mem, mem, + s->chr_name, s->socket_path, + chr_opts, s->chr_name, extra); + } else { + return g_strdup_printf(QEMU_CMD_MEM QEMU_CMD_CHR + QEMU_CMD_NETDEV QEMU_CMD_NET "%s", mem, mem, + mem_path, s->chr_name, s->socket_path, + chr_opts, s->chr_name, extra); + } +} + static void init_virtio_dev(TestServer *s, uint32_t features_mask) { uint32_t features; @@ -640,16 +659,18 @@ GSourceFuncs test_migrate_source_funcs =3D { .check =3D test_migrate_source_check, }; =20 -static void test_read_guest_mem(void) +static void test_read_guest_mem(const void *arg) { + enum test_memfd memfd =3D GPOINTER_TO_INT(arg); TestServer *server =3D NULL; char *qemu_cmd =3D NULL; QTestState *s =3D NULL; =20 - server =3D test_server_new("test"); + server =3D test_server_new(memfd =3D=3D TEST_MEMFD_YES ? + "read-guest-memfd" : "read-guest-mem"); test_server_listen(server); =20 - qemu_cmd =3D GET_QEMU_CMD(server); + qemu_cmd =3D get_qemu_cmd(server, 512, memfd, root, "", ""); =20 s =3D qtest_start(qemu_cmd); g_free(qemu_cmd); @@ -671,7 +692,7 @@ static void test_migrate(void) char *uri =3D g_strdup_printf("%s%s", "unix:", dest->mig_path); QTestState *global =3D global_qtest, *from, *to; GSource *source; - gchar *cmd; + gchar *cmd, *tmp; QDict *rsp; guint8 *log; guint64 size; @@ -679,7 +700,7 @@ static void test_migrate(void) test_server_listen(s); test_server_listen(dest); =20 - cmd =3D GET_QEMU_CMDE(s, 2, "", ""); + cmd =3D get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, root, "", ""); from =3D qtest_start(cmd); g_free(cmd); =20 @@ -688,7 +709,9 @@ static void test_migrate(void) size =3D get_log_size(s); g_assert_cmpint(size, =3D=3D, (2 * 1024 * 1024) / (VHOST_LOG_PAGE * 8)= ); =20 - cmd =3D GET_QEMU_CMDE(dest, 2, "", " -incoming %s", uri); + tmp =3D g_strdup_printf(" -incoming %s", uri); + cmd =3D get_qemu_cmd(dest, 2, TEST_MEMFD_AUTO, root, "", tmp); + g_free(tmp); to =3D qtest_init(cmd); g_free(cmd); =20 @@ -801,7 +824,7 @@ static void test_reconnect_subprocess(void) char *cmd; =20 g_thread_new("connect", connect_thread, s); - cmd =3D GET_QEMU_CMDE(s, 2, ",server", ""); + cmd =3D get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, root, ",server", ""); qtest_start(cmd); g_free(cmd); =20 @@ -839,7 +862,7 @@ static void test_connect_fail_subprocess(void) =20 s->test_fail =3D true; g_thread_new("connect", connect_thread, s); - cmd =3D GET_QEMU_CMDE(s, 2, ",server", ""); + cmd =3D get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, root, ",server", ""); qtest_start(cmd); g_free(cmd); =20 @@ -869,7 +892,7 @@ static void test_flags_mismatch_subprocess(void) =20 s->test_flags =3D TEST_FLAGS_DISCONNECT; g_thread_new("connect", connect_thread, s); - cmd =3D GET_QEMU_CMDE(s, 2, ",server", ""); + cmd =3D get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, root, ",server", ""); qtest_start(cmd); g_free(cmd); =20 @@ -904,11 +927,21 @@ static void test_multiqueue(void) s->queues =3D 2; test_server_listen(s); =20 - cmd =3D g_strdup_printf(QEMU_CMD_MEM QEMU_CMD_CHR QEMU_CMD_NETDEV ",qu= eues=3D%d " - "-device virtio-net-pci,netdev=3Dnet0,mq=3Don,ve= ctors=3D%d", - 512, 512, root, s->chr_name, - s->socket_path, "", s->chr_name, - s->queues, s->queues * 2 + 2); + if (qemu_memfd_check()) { + cmd =3D g_strdup_printf( + QEMU_CMD_MEMFD QEMU_CMD_CHR QEMU_CMD_NETDEV ",queues=3D%d " + "-device virtio-net-pci,netdev=3Dnet0,mq=3Don,vectors=3D%d", + 512, 512, s->chr_name, + s->socket_path, "", s->chr_name, + s->queues, s->queues * 2 + 2); + } else { + cmd =3D g_strdup_printf( + QEMU_CMD_MEM QEMU_CMD_CHR QEMU_CMD_NETDEV ",queues=3D%d " + "-device virtio-net-pci,netdev=3Dnet0,mq=3Don,vectors=3D%d", + 512, 512, root, s->chr_name, + s->socket_path, "", s->chr_name, + s->queues, s->queues * 2 + 2); + } qtest_start(cmd); g_free(cmd); =20 @@ -954,7 +987,13 @@ int main(int argc, char **argv) /* run the main loop thread so the chardev may operate */ thread =3D g_thread_new(NULL, thread_function, loop); =20 - qtest_add_func("/vhost-user/read-guest-mem", test_read_guest_mem); + if (qemu_memfd_check()) { + qtest_add_data_func("/vhost-user/read-guest-mem/memfd", + GINT_TO_POINTER(TEST_MEMFD_YES), + test_read_guest_mem); + } + qtest_add_data_func("/vhost-user/read-guest-mem/memfile", + GINT_TO_POINTER(TEST_MEMFD_NO), test_read_guest_me= m); qtest_add_func("/vhost-user/migrate", test_migrate); qtest_add_func("/vhost-user/multiqueue", test_multiqueue); =20 --=20 2.16.1.73.g5832b7e9f2 From nobody Fri Oct 24 09:56:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518730113053463.7201867293637; Thu, 15 Feb 2018 13:28:33 -0800 (PST) Received: from localhost ([::1]:33350 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emR4y-0007Wk-8F for importer@patchew.org; Thu, 15 Feb 2018 16:28:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47407) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emR2f-0005qO-QH for qemu-devel@nongnu.org; Thu, 15 Feb 2018 16:26:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emR2c-0000mI-Sq for qemu-devel@nongnu.org; Thu, 15 Feb 2018 16:26:09 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38160 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1emR2c-0000lX-Ok for qemu-devel@nongnu.org; Thu, 15 Feb 2018 16:26:06 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E5DCEF8FE8 for ; Thu, 15 Feb 2018 21:26:05 +0000 (UTC) Received: from localhost (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 82871FFD37; Thu, 15 Feb 2018 21:26:05 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Thu, 15 Feb 2018 22:25:50 +0100 Message-Id: <20180215212552.26997-5-marcandre.lureau@redhat.com> In-Reply-To: <20180215212552.26997-1-marcandre.lureau@redhat.com> References: <20180215212552.26997-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 15 Feb 2018 21:26:05 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 15 Feb 2018 21:26:05 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'marcandre.lureau@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 4/6] vhost-user-test: do not hang if chardev creation failed X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Before the chardev name fix, the following error may happen: "attempt to add duplicate property 'chr-test' to object (type 'container')", due to races. Sadly, error_vprintf() uses g_test_message(), so you have to use read the cryptic --debug-log to see it. Later, it would make sense to use g_critical() instead, and catch errors with g_test_expect_message() (in glib 2.34). Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Maxime Coquelin --- tests/vhost-user-test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 67e5f7f858..efd28411d3 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -513,6 +513,7 @@ static void test_server_create_chr(TestServer *server, = const gchar *opt) chr =3D qemu_chr_new(server->chr_name, chr_path); g_free(chr_path); =20 + g_assert_nonnull(chr); qemu_chr_fe_init(&server->chr, chr, &error_abort); qemu_chr_fe_set_handlers(&server->chr, chr_can_read, chr_read, chr_event, NULL, server, NULL, true); --=20 2.16.1.73.g5832b7e9f2 From nobody Fri Oct 24 09:56:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518730170725310.55786629043087; Thu, 15 Feb 2018 13:29:30 -0800 (PST) Received: from localhost ([::1]:33351 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emR5u-0000G8-0x for importer@patchew.org; Thu, 15 Feb 2018 16:29:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47456) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emR2i-0005tb-16 for qemu-devel@nongnu.org; Thu, 15 Feb 2018 16:26:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emR2h-0000qH-8f for qemu-devel@nongnu.org; Thu, 15 Feb 2018 16:26:12 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:42032 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1emR2d-0000o8-PM; Thu, 15 Feb 2018 16:26:07 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6248A8182D32; Thu, 15 Feb 2018 21:26:07 +0000 (UTC) Received: from localhost (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0BF89213AEE2; Thu, 15 Feb 2018 21:26:06 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Thu, 15 Feb 2018 22:25:51 +0100 Message-Id: <20180215212552.26997-6-marcandre.lureau@redhat.com> In-Reply-To: <20180215212552.26997-1-marcandre.lureau@redhat.com> References: <20180215212552.26997-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 15 Feb 2018 21:26:07 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 15 Feb 2018 21:26:07 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'marcandre.lureau@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 5/6] ahci-test: fix opts leak of skip tests X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, John Snow , "open list:IDE" , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Fixes the following ASAN report: Direct leak of 128 byte(s) in 8 object(s) allocated from: #0 0x7fefce311850 in malloc (/lib64/libasan.so.4+0xde850) #1 0x7fefcdd5ef0c in g_malloc ../glib/gmem.c:94 #2 0x559b976faff0 in create_ahci_io_test /home/elmarco/src/qemu/tests/a= hci-test.c:1810 Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: John Snow Reviewed-by: John Snow --- tests/ahci-test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/ahci-test.c b/tests/ahci-test.c index 7aa5af428c..1bd3cc7ca8 100644 --- a/tests/ahci-test.c +++ b/tests/ahci-test.c @@ -1822,6 +1822,7 @@ static void create_ahci_io_test(enum IOMode type, enu= m AddrMode addr, if ((addr =3D=3D ADDR_MODE_LBA48) && (offset =3D=3D OFFSET_HIGH) && (mb_to_sectors(test_image_size_mb) <=3D 0xFFFFFFF)) { g_test_message("%s: skipped; test image too small", name); + g_free(opts); g_free(name); return; } --=20 2.16.1.73.g5832b7e9f2 From nobody Fri Oct 24 09:56:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518730402229218.18656262158834; Thu, 15 Feb 2018 13:33:22 -0800 (PST) Received: from localhost ([::1]:33758 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emR9c-000492-K7 for importer@patchew.org; Thu, 15 Feb 2018 16:33:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emR2h-0005tN-PJ for qemu-devel@nongnu.org; Thu, 15 Feb 2018 16:26:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emR2h-0000q7-1x for qemu-devel@nongnu.org; Thu, 15 Feb 2018 16:26:11 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37690 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1emR2g-0000pq-UG for qemu-devel@nongnu.org; Thu, 15 Feb 2018 16:26:11 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8AF304023112 for ; Thu, 15 Feb 2018 21:26:10 +0000 (UTC) Received: from localhost (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id B714310102EB; Thu, 15 Feb 2018 21:26:08 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Thu, 15 Feb 2018 22:25:52 +0100 Message-Id: <20180215212552.26997-7-marcandre.lureau@redhat.com> In-Reply-To: <20180215212552.26997-1-marcandre.lureau@redhat.com> References: <20180215212552.26997-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 15 Feb 2018 21:26:10 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 15 Feb 2018 21:26:10 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'marcandre.lureau@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 6/6] sdhci-test: fix leaks X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Fix the following ASAN reports: =3D=3D20125=3D=3DERROR: LeakSanitizer: detected memory leaks Direct leak of 24 byte(s) in 1 object(s) allocated from: #0 0x7f0faea03a38 in __interceptor_calloc (/lib64/libasan.so.4+0xdea38) #1 0x7f0fae450f75 in g_malloc0 ../glib/gmem.c:124 #2 0x562fffd526fc in machine_start /home/elmarco/src/qemu/tests/sdhci-t= est.c:180 Indirect leak of 152 byte(s) in 1 object(s) allocated from: #0 0x7f0faea03850 in malloc (/lib64/libasan.so.4+0xde850) #1 0x7f0fae450f0c in g_malloc ../glib/gmem.c:94 #2 0x562fffd5d21d in qpci_init_pc /home/elmarco/src/qemu/tests/libqos/p= ci-pc.c:122 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/sdhci-test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/sdhci-test.c b/tests/sdhci-test.c index 493023fd0c..8a7099398c 100644 --- a/tests/sdhci-test.c +++ b/tests/sdhci-test.c @@ -209,8 +209,10 @@ static QSDHCI *machine_start(const struct sdhci_t *tes= t) =20 static void machine_stop(QSDHCI *s) { + qpci_free_pc(s->pci.bus); g_free(s->pci.dev); qtest_quit(global_qtest); + g_free(s); } =20 static void test_machine(const void *data) --=20 2.16.1.73.g5832b7e9f2