From nobody Sat May 18 06:31:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594628750; cv=none; d=zohomail.com; s=zohoarc; b=O20X3gPhpS1upVRE4dv1FIM7LcwXH1x99OTAr5ZdFG3400C9beD3t6d29FAxBJFkDAg4Y01sRh4OcKjCZJw7avQrU0IsxlLAPKpWM/pUM8Pz5xolMICzjop1KHyiCPm9x5VDHIK9W/95XN9kleaY86dH8/0Gv0RkfrizPE3j4Cs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594628750; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TCSxY69a4IEh6ENvK1x9IfIircfR5ePI2fwQkbZqkdo=; b=AeuMKrJbePoeaHDdDP1xfvrYipp9ZxQVdJJEsfBxdGUkx4PtlReWMp/3ojNBh+AQRTv3MsLSvpcPE/rXufL9qcxhOs6Ray4D9IsNHXv4zPXz/2C7wU/tKLKoBR9pp5jFrRDmidhkFRbMSHEcNpPvb5BfOhLFBEIlCdiWXA/Zu14= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594628750759190.5425214508283; Mon, 13 Jul 2020 01:25:50 -0700 (PDT) Received: from localhost ([::1]:58196 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jutmX-0003Z7-Bv for importer@patchew.org; Mon, 13 Jul 2020 04:25:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jutlb-0001xe-I7 for qemu-devel@nongnu.org; Mon, 13 Jul 2020 04:24:51 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:32594 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jutlZ-0006cT-Gv for qemu-devel@nongnu.org; Mon, 13 Jul 2020 04:24:51 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-408-GljYrIiIOvi3lJARap52uA-1; Mon, 13 Jul 2020 04:24:42 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3C4EF107ACCA; Mon, 13 Jul 2020 08:24:41 +0000 (UTC) Received: from localhost (unknown [10.36.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id D74106FEF3; Mon, 13 Jul 2020 08:24:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594628688; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TCSxY69a4IEh6ENvK1x9IfIircfR5ePI2fwQkbZqkdo=; b=fXuc1S9JfSksPeir312SZX4pnnS3VU5YDeX+ullv19sw6E/XUwiqd9G7nlOjuOpzgjOW7F 9e/2bUiqPeeZJ/Hdw15Oa8gJbrXaGj+hc4O4fUlI6aCBYV3zyu4r44KJayzbjHDSPz5uNI OgmPBVaDd3M01Wl+n0MI/mTxKmMDTHA= X-MC-Unique: GljYrIiIOvi3lJARap52uA-1 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 1/8] char-socket: initialize reconnect timer only when the timer doesn't start Date: Mon, 13 Jul 2020 12:24:17 +0400 Message-Id: <20200713082424.2947383-2-marcandre.lureau@redhat.com> In-Reply-To: <20200713082424.2947383-1-marcandre.lureau@redhat.com> References: <20200713082424.2947383-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/13 01:36:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Li Feng , "Dr. David Alan Gilbert" , Markus Armbruster , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Li Feng When the disconnect event is triggered in the connecting stage, the tcp_chr_disconnect_locked may be called twice. The first call: #0 qemu_chr_socket_restart_timer (chr=3D0x55555582ee90) at chardev/cha= r-socket.c:120 #1 0x000055555558e38c in tcp_chr_disconnect_locked (chr=3D) at chardev/char-socket.c:490 #2 0x000055555558e3cd in tcp_chr_disconnect (chr=3D0x55555582ee90) at = chardev/char-socket.c:497 #3 0x000055555558ea32 in tcp_chr_new_client (chr=3Dchr@entry=3D0x55555= 582ee90, sioc=3Dsioc@entry=3D0x55555582f0b0) at chardev/char-socket.c:892 #4 0x000055555558eeb8 in qemu_chr_socket_connected (task=3D0x55555582f= 300, opaque=3D) at chardev/char-socket.c:1090 #5 0x0000555555574352 in qio_task_complete (task=3Dtask@entry=3D0x5555= 5582f300) at io/task.c:196 #6 0x00005555555745f4 in qio_task_thread_result (opaque=3D0x55555582f3= 00) at io/task.c:111 #7 qio_task_wait_thread (task=3D0x55555582f300) at io/task.c:190 #8 0x000055555558f17e in tcp_chr_wait_connected (chr=3D0x55555582ee90,= errp=3D0x555555802a08 ) at chardev/char-socket.c:1013 #9 0x0000555555567cbd in char_socket_client_reconnect_test (opaque=3D0= x5555557fe020 ) at tests/test-char.c:1152 The second call: #0 0x00007ffff5ac3277 in raise () from /lib64/libc.so.6 #1 0x00007ffff5ac4968 in abort () from /lib64/libc.so.6 #2 0x00007ffff5abc096 in __assert_fail_base () from /lib64/libc.so.6 #3 0x00007ffff5abc142 in __assert_fail () from /lib64/libc.so.6 #4 0x000055555558d10a in qemu_chr_socket_restart_timer (chr=3D0x555555= 82ee90) at chardev/char-socket.c:125 #5 0x000055555558df0c in tcp_chr_disconnect_locked (chr=3D) at chardev/char-socket.c:490 #6 0x000055555558df4d in tcp_chr_disconnect (chr=3D0x55555582ee90) at = chardev/char-socket.c:497 #7 0x000055555558e5b2 in tcp_chr_new_client (chr=3Dchr@entry=3D0x55555= 582ee90, sioc=3Dsioc@entry=3D0x55555582f0b0) at chardev/char-socket.c:892 #8 0x000055555558e93a in tcp_chr_connect_client_sync (chr=3Dchr@entry= =3D0x55555582ee90, errp=3Derrp@entry=3D0x7fffffffd178) at chardev/char-sock= et.c:944 #9 0x000055555558ec78 in tcp_chr_wait_connected (chr=3D0x55555582ee90,= errp=3D0x555555802a08 ) at chardev/char-socket.c:1035 #10 0x000055555556804b in char_socket_client_test (opaque=3D0x5555557fe= 020 ) at tests/test-char.c:1023 Run test/test-char to reproduce this issue. test-char: chardev/char-socket.c:125: qemu_chr_socket_restart_timer: Assert= ion `!s->reconnect_timer' failed. Signed-off-by: Li Feng Acked-by: Marc-Andr=C3=A9 Lureau Message-Id: <20200522025554.41063-1-fengli@smartx.com> --- chardev/char-socket.c | 2 +- tests/test-char.c | 73 +++++++++++++++++++++++++++++++++---------- 2 files changed, 57 insertions(+), 18 deletions(-) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index 5758d9900fc..320aa7c642f 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -490,7 +490,7 @@ static void tcp_chr_disconnect_locked(Chardev *chr) if (emit_close) { qemu_chr_be_event(chr, CHR_EVENT_CLOSED); } - if (s->reconnect_time) { + if (s->reconnect_time && !s->reconnect_timer) { qemu_chr_socket_restart_timer(chr); } } diff --git a/tests/test-char.c b/tests/test-char.c index 3afc9b1b8d5..73ba1cf6010 100644 --- a/tests/test-char.c +++ b/tests/test-char.c @@ -625,12 +625,14 @@ static void char_udp_test(void) typedef struct { int event; bool got_pong; + CharBackend *be; } CharSocketTestData; =20 =20 #define SOCKET_PING "Hello" #define SOCKET_PONG "World" =20 +typedef void (*char_socket_cb)(void *opaque, QEMUChrEvent event); =20 static void char_socket_event(void *opaque, QEMUChrEvent event) @@ -639,6 +641,27 @@ char_socket_event(void *opaque, QEMUChrEvent event) data->event =3D event; } =20 +static void +char_socket_event_with_error(void *opaque, QEMUChrEvent event) +{ + static bool first_error; + CharSocketTestData *data =3D opaque; + CharBackend *be =3D data->be; + data->event =3D event; + switch (event) { + case CHR_EVENT_OPENED: + if (!first_error) { + first_error =3D true; + qemu_chr_fe_disconnect(be); + } + return; + case CHR_EVENT_CLOSED: + return; + default: + return; + } +} + =20 static void char_socket_read(void *opaque, const uint8_t *buf, int size) @@ -699,19 +722,24 @@ char_socket_addr_to_opt_str(SocketAddress *addr, bool= fd_pass, } =20 =20 -static void -char_socket_ping_pong(QIOChannel *ioc) +static int +char_socket_ping_pong(QIOChannel *ioc, Error **errp) { char greeting[sizeof(SOCKET_PING)]; const char *response =3D SOCKET_PONG; =20 - qio_channel_read_all(ioc, greeting, sizeof(greeting), &error_abort); + int ret; + ret =3D qio_channel_read_all(ioc, greeting, sizeof(greeting), errp); + if (ret !=3D 0) { + object_unref(OBJECT(ioc)); + return -1; + } =20 g_assert(memcmp(greeting, SOCKET_PING, sizeof(greeting)) =3D=3D 0); =20 - qio_channel_write_all(ioc, response, sizeof(SOCKET_PONG), &error_abort= ); - + qio_channel_write_all(ioc, response, sizeof(SOCKET_PONG), errp); object_unref(OBJECT(ioc)); + return 0; } =20 =20 @@ -723,7 +751,7 @@ char_socket_server_client_thread(gpointer data) =20 qio_channel_socket_connect_sync(ioc, addr, &error_abort); =20 - char_socket_ping_pong(QIO_CHANNEL(ioc)); + char_socket_ping_pong(QIO_CHANNEL(ioc), &error_abort); =20 return NULL; } @@ -783,6 +811,7 @@ static void char_socket_server_test(gconstpointer opaqu= e) =20 reconnect: data.event =3D -1; + data.be =3D &be; qemu_chr_fe_set_handlers(&be, NULL, NULL, char_socket_event, NULL, &data, NULL, true); @@ -855,10 +884,13 @@ char_socket_client_server_thread(gpointer data) QIOChannelSocket *ioc =3D data; QIOChannelSocket *cioc; =20 +retry: cioc =3D qio_channel_socket_accept(ioc, &error_abort); g_assert_nonnull(cioc); =20 - char_socket_ping_pong(QIO_CHANNEL(cioc)); + if (char_socket_ping_pong(QIO_CHANNEL(cioc), NULL) !=3D 0) { + goto retry; + } =20 return NULL; } @@ -869,12 +901,13 @@ typedef struct { const char *reconnect; bool wait_connected; bool fd_pass; + char_socket_cb event_cb; } CharSocketClientTestConfig; =20 - static void char_socket_client_test(gconstpointer opaque) { const CharSocketClientTestConfig *config =3D opaque; + const char_socket_cb event_cb =3D config->event_cb; QIOChannelSocket *ioc; char *optstr; Chardev *chr; @@ -938,8 +971,9 @@ static void char_socket_client_test(gconstpointer opaqu= e) =20 reconnect: data.event =3D -1; + data.be =3D &be; qemu_chr_fe_set_handlers(&be, NULL, NULL, - char_socket_event, NULL, + event_cb, NULL, &data, NULL, true); if (config->reconnect) { g_assert(data.event =3D=3D -1); @@ -977,7 +1011,7 @@ static void char_socket_client_test(gconstpointer opaq= ue) /* Setup a callback to receive the reply to our greeting */ qemu_chr_fe_set_handlers(&be, char_socket_can_read, char_socket_read, - char_socket_event, NULL, + event_cb, NULL, &data, NULL, true); g_assert(data.event =3D=3D CHR_EVENT_OPENED); data.event =3D -1; @@ -1422,17 +1456,20 @@ int main(int argc, char **argv) =20 #define SOCKET_CLIENT_TEST(name, addr) \ static CharSocketClientTestConfig client1 ## name =3D \ - { addr, NULL, false, false }; \ + { addr, NULL, false, false, char_socket_event}; \ static CharSocketClientTestConfig client2 ## name =3D \ - { addr, NULL, true, false }; \ + { addr, NULL, true, false, char_socket_event }; \ static CharSocketClientTestConfig client3 ## name =3D \ - { addr, ",reconnect=3D1", false }; \ + { addr, ",reconnect=3D1", false, false, char_socket_event }; \ static CharSocketClientTestConfig client4 ## name =3D \ - { addr, ",reconnect=3D1", true }; \ + { addr, ",reconnect=3D1", true, false, char_socket_event }; \ static CharSocketClientTestConfig client5 ## name =3D \ - { addr, NULL, false, true }; \ + { addr, NULL, false, true, char_socket_event }; \ static CharSocketClientTestConfig client6 ## name =3D \ - { addr, NULL, true, true }; \ + { addr, NULL, true, true, char_socket_event }; \ + static CharSocketClientTestConfig client7 ## name =3D \ + { addr, ",reconnect=3D1", true, false, \ + char_socket_event_with_error }; \ g_test_add_data_func("/char/socket/client/mainloop/" # name, \ &client1 ##name, char_socket_client_test); \ g_test_add_data_func("/char/socket/client/wait-conn/" # name, \ @@ -1444,7 +1481,9 @@ int main(int argc, char **argv) g_test_add_data_func("/char/socket/client/mainloop-fdpass/" # name, \ &client5 ##name, char_socket_client_test); \ g_test_add_data_func("/char/socket/client/wait-conn-fdpass/" # name, \ - &client6 ##name, char_socket_client_test) + &client6 ##name, char_socket_client_test); \ + g_test_add_data_func("/char/socket/client/reconnect-error/" # name, \ + &client7 ##name, char_socket_client_test) =20 if (has_ipv4) { SOCKET_SERVER_TEST(tcp, &tcpaddr); --=20 2.27.0.221.ga08a83db2b From nobody Sat May 18 06:31:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594628753; cv=none; d=zohomail.com; s=zohoarc; b=C4TZFS7jXJJ7RRleK9m01W7nJCD2knFUmSGk2uw0+8iirIIYjfIjoCitFF2fK3r9jhE2y5otIFLILnbki77KfKU9qKJjSVCKoyKQD1o/W/d8oH4ka+H2hq4Q8hg1Bqg4B7/pEluSjcqlO68AzciYmW3I1WuHV4X4z0Ndj3pHgow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594628753; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=P/yD2zU1ff7FhDAxEU3pV5lfrMSjbvYcorTA8NlNopo=; b=Pa6wqghpJqML0byKzKDUhUM5wTLI4wQoTmIh4i1ADNZKGAYn9MtluSBPFkoRpkcM2eU6JPAmGGbwjn7zsgpiUAV/Wno8t1FZGtlONRwFDjjmOfmwMteIMlOlToRvawce9yFnfpP1rR74VweLtJiSkPQyEmK9Pr2nnGeMeR4Dors= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594628753347420.74173583702316; Mon, 13 Jul 2020 01:25:53 -0700 (PDT) Received: from localhost ([::1]:58568 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jutma-0003j7-5P for importer@patchew.org; Mon, 13 Jul 2020 04:25:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jutle-00021c-8Q for qemu-devel@nongnu.org; Mon, 13 Jul 2020 04:24:54 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:58972 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jutlc-0006cl-GJ for qemu-devel@nongnu.org; Mon, 13 Jul 2020 04:24:53 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-350-5J4X8ZqrP9qjPNN5Ko4n-Q-1; Mon, 13 Jul 2020 04:24:50 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6BE24107ACCA for ; Mon, 13 Jul 2020 08:24:49 +0000 (UTC) Received: from localhost (unknown [10.36.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8030D27DE7C; Mon, 13 Jul 2020 08:24:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594628691; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P/yD2zU1ff7FhDAxEU3pV5lfrMSjbvYcorTA8NlNopo=; b=XWMyKKAGBcMqs2Jy/EXaU5YZ07Z+mU94qYHuia9FaA7r8od1KrpHZdQCUvAixUNlvCGiBE cAlspSzisiryB7NeBRPov+E0EEtPAWK3vyh7Sfzi6Os67fPXJ77y/HIjbKUBX5cHuL49tW Jn3ojo0zQkY3dtqYOKfEfonqhLsHaY8= X-MC-Unique: 5J4X8ZqrP9qjPNN5Ko4n-Q-1 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 2/8] chardev: don't abort on attempt to add duplicated chardev Date: Mon, 13 Jul 2020 12:24:18 +0400 Message-Id: <20200713082424.2947383-3-marcandre.lureau@redhat.com> In-Reply-To: <20200713082424.2947383-1-marcandre.lureau@redhat.com> References: <20200713082424.2947383-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/13 01:36:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Dr. David Alan Gilbert" , Markus Armbruster , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This is a regression from commit d2623129a7d ("qom: Drop parameter @errp of object_property_add() & friends"). (qemu) chardev-add id=3Dnull,backend=3Dnull (qemu) chardev-add id=3Dnull,backend=3Dnull Unexpected error in object_property_try_add() at /home/elmarco/src/qemu/qom= /object.c:1166: attempt to add duplicate property 'null' to object (type 'container') That case is currently not covered in the test suite, but will be with the queued patch "char: fix use-after-free with dup chardev & reconnect". Fixes: d2623129a7dec1d3041ad1221dda1ca49c667532 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Markus Armbruster --- chardev/char.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/chardev/char.c b/chardev/char.c index e5b43cb4b87..a0626d04d50 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -996,7 +996,11 @@ static Chardev *chardev_new(const char *id, const char= *typename, } =20 if (id) { - object_property_add_child(get_chardevs_root(), id, obj); + object_property_try_add_child(get_chardevs_root(), id, obj, + &local_err); + if (local_err) { + goto end; + } object_unref(obj); } =20 --=20 2.27.0.221.ga08a83db2b From nobody Sat May 18 06:31:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594628759; cv=none; d=zohomail.com; s=zohoarc; b=QxKTZniMcT/O/aw2aiLBKqEhbOR+hjmt8lFlDdZTZOi5KuQiCsRmxi7fSvTrPfNzazhVt+DbInTs2fM/fSQrEIyaNpkAPQDKuq7l9jym7yGIO007hkUaXGChYm9T1+IRjRy+asV6e3L7dL9hQLZvSvN76ZDq2f2z4vVvCRfj0cM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594628759; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=olYQTlXvAQ+BMyeWvUT8cC5Heg8dQQLnz23FRQO7M6s=; b=fB7E6dEGUil63VFiLR3Zc3FXpoOCyiNzJs7cVq9qT+jmQGmsj7GmLziyLiSbRwz+n/sCcBWmFyiGkOgQWQuLtSHGL31xMqjZFg3gajOc52kla/72RoELbfboaF5sMcuJhcVVZoxP18dKnpDs6r2XpY+Hv0ekGq9F4YPz2GDL3ZE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594628759314699.9694920663261; Mon, 13 Jul 2020 01:25:59 -0700 (PDT) Received: from localhost ([::1]:59214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jutmg-0003zd-3q for importer@patchew.org; Mon, 13 Jul 2020 04:25:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43116) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jutlj-0002DU-SJ for qemu-devel@nongnu.org; Mon, 13 Jul 2020 04:24:59 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:41150 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jutli-0006d7-1c for qemu-devel@nongnu.org; Mon, 13 Jul 2020 04:24:59 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-384-PkaJviu_OViSKJeyo6yAjA-1; Mon, 13 Jul 2020 04:24:55 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E10A110CE784 for ; Mon, 13 Jul 2020 08:24:54 +0000 (UTC) Received: from localhost (unknown [10.36.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 730AC27DE7C; Mon, 13 Jul 2020 08:24:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594628697; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=olYQTlXvAQ+BMyeWvUT8cC5Heg8dQQLnz23FRQO7M6s=; b=PvR143pjRJkaFUVV+UhI6QTRNePNo5CtplTyPOv1LV7etm417Wuw2FkQ9gzcbz/RxbjL+/ j5y5hddq41z+k83azzd34qcXQFxmt4cbvsQ/sQQRB1j+kUzhmgHzKr6jHIl43HdaDBFXqW lW7s71FHi1oTwRsaAfUF3u411HpDV1A= X-MC-Unique: PkaJviu_OViSKJeyo6yAjA-1 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 3/8] char: fix use-after-free with dup chardev & reconnect Date: Mon, 13 Jul 2020 12:24:19 +0400 Message-Id: <20200713082424.2947383-4-marcandre.lureau@redhat.com> In-Reply-To: <20200713082424.2947383-1-marcandre.lureau@redhat.com> References: <20200713082424.2947383-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/13 01:36:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Dr. David Alan Gilbert" , Markus Armbruster , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) With a reconnect socket, qemu_char_open() will start a background thread. It should keep a reference on the chardev. Fixes invalid read: READ of size 8 at 0x6040000ac858 thread T7 #0 0x5555598d37b8 in unix_connect_saddr /home/elmarco/src/qq/util/qemu-= sockets.c:954 #1 0x5555598d4751 in socket_connect /home/elmarco/src/qq/util/qemu-sock= ets.c:1109 #2 0x555559707c34 in qio_channel_socket_connect_sync /home/elmarco/src/= qq/io/channel-socket.c:145 #3 0x5555596adebb in tcp_chr_connect_client_task /home/elmarco/src/qq/c= hardev/char-socket.c:1104 #4 0x555559723d55 in qio_task_thread_worker /home/elmarco/src/qq/io/tas= k.c:123 #5 0x5555598a6731 in qemu_thread_start /home/elmarco/src/qq/util/qemu-t= hread-posix.c:519 #6 0x7ffff40d4431 in start_thread (/lib64/libpthread.so.0+0x9431) #7 0x7ffff40029d2 in __clone (/lib64/libc.so.6+0x1019d2) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20200420112012.567284-1-marcandre.lureau@redhat.com> --- chardev/char-socket.c | 3 ++- tests/test-char.c | 54 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 54 insertions(+), 3 deletions(-) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index 320aa7c642f..ef62dbf3d73 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -1129,7 +1129,8 @@ static void tcp_chr_connect_client_async(Chardev *chr) */ s->connect_task =3D qio_task_new(OBJECT(sioc), qemu_chr_socket_connected, - chr, NULL); + object_ref(OBJECT(chr)), + (GDestroyNotify)object_unref); qio_task_run_in_thread(s->connect_task, tcp_chr_connect_client_task, s->addr, diff --git a/tests/test-char.c b/tests/test-char.c index 73ba1cf6010..9d8746414d7 100644 --- a/tests/test-char.c +++ b/tests/test-char.c @@ -904,6 +904,52 @@ typedef struct { char_socket_cb event_cb; } CharSocketClientTestConfig; =20 +static void char_socket_client_dupid_test(gconstpointer opaque) +{ + const CharSocketClientTestConfig *config =3D opaque; + QIOChannelSocket *ioc; + char *optstr; + Chardev *chr1, *chr2; + SocketAddress *addr; + QemuOpts *opts; + Error *local_err =3D NULL; + + /* + * Setup a listener socket and determine get its address + * so we know the TCP port for the client later + */ + ioc =3D qio_channel_socket_new(); + g_assert_nonnull(ioc); + qio_channel_socket_listen_sync(ioc, config->addr, 1, &error_abort); + addr =3D qio_channel_socket_get_local_address(ioc, &error_abort); + g_assert_nonnull(addr); + + /* + * Populate the chardev address based on what the server + * is actually listening on + */ + optstr =3D char_socket_addr_to_opt_str(addr, + config->fd_pass, + config->reconnect, + false); + + opts =3D qemu_opts_parse_noisily(qemu_find_opts("chardev"), + optstr, true); + g_assert_nonnull(opts); + chr1 =3D qemu_chr_new_from_opts(opts, NULL, &error_abort); + g_assert_nonnull(chr1); + + chr2 =3D qemu_chr_new_from_opts(opts, NULL, &local_err); + g_assert_null(chr2); + error_free_or_abort(&local_err); + + object_unref(OBJECT(ioc)); + qemu_opts_del(opts); + object_unparent(OBJECT(chr1)); + qapi_free_SocketAddress(addr); + g_free(optstr); +} + static void char_socket_client_test(gconstpointer opaque) { const CharSocketClientTestConfig *config =3D opaque; @@ -1456,7 +1502,7 @@ int main(int argc, char **argv) =20 #define SOCKET_CLIENT_TEST(name, addr) \ static CharSocketClientTestConfig client1 ## name =3D \ - { addr, NULL, false, false, char_socket_event}; \ + { addr, NULL, false, false, char_socket_event }; \ static CharSocketClientTestConfig client2 ## name =3D \ { addr, NULL, true, false, char_socket_event }; \ static CharSocketClientTestConfig client3 ## name =3D \ @@ -1470,6 +1516,8 @@ int main(int argc, char **argv) static CharSocketClientTestConfig client7 ## name =3D \ { addr, ",reconnect=3D1", true, false, \ char_socket_event_with_error }; \ + static CharSocketClientTestConfig client8 ## name =3D \ + { addr, ",reconnect=3D1", false, false, char_socket_event }; \ g_test_add_data_func("/char/socket/client/mainloop/" # name, \ &client1 ##name, char_socket_client_test); \ g_test_add_data_func("/char/socket/client/wait-conn/" # name, \ @@ -1483,7 +1531,9 @@ int main(int argc, char **argv) g_test_add_data_func("/char/socket/client/wait-conn-fdpass/" # name, \ &client6 ##name, char_socket_client_test); \ g_test_add_data_func("/char/socket/client/reconnect-error/" # name, \ - &client7 ##name, char_socket_client_test) + &client7 ##name, char_socket_client_test); \ + g_test_add_data_func("/char/socket/client/dupid-reconnect/" # name, \ + &client8 ##name, char_socket_client_dupid_test) =20 if (has_ipv4) { SOCKET_SERVER_TEST(tcp, &tcpaddr); --=20 2.27.0.221.ga08a83db2b From nobody Sat May 18 06:31:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594628849; cv=none; d=zohomail.com; s=zohoarc; b=iabo77rXM0W5T33tl9PGbeResigxCFZpI3NebLb1FJa1sRhsq1jfV9Glpdldcnb4P1NqJJanR2oUvcYankBaY+z6gvboMMlZ8+AOtZfWx9mRKDnq9JSoSuvoUvkOkdyx2XL1hVd7FI1ss2/GU8FgMOI0r51guRa1vUyEsGMDJWM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594628849; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6yZN4LK0GKV68VbbOPdO4f0u9urXAF4JskCquGbXBCE=; b=SIYMjrUjcOYzwIwGdQHz+rdarnPsqp96fFWV1OHweRvEi/qr+q5MF47221BghNqdkRF38Dg+ZPGN36iReMEh3fHXHwqruX4wTZk0sqh+91gDJL02swEH985Z3FbTHYCDo9lTMviSUQDWwXYldAuOUKEdoX5WvWHfAcoNjPVa5m0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594628849784875.3059566005513; Mon, 13 Jul 2020 01:27:29 -0700 (PDT) Received: from localhost ([::1]:38078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1juto8-0006su-K7 for importer@patchew.org; Mon, 13 Jul 2020 04:27:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jutls-0002XB-4X for qemu-devel@nongnu.org; Mon, 13 Jul 2020 04:25:08 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:38440) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jutlq-0006eQ-FI for qemu-devel@nongnu.org; Mon, 13 Jul 2020 04:25:07 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-11-ACQzOLfYPXSkpMU6kx3zOA-1; Mon, 13 Jul 2020 04:25:03 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E963B106B243 for ; Mon, 13 Jul 2020 08:25:02 +0000 (UTC) Received: from localhost (unknown [10.36.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 143DE1CA; Mon, 13 Jul 2020 08:24:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594628705; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6yZN4LK0GKV68VbbOPdO4f0u9urXAF4JskCquGbXBCE=; b=YSLUd46lsAaekJrThCNY+vwTycbMjFg4E8EEJfHhe2VPdTEknl+hvpibReZpq/bN40EJw+ kef5YDFYEXnPsxYXNkBTZiW3YD2lpMjhAidjsPvwknU4eoDQ9M4d7aFlpF40ZyVDCO1YBj Ek0iHMO1t0FGy5BMYv7iG/aYB8iSGyo= X-MC-Unique: ACQzOLfYPXSkpMU6kx3zOA-1 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 4/8] monitor/misc: Remove unused "chardev/char-mux.h" include Date: Mon, 13 Jul 2020 12:24:20 +0400 Message-Id: <20200713082424.2947383-5-marcandre.lureau@redhat.com> In-Reply-To: <20200713082424.2947383-1-marcandre.lureau@redhat.com> References: <20200713082424.2947383-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/13 02:19:41 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, TVD_SPACE_RATIO=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr. David Alan Gilbert" , Markus Armbruster , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 monitor/misc.c never required "chardev/char-mux.h", remove it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200423202112.644-2-philmd@redhat.com> Reviewed-by: Richard Henderson Signed-off-by: Marc-Andr=C3=A9 Lureau --- monitor/misc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/monitor/misc.c b/monitor/misc.c index 89bb970b004..e847b58a8c9 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -33,7 +33,6 @@ #include "exec/gdbstub.h" #include "net/net.h" #include "net/slirp.h" -#include "chardev/char-mux.h" #include "ui/qemu-spice.h" #include "qemu/config-file.h" #include "qemu/ctype.h" --=20 2.27.0.221.ga08a83db2b From nobody Sat May 18 06:31:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594628841; cv=none; d=zohomail.com; s=zohoarc; b=g1R5hcCWrOW4g0nfcekH8+6izgwBsBDrUF9lAGsWa9GzxbaiWcd8ZDH2PdYJBBPq87iwnhRzWsZc+yBYuTP4tNAtUYefdN/OAVt452MR/yDAoq+Fpt6Smt/OmIn4KnjOeJnPwOaZkY7D6FhTMkVwSvjlomHREtk4FqutJHyMTLw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594628841; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1epJmthCF0SmeWNqNIUBFrgi1eFoj9KTSUPZRQHPQxU=; b=aVl3lIBPXXrpvDQ+5i3cytpLZSL+VuHvDAvSVPKRmgeg63q+z7eK4zqf7upAAJYUxb0Sgk81a9iYkPyJY1+bqntsyslOCQqQgT9k+dJR0ls+K0E31xFiiZ+MiMtpFeDV/3gmF9J9GdzBn0VEaTgjyYvoQCxLCEmGpWUutwpaeMw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594628841706204.69761159458744; Mon, 13 Jul 2020 01:27:21 -0700 (PDT) Received: from localhost ([::1]:37136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1juto0-0006WH-Cj for importer@patchew.org; Mon, 13 Jul 2020 04:27:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43176) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jutm0-0002qr-5t for qemu-devel@nongnu.org; Mon, 13 Jul 2020 04:25:16 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:38429 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jutly-0006fo-9K for qemu-devel@nongnu.org; Mon, 13 Jul 2020 04:25:15 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-327-oEnHjsONMpqPLS-aENn1hA-1; Mon, 13 Jul 2020 04:25:12 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3DEDAE91A for ; Mon, 13 Jul 2020 08:25:11 +0000 (UTC) Received: from localhost (unknown [10.36.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C44B60BF3; Mon, 13 Jul 2020 08:25:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594628713; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1epJmthCF0SmeWNqNIUBFrgi1eFoj9KTSUPZRQHPQxU=; b=J+Z+SrrJSyvTXhV68KhGHt+0qlsc8dCkvRIDGKlNds5y2pINDzsaW4XrFmZMmqEBpP0mfV vDA8y5lGGSQpOmohELWpMOzNqWSaKyIVmx5ujNNdjAVtLtJsHEuR03LXkaY+676WD3EWWl +sOLQ8yunxGl9oQF+6LWXDkNXGsoN5o= X-MC-Unique: oEnHjsONMpqPLS-aENn1hA-1 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 5/8] tests/test-char: Remove unused "chardev/char-mux.h" include Date: Mon, 13 Jul 2020 12:24:21 +0400 Message-Id: <20200713082424.2947383-6-marcandre.lureau@redhat.com> In-Reply-To: <20200713082424.2947383-1-marcandre.lureau@redhat.com> References: <20200713082424.2947383-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/13 02:19:41 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr. David Alan Gilbert" , Markus Armbruster , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 This test never required "chardev/char-mux.h", remove it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200423202112.644-3-philmd@redhat.com> Reviewed-by: Richard Henderson Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/test-char.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test-char.c b/tests/test-char.c index 9d8746414d7..614bdac2df8 100644 --- a/tests/test-char.c +++ b/tests/test-char.c @@ -6,7 +6,6 @@ #include "qemu/option.h" #include "qemu/sockets.h" #include "chardev/char-fe.h" -#include "chardev/char-mux.h" #include "sysemu/sysemu.h" #include "qapi/error.h" #include "qapi/qapi-commands-char.h" --=20 2.27.0.221.ga08a83db2b From nobody Sat May 18 06:31:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594628844; cv=none; d=zohomail.com; s=zohoarc; b=RgvjWeT3EGJcgI4ou1jylv5xGjSS4ZOQ9hWpZMlFB+W9eUKnjnWy/F1RxpBb/sQqUcdLxdH76r181VqUAfn35i4yuOk+jsqqkPxCiiyRez7N/86c1SraQI6ORmzj5VAPo1nvCMt8XMZZQnWUlLXmebPH7hTYOHmqUYphR52+uLg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594628844; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=sn5Y93DXoZh5bTRQprBPuxRGtm7UyZpjjTTy9gBsWBg=; b=P5rtPc7JXCKiJoSLHwGWwBtbePxTZQVSkDeaEIznoqcUKN52LEyATGP2bwbEhSoN1hHRjwR0W5YgzS7NZ/Dt4Kn+Rot2KGNCg2sfwXp65v/MLtBQJD4CSpGRhwZISoX9Xe9PO5mwCiSZ6kL8RKB5RwyCPdY27dPl8V2Mf+tFV0E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594628844455757.3378829437744; Mon, 13 Jul 2020 01:27:24 -0700 (PDT) Received: from localhost ([::1]:37470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1juto3-0006eL-6c for importer@patchew.org; Mon, 13 Jul 2020 04:27:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jutm8-0003C9-1K for qemu-devel@nongnu.org; Mon, 13 Jul 2020 04:25:24 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:29678 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jutm6-0006kv-CP for qemu-devel@nongnu.org; Mon, 13 Jul 2020 04:25:23 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-418-XWG-C2SNM0aMKOPD7034xw-1; Mon, 13 Jul 2020 04:25:20 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6EA17800685 for ; Mon, 13 Jul 2020 08:25:19 +0000 (UTC) Received: from localhost (unknown [10.36.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id A43842DE71; Mon, 13 Jul 2020 08:25:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594628721; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sn5Y93DXoZh5bTRQprBPuxRGtm7UyZpjjTTy9gBsWBg=; b=KKfDRbI1UqL80nizdh6oURUJjVP2dPu0isYRZQr2nvPzn4HocHy2V1NlrLqpg24Ypkz63I YJ123OU5bm0k/2t+qCLzbc3x0apjoEcIpZkOBg2Vy1owqpr0W+MKe4Y+F6Uw1kzVGkqSnD 3NW4UDa6X0Wf6J9k9xkW6JTT0eSqjEw= X-MC-Unique: XWG-C2SNM0aMKOPD7034xw-1 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 6/8] chardev: Restrict msmouse / wctablet / testdev to system emulation Date: Mon, 13 Jul 2020 12:24:22 +0400 Message-Id: <20200713082424.2947383-7-marcandre.lureau@redhat.com> In-Reply-To: <20200713082424.2947383-1-marcandre.lureau@redhat.com> References: <20200713082424.2947383-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/13 01:36:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr. David Alan Gilbert" , Markus Armbruster , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 The msmouse / wctablet / testdev character devices are only used by system emulation. Remove them from user mode and tools. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200423202112.644-4-philmd@redhat.com> Reviewed-by: Richard Henderson Signed-off-by: Marc-Andr=C3=A9 Lureau --- chardev/Makefile.objs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chardev/Makefile.objs b/chardev/Makefile.objs index 3a58c9d329d..62ec0a33235 100644 --- a/chardev/Makefile.objs +++ b/chardev/Makefile.objs @@ -17,7 +17,7 @@ chardev-obj-y +=3D char-udp.o chardev-obj-$(CONFIG_WIN32) +=3D char-win.o chardev-obj-$(CONFIG_WIN32) +=3D char-win-stdio.o =20 -common-obj-y +=3D msmouse.o wctablet.o testdev.o +common-obj-$(CONFIG_SOFTMMU) +=3D msmouse.o wctablet.o testdev.o =20 ifeq ($(CONFIG_BRLAPI),y) common-obj-m +=3D baum.o --=20 2.27.0.221.ga08a83db2b From nobody Sat May 18 06:31:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594628911; cv=none; d=zohomail.com; s=zohoarc; b=UEIrXZps7VHpdt7gA6KrA4d/rcnWvlF6x8zIqfLomqFOLTh9pp9Tu3Ib+kP8I07plHQQPmgGX/MtvUNPe/JpyXhCZ4O9c5CSVgg3g4xJuRAiLj11aPw4mxWGTjkwv//TnWdkgTu12qEksUVRWVVbj+LfrdDXh2bTUeNsmxWY8Qc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594628911; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=p0oJ9UgpysMUgLti/JnzJeqywWH1bplR+eDieJj4a5Y=; b=EXlAz5umC+xz1yih7TW9b8a6JykKfuAeNZclJglmOsxg651ta4kvMB3F0fypO20x0nhTa93lr5gZl9l9VO6I8IF2OsjLsPXexG4QKkGMGnMOyJNBoy1WAERCM2q4yhedC+cAXQcRjJ/TXJlbvOBPJXVpNQ7RSZ40PgM3RyK0HJQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594628911651787.6342663256033; Mon, 13 Jul 2020 01:28:31 -0700 (PDT) Received: from localhost ([::1]:43070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jutp7-0000QV-CY for importer@patchew.org; Mon, 13 Jul 2020 04:28:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jutmG-0003cS-QM for qemu-devel@nongnu.org; Mon, 13 Jul 2020 04:25:32 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:36339 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jutmF-0006lY-0V for qemu-devel@nongnu.org; Mon, 13 Jul 2020 04:25:32 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-352-C9Fpep6UMISy04PP070oLw-1; Mon, 13 Jul 2020 04:25:28 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9BAE9E91A for ; Mon, 13 Jul 2020 08:25:27 +0000 (UTC) Received: from localhost (unknown [10.36.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF18459; Mon, 13 Jul 2020 08:25:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594628730; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p0oJ9UgpysMUgLti/JnzJeqywWH1bplR+eDieJj4a5Y=; b=LbSMcfur+JCymWk0ipJzzWlV8axhZPPgCzIBddjjBB7skB1BEsZmt2ME0TG4fZS5DLK6Jz w29k/eBvnJdwS5qmpRuqjnp4zBZb8BishQeroC8T3sbBhf8FyyOYDzBFJ84XXqMqNuhiMh HqcdgHhSXhZxBBUwyvn0M5R6g9tDkh4= X-MC-Unique: C9Fpep6UMISy04PP070oLw-1 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 7/8] chardev: Reduce "char-mux.h" scope, rename it "chardev-internal.h" Date: Mon, 13 Jul 2020 12:24:23 +0400 Message-Id: <20200713082424.2947383-8-marcandre.lureau@redhat.com> In-Reply-To: <20200713082424.2947383-1-marcandre.lureau@redhat.com> References: <20200713082424.2947383-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/13 03:20:22 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr. David Alan Gilbert" , Markus Armbruster , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 No file out of chardev/ requires access to this header, restrict its scope. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200423202112.644-5-philmd@redhat.com> Reviewed-by: Richard Henderson Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/chardev/char-mux.h =3D> chardev/chardev-internal.h | 7 ++++--- chardev/char-fe.c | 2 +- chardev/char-mux.c | 2 +- chardev/char.c | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) rename include/chardev/char-mux.h =3D> chardev/chardev-internal.h (96%) diff --git a/include/chardev/char-mux.h b/chardev/chardev-internal.h similarity index 96% rename from include/chardev/char-mux.h rename to chardev/chardev-internal.h index 417fe32eedf..e0264ac3498 100644 --- a/include/chardev/char-mux.h +++ b/chardev/chardev-internal.h @@ -1,5 +1,5 @@ /* - * QEMU System Emulator + * QEMU Character device internals * * Copyright (c) 2003-2008 Fabrice Bellard * @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN * THE SOFTWARE. */ -#ifndef CHAR_MUX_H -#define CHAR_MUX_H +#ifndef CHARDEV_INTERNAL_H +#define CHARDEV_INTERNAL_H =20 #include "chardev/char.h" #include "chardev/char-fe.h" @@ -30,6 +30,7 @@ #define MAX_MUX 4 #define MUX_BUFFER_SIZE 32 /* Must be a power of 2. */ #define MUX_BUFFER_MASK (MUX_BUFFER_SIZE - 1) + typedef struct MuxChardev { Chardev parent; CharBackend *backends[MAX_MUX]; diff --git a/chardev/char-fe.c b/chardev/char-fe.c index f3530a90e63..474715c5a92 100644 --- a/chardev/char-fe.c +++ b/chardev/char-fe.c @@ -29,7 +29,7 @@ =20 #include "chardev/char-fe.h" #include "chardev/char-io.h" -#include "chardev/char-mux.h" +#include "chardev-internal.h" =20 int qemu_chr_fe_write(CharBackend *be, const uint8_t *buf, int len) { diff --git a/chardev/char-mux.c b/chardev/char-mux.c index 46c44af67c4..6f980bb8364 100644 --- a/chardev/char-mux.c +++ b/chardev/char-mux.c @@ -29,7 +29,7 @@ #include "chardev/char.h" #include "sysemu/block-backend.h" #include "sysemu/sysemu.h" -#include "chardev/char-mux.h" +#include "chardev-internal.h" =20 /* MUX driver for serial I/O splitting */ =20 diff --git a/chardev/char.c b/chardev/char.c index a0626d04d50..807be52300e 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -40,7 +40,7 @@ #include "qemu/id.h" #include "qemu/coroutine.h" =20 -#include "chardev/char-mux.h" +#include "chardev-internal.h" =20 /***********************************************************/ /* character device */ --=20 2.27.0.221.ga08a83db2b From nobody Sat May 18 06:31:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594628907; cv=none; d=zohomail.com; s=zohoarc; b=Q/8t443GhxCza0H4trERe+iuaiNRJs524A381GcV8RCUxVv7iDPzwUpp34EDSP9SK0tUCUWTL1ZSBrUIcTbuFuO5LAdqBTOlfweECyZMYreckJoGjYd0oTqpn3CS2wtVotfvxY8r/IjtahSMfO+0iPEn0u2bpMZ6SdVpChs6ZYM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594628907; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tBsau8jOfwRZQzzDPU2wnY6HOyNPZwnSDlheVxVne2k=; b=RLglByl/A3BvpPrgA1XT/kfDsSxpbhrOWTLbah6O8+QYIiKua4j4Dok6mCioKii1B4YvN4LHKys9OqKZnWgxCOFxhlqhIkeCnWy+TX/9wt8fQak6yXimi7XtVgqWbXVxfeSyn8UIbzoSSzqMLa9MeeL3NZBDQFKwQeb1EFx+Tv0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594628907801232.41623755796218; Mon, 13 Jul 2020 01:28:27 -0700 (PDT) Received: from localhost ([::1]:42868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jutp4-0000LG-Ii for importer@patchew.org; Mon, 13 Jul 2020 04:28:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43360) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jutmf-0004c5-8B for qemu-devel@nongnu.org; Mon, 13 Jul 2020 04:25:57 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:22793 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jutmd-0006sX-BQ for qemu-devel@nongnu.org; Mon, 13 Jul 2020 04:25:56 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-424-_LB_Mp3aO-2fmQU-_5DLYg-1; Mon, 13 Jul 2020 04:25:37 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 853A5E91A for ; Mon, 13 Jul 2020 08:25:36 +0000 (UTC) Received: from localhost (unknown [10.36.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8125E60BF3; Mon, 13 Jul 2020 08:25:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594628754; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tBsau8jOfwRZQzzDPU2wnY6HOyNPZwnSDlheVxVne2k=; b=OHy1lIcnKmBWlCl5ikbeQu/PPpvD22kzE2IolNebm3fq9b/nc9K2zJmjU+VzZUblPXpzr1 60BgVvknWL7aW+2JwfuzrJPzJ+Ko0qAdonO5MxXqfHSCicscH4r5DXKvLeOBeyldjg7KJh T7Q44QwDVC8wfIvFOomxgV8FssAaHAg= X-MC-Unique: _LB_Mp3aO-2fmQU-_5DLYg-1 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PULL 8/8] chardev: Extract system emulation specific code Date: Mon, 13 Jul 2020 12:24:24 +0400 Message-Id: <20200713082424.2947383-9-marcandre.lureau@redhat.com> In-Reply-To: <20200713082424.2947383-1-marcandre.lureau@redhat.com> References: <20200713082424.2947383-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/13 03:20:22 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr. David Alan Gilbert" , Markus Armbruster , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 Split out code only used during system emulation, to reduce code pulled in user emulation and tools. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200423202112.644-6-philmd@redhat.com> Reviewed-by: Richard Henderson Signed-off-by: Marc-Andr=C3=A9 Lureau --- chardev/chardev-internal.h | 3 ++ chardev/char.c | 35 +------------------ chardev/chardev-sysemu.c | 69 ++++++++++++++++++++++++++++++++++++++ chardev/Makefile.objs | 1 + 4 files changed, 74 insertions(+), 34 deletions(-) create mode 100644 chardev/chardev-sysemu.c diff --git a/chardev/chardev-internal.h b/chardev/chardev-internal.h index e0264ac3498..f4d0429763b 100644 --- a/chardev/chardev-internal.h +++ b/chardev/chardev-internal.h @@ -26,6 +26,7 @@ =20 #include "chardev/char.h" #include "chardev/char-fe.h" +#include "qom/object.h" =20 #define MAX_MUX 4 #define MUX_BUFFER_SIZE 32 /* Must be a power of 2. */ @@ -59,4 +60,6 @@ typedef struct MuxChardev { void mux_set_focus(Chardev *chr, int focus); void mux_chr_send_all_event(Chardev *chr, QEMUChrEvent event); =20 +Object *get_chardevs_root(void); + #endif /* CHAR_MUX_H */ diff --git a/chardev/char.c b/chardev/char.c index 807be52300e..77e7ec814f2 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -45,7 +45,7 @@ /***********************************************************/ /* character device */ =20 -static Object *get_chardevs_root(void) +Object *get_chardevs_root(void) { return container_get(object_get_root(), "/chardevs"); } @@ -305,33 +305,6 @@ static const TypeInfo char_type_info =3D { .class_init =3D char_class_init, }; =20 -static int chardev_machine_done_notify_one(Object *child, void *opaque) -{ - Chardev *chr =3D (Chardev *)child; - ChardevClass *class =3D CHARDEV_GET_CLASS(chr); - - if (class->chr_machine_done) { - return class->chr_machine_done(chr); - } - - return 0; -} - -static void chardev_machine_done_hook(Notifier *notifier, void *unused) -{ - int ret =3D object_child_foreach(get_chardevs_root(), - chardev_machine_done_notify_one, NULL); - - if (ret) { - error_report("Failed to call chardev machine_done hooks"); - exit(1); - } -} - -static Notifier chardev_machine_done_notify =3D { - .notify =3D chardev_machine_done_hook, -}; - static bool qemu_chr_is_busy(Chardev *s) { if (CHARDEV_IS_MUX(s)) { @@ -1198,12 +1171,6 @@ void qemu_chr_cleanup(void) static void register_types(void) { type_register_static(&char_type_info); - - /* this must be done after machine init, since we register FEs with mu= xes - * as part of realize functions like serial_isa_realizefn when -nograp= hic - * is specified - */ - qemu_add_machine_init_done_notifier(&chardev_machine_done_notify); } =20 type_init(register_types); diff --git a/chardev/chardev-sysemu.c b/chardev/chardev-sysemu.c new file mode 100644 index 00000000000..eecdc615ee1 --- /dev/null +++ b/chardev/chardev-sysemu.c @@ -0,0 +1,69 @@ +/* + * QEMU System Emulator + * + * Copyright (c) 2003-2008 Fabrice Bellard + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ + +#include "qemu/osdep.h" +#include "sysemu/sysemu.h" +#include "chardev/char.h" +#include "qemu/error-report.h" +#include "chardev-internal.h" + +static int chardev_machine_done_notify_one(Object *child, void *opaque) +{ + Chardev *chr =3D (Chardev *)child; + ChardevClass *class =3D CHARDEV_GET_CLASS(chr); + + if (class->chr_machine_done) { + return class->chr_machine_done(chr); + } + + return 0; +} + +static void chardev_machine_done_hook(Notifier *notifier, void *unused) +{ + int ret =3D object_child_foreach(get_chardevs_root(), + chardev_machine_done_notify_one, NULL); + + if (ret) { + error_report("Failed to call chardev machine_done hooks"); + exit(1); + } +} + + +static Notifier chardev_machine_done_notify =3D { + .notify =3D chardev_machine_done_hook, +}; + +static void register_types(void) +{ + /* + * This must be done after machine init, since we register FEs with mu= xes + * as part of realize functions like serial_isa_realizefn when -nograp= hic + * is specified. + */ + qemu_add_machine_init_done_notifier(&chardev_machine_done_notify); +} + +type_init(register_types); diff --git a/chardev/Makefile.objs b/chardev/Makefile.objs index 62ec0a33235..3783dadc4c7 100644 --- a/chardev/Makefile.objs +++ b/chardev/Makefile.objs @@ -1,4 +1,5 @@ chardev-obj-y +=3D char.o +chardev-obj-$(CONFIG_SOFTMMU) +=3D chardev-sysemu.o chardev-obj-$(CONFIG_WIN32) +=3D char-console.o chardev-obj-$(CONFIG_POSIX) +=3D char-fd.o chardev-obj-y +=3D char-fe.o --=20 2.27.0.221.ga08a83db2b