From nobody Sat May 4 21:13:37 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1679389494; cv=none; d=zohomail.com; s=zohoarc; b=N2mnKlJwg1JHj1OpAKX6eEHxj7TOWRgHXynF9Mfo8SSw+H+IJkOZIq7MECR4TnejVBiCClg0QOOu3wOEGmpCT5woyKu2wwT2Tb1ltqlNEKCb+zFOl70iWAwfsrp/f8gBmZSYZmqKMjf/HmQJHwowBX7mWqbjq5V/1QMZAiFer/g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679389494; 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=OmBKzqnvTkw0dK8h5N6r2S6vFRh/pIoAHkYszr5eE2Y=; b=hzuvSTLGaaalLBHPfXdesVYllZjYnWhxzUR9chMCnN0rjs68D3VHro/aPxHvC+cvjjQXG82H/4YCsErRqS3mdiG94U/XFiDucfoIOwaCOFSAzZ3Ne4nUyZ+9b1Lh//DZrOgwiGUYKVUBclyp49bVJutE1bD7Gm9OnMMysUP7kmA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1679389494673558.0507616419844; Tue, 21 Mar 2023 02:04:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1peXuL-0000Lh-5s; Tue, 21 Mar 2023 05:03:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peXuF-0000KX-Gq for qemu-devel@nongnu.org; Tue, 21 Mar 2023 05:03:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peXuD-0001ix-SR for qemu-devel@nongnu.org; Tue, 21 Mar 2023 05:03:47 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-623-je5FKwZlMHW3vlN4eRASmg-1; Tue, 21 Mar 2023 05:03:43 -0400 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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 24036101A531; Tue, 21 Mar 2023 09:03:43 +0000 (UTC) Received: from localhost (unknown [10.39.208.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5CCC2027047; Tue, 21 Mar 2023 09:03:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679389424; 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=OmBKzqnvTkw0dK8h5N6r2S6vFRh/pIoAHkYszr5eE2Y=; b=Z13qVR/UdTXZ0N+5k/csJTIPya9v7dBUiRMpHLOnNpRkNCSzo6gUL/WlzwlDcgaldYrRM6 MdUOzDraI4WfKUTrZgL/PE7DlL3dnL2+8swO4eXbzpQpfo5KzMDXKWC3fi671wh896vR9w s5KivDlR8VogQ8zbXS2xcHiWjF/4Lhc= X-MC-Unique: je5FKwZlMHW3vlN4eRASmg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , berrange@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Stefan Weil Subject: [PULL 1/7] win32: add qemu_close_socket_osfhandle() Date: Tue, 21 Mar 2023 13:03:28 +0400 Message-Id: <20230321090334.1841607-2-marcandre.lureau@redhat.com> In-Reply-To: <20230321090334.1841607-1-marcandre.lureau@redhat.com> References: <20230321090334.1841607-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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=-0.001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1679389495006100001 From: Marc-Andr=C3=A9 Lureau Close the given file descriptor, but returns the underlying SOCKET. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230320133643.1618437-2-marcandre.lureau@redhat.com> --- include/sysemu/os-win32.h | 15 ++++++-- util/oslib-win32.c | 75 +++++++++++++++++++++------------------ 2 files changed, 53 insertions(+), 37 deletions(-) diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h index e2849f88ab..15c296e0eb 100644 --- a/include/sysemu/os-win32.h +++ b/include/sysemu/os-win32.h @@ -171,10 +171,21 @@ bool qemu_socket_select(int sockfd, WSAEVENT hEventOb= ject, =20 bool qemu_socket_unselect(int sockfd, Error **errp); =20 -/* We wrap all the sockets functions so that we can - * set errno based on WSAGetLastError() +/* We wrap all the sockets functions so that we can set errno based on + * WSAGetLastError(), and use file-descriptors instead of SOCKET. */ =20 +/* + * qemu_close_socket_osfhandle: + * @fd: a file descriptor associated with a SOCKET + * + * Close only the C run-time file descriptor, leave the SOCKET opened. + * + * Returns zero on success. On error, -1 is returned, and errno is set to + * indicate the error. + */ +int qemu_close_socket_osfhandle(int fd); + #undef close #define close qemu_close_wrap int qemu_close_wrap(int fd); diff --git a/util/oslib-win32.c b/util/oslib-win32.c index 16f8a67f7e..a98638729a 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -479,40 +479,27 @@ int qemu_bind_wrap(int sockfd, const struct sockaddr = *addr, return ret; } =20 - #undef close -int qemu_close_wrap(int fd) +int qemu_close_socket_osfhandle(int fd) { - int ret; + SOCKET s =3D _get_osfhandle(fd); DWORD flags =3D 0; - SOCKET s =3D INVALID_SOCKET; - - if (fd_is_socket(fd)) { - s =3D _get_osfhandle(fd); - - /* - * If we were to just call _close on the descriptor, it would clos= e the - * HANDLE, but it wouldn't free any of the resources associated to= the - * SOCKET, and we can't call _close after calling closesocket, bec= ause - * closesocket has already closed the HANDLE, and _close would att= empt to - * close the HANDLE again, resulting in a double free. We can howe= ver - * protect the HANDLE from actually being closed long enough to cl= ose the - * file descriptor, then close the socket itself. - */ - if (!GetHandleInformation((HANDLE)s, &flags)) { - errno =3D EACCES; - return -1; - } =20 - if (!SetHandleInformation((HANDLE)s, HANDLE_FLAG_PROTECT_FROM_CLOS= E, HANDLE_FLAG_PROTECT_FROM_CLOSE)) { - errno =3D EACCES; - return -1; - } + /* + * If we were to just call _close on the descriptor, it would close the + * HANDLE, but it wouldn't free any of the resources associated to the + * SOCKET, and we can't call _close after calling closesocket, because + * closesocket has already closed the HANDLE, and _close would attempt= to + * close the HANDLE again, resulting in a double free. We can however + * protect the HANDLE from actually being closed long enough to close = the + * file descriptor, then close the socket itself. + */ + if (!GetHandleInformation((HANDLE)s, &flags)) { + errno =3D EACCES; + return -1; } =20 - ret =3D close(fd); - - if (s !=3D INVALID_SOCKET && !SetHandleInformation((HANDLE)s, flags, f= lags)) { + if (!SetHandleInformation((HANDLE)s, HANDLE_FLAG_PROTECT_FROM_CLOSE, H= ANDLE_FLAG_PROTECT_FROM_CLOSE)) { errno =3D EACCES; return -1; } @@ -521,15 +508,33 @@ int qemu_close_wrap(int fd) * close() returns EBADF since we PROTECT_FROM_CLOSE the underlying ha= ndle, * but the FD is actually freed */ - if (ret < 0 && (s =3D=3D INVALID_SOCKET || errno !=3D EBADF)) { - return ret; + if (close(fd) < 0 && errno !=3D EBADF) { + return -1; } =20 - if (s !=3D INVALID_SOCKET) { - ret =3D closesocket(s); - if (ret < 0) { - errno =3D socket_error(); - } + if (!SetHandleInformation((HANDLE)s, flags, flags)) { + errno =3D EACCES; + return -1; + } + + return 0; +} + +int qemu_close_wrap(int fd) +{ + SOCKET s =3D INVALID_SOCKET; + int ret =3D -1; + + if (!fd_is_socket(fd)) { + return close(fd); + } + + s =3D _get_osfhandle(fd); + qemu_close_socket_osfhandle(fd); + + ret =3D closesocket(s); + if (ret < 0) { + errno =3D socket_error(); } =20 return ret; --=20 2.39.2 From nobody Sat May 4 21:13:37 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1679389537; cv=none; d=zohomail.com; s=zohoarc; b=J8IK2+5YFbARcrPJ0jL1K1evMugQIUaHBMRqrBuDiNN7NJrznMcINGBHmJB1eL9jHsjQA3sUv1p/+VV8tfwohpVuZyRTWuxtIBUeAm53hVybAQT5te34m2gZF2su18GYaEKFZ1/gd/q7wkBMuRGisw+s7r2hN+C1zUasn8yILhk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679389537; 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=SaUFJcUgdXiHoS+ska1vXzvK2WreSoHpVr6/1XsK7e4=; b=FTWqeteRCoVX/yo6qATw4aAe71xZbq5bXDM3yc9M2gSMYi5Zd+0aZ1H6sbUAegpl0Mqtu8zIqeHbibnnfwRTyxmmskvRHxMug9FjoUZk6wsdZUUv6Owef5aMm7PFB6z1/xGMo2Iwxn7ta1mnDQi+cIT2+DbJ1Sz5wq1fccSHJvE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16793895375901015.6834688032288; Tue, 21 Mar 2023 02:05:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1peXuN-0000M5-DM; Tue, 21 Mar 2023 05:03:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peXuM-0000Lr-EN for qemu-devel@nongnu.org; Tue, 21 Mar 2023 05:03:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peXuK-0001k4-RG for qemu-devel@nongnu.org; Tue, 21 Mar 2023 05:03:54 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-518-FiqHLhcsMYeMW24AYMq9Aw-1; Tue, 21 Mar 2023 05:03:47 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9A4A3185A78F; Tue, 21 Mar 2023 09:03:47 +0000 (UTC) Received: from localhost (unknown [10.39.208.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id B99AB40C6E67; Tue, 21 Mar 2023 09:03:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679389429; 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=SaUFJcUgdXiHoS+ska1vXzvK2WreSoHpVr6/1XsK7e4=; b=c0FBewEJQJa3mbCBaRUSk36SYUFLqGwalyxtDvkvH3SzykqBr+jlO43DBGEJNrYmki+GR9 2cqZNaJPTRXykuCSoB1m3aUweAgolwXG+fNTnzqkDqOEQpj7ZnipguenG+lQmyI8RNZBva RNJWbIdEr/M62yHiPw38ZUOJ57fQwD4= X-MC-Unique: FiqHLhcsMYeMW24AYMq9Aw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , berrange@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Stefan Weil Subject: [PULL 2/7] ui/spice: fix SOCKET handling regression Date: Tue, 21 Mar 2023 13:03:29 +0400 Message-Id: <20230321090334.1841607-3-marcandre.lureau@redhat.com> In-Reply-To: <20230321090334.1841607-1-marcandre.lureau@redhat.com> References: <20230321090334.1841607-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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=-0.001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1679389539678100007 From: Marc-Andr=C3=A9 Lureau Spice uses SOCKET on win32, but QEMU now uses file-descriptors. Fixes "8.0.0rc0 Regression: spicy windows doesn't open": https://gitlab.com/qemu-project/qemu/-/issues/1549 Fixes: commit abe34282b ("win32: avoid mixing SOCKET and file descriptor sp= ace") Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230320133643.1618437-3-marcandre.lureau@redhat.com> --- ui/spice-core.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/ui/spice-core.c b/ui/spice-core.c index b05c830086..67cfd3ca9c 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -90,13 +90,23 @@ struct SpiceWatch { static void watch_read(void *opaque) { SpiceWatch *watch =3D opaque; - watch->func(watch->fd, SPICE_WATCH_EVENT_READ, watch->opaque); + int fd =3D watch->fd; + +#ifdef WIN32 + fd =3D _get_osfhandle(fd); +#endif + watch->func(fd, SPICE_WATCH_EVENT_READ, watch->opaque); } =20 static void watch_write(void *opaque) { SpiceWatch *watch =3D opaque; - watch->func(watch->fd, SPICE_WATCH_EVENT_WRITE, watch->opaque); + int fd =3D watch->fd; + +#ifdef WIN32 + fd =3D _get_osfhandle(fd); +#endif + watch->func(fd, SPICE_WATCH_EVENT_WRITE, watch->opaque); } =20 static void watch_update_mask(SpiceWatch *watch, int event_mask) @@ -117,6 +127,14 @@ static SpiceWatch *watch_add(int fd, int event_mask, S= piceWatchFunc func, void * { SpiceWatch *watch; =20 +#ifdef WIN32 + fd =3D _open_osfhandle(fd, _O_BINARY); + if (fd < 0) { + error_setg_win32(&error_warn, WSAGetLastError(), "Couldn't associa= te a FD with the SOCKET"); + return NULL; + } +#endif + watch =3D g_malloc0(sizeof(*watch)); watch->fd =3D fd; watch->func =3D func; @@ -129,6 +147,10 @@ static SpiceWatch *watch_add(int fd, int event_mask, S= piceWatchFunc func, void * static void watch_remove(SpiceWatch *watch) { qemu_set_fd_handler(watch->fd, NULL, NULL, NULL); +#ifdef WIN32 + /* SOCKET is owned by spice */ + qemu_close_to_socket(watch->fd); +#endif g_free(watch); } =20 @@ -908,6 +930,9 @@ static int qemu_spice_set_pw_expire(time_t expires) =20 static int qemu_spice_display_add_client(int csock, int skipauth, int tls) { +#ifdef WIN32 + csock =3D qemu_close_socket_osfhandle(csock); +#endif if (tls) { return spice_server_add_ssl_client(spice_server, csock, skipauth); } else { --=20 2.39.2 From nobody Sat May 4 21:13:37 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1679389472; cv=none; d=zohomail.com; s=zohoarc; b=GqPDhM9lVtPb2igfxbFeWOzCAU6jB9bYQhM6nHF9wg1/pTgBuYUM62ndV0G4eJIZjfe0kHwvoCJZCdG1YYVlB7CkQXkeU1TTIEmQP/W/o9B/dAFMF52I4RbhitjZj6wA3hyLuUSb1WrZme8xfXG24y889QCxrpLGTNEcMPNGK1c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679389472; 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=SH7Vs8Use5jl2HTgj99PFzcN6I1iuntoClZw/u4DcFo=; b=GGAhJI/zL8jyIhkB7haYAK4l8GEwSssXaO59PKkUtSvCaRdZqHTGvJLPSsId9zCSK9aiKH/HDUkxj+2oSTPXvLjktwFqxztzRjUWVrh16As6ZWNB2LQjfvG3L05fejJ+mZnJ+jwVVeH6P59tOYj3jxlHUnVJH2FlyHUc5z5ZNnU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1679389472474126.18179377738261; Tue, 21 Mar 2023 02:04:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1peXuQ-0000Mn-Mc; Tue, 21 Mar 2023 05:03:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peXuP-0000Ma-C2 for qemu-devel@nongnu.org; Tue, 21 Mar 2023 05:03:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peXuN-0001kl-Vl for qemu-devel@nongnu.org; Tue, 21 Mar 2023 05:03:57 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-212-RFrM48bsO0yy4NYy0pBcCw-1; Tue, 21 Mar 2023 05:03:51 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 86F1F3810B0D; Tue, 21 Mar 2023 09:03:51 +0000 (UTC) Received: from localhost (unknown [10.39.208.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id C0273492C13; Tue, 21 Mar 2023 09:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679389435; 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=SH7Vs8Use5jl2HTgj99PFzcN6I1iuntoClZw/u4DcFo=; b=OUBPXtDr3Fd6eVZh+zdYNJcHp85c9oOUcfW9XH5/9KWZmIlN1KfiCQu0xnNxCq9jpjgiz2 cohd/qEuLhTrOskvWPMiOVSElqWx07+WAWllSkI/f3M4wgbTJeT73hhHzr4n/4bYrflp19 Lr+GWTOPf8p03t7SvDirozLDB/ttQiU= X-MC-Unique: RFrM48bsO0yy4NYy0pBcCw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , berrange@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Stefan Weil Subject: [PULL 3/7] ui/dbus: fix passing SOCKET to GSocket API & leak Date: Tue, 21 Mar 2023 13:03:30 +0400 Message-Id: <20230321090334.1841607-4-marcandre.lureau@redhat.com> In-Reply-To: <20230321090334.1841607-1-marcandre.lureau@redhat.com> References: <20230321090334.1841607-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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=-0.001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1679389473392100001 From: Marc-Andr=C3=A9 Lureau -display dbus is not currently available to win32 users, so it's not considered a regression. Note also the close() leak fix in case of error. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230320133643.1618437-4-marcandre.lureau@redhat.com> --- ui/dbus.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ui/dbus.c b/ui/dbus.c index 0513de9918..b9e9698503 100644 --- a/ui/dbus.c +++ b/ui/dbus.c @@ -304,11 +304,20 @@ dbus_display_add_client(int csock, Error **errp) g_cancellable_cancel(dbus_display->add_client_cancellable); } =20 +#ifdef WIN32 + socket =3D g_socket_new_from_fd(_get_osfhandle(csock), &err); +#else socket =3D g_socket_new_from_fd(csock, &err); +#endif if (!socket) { error_setg(errp, "Failed to setup D-Bus socket: %s", err->message); + close(csock); return false; } +#ifdef WIN32 + /* socket owns the SOCKET handle now, so release our osf handle */ + qemu_close_socket_osfhandle(csock); +#endif =20 conn =3D g_socket_connection_factory_create_connection(socket); =20 --=20 2.39.2 From nobody Sat May 4 21:13:37 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1679389490; cv=none; d=zohomail.com; s=zohoarc; b=LYYoEPBWWxL+vsNutSRtgePsuuruRCFpRgRm98aGK2v4gYW8yX03oEpenwK6KtiXmjmp9kd7TajwjlYgzafcx4PxLqFC7svFjCMELd1ucl2bIraB1Jl2ne6XmvG2RxY9z21qGC6HKQXTPAXZgwkgAaadnV1gC0OnMa7tqAY1V1A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679389490; 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=awOXNY7RbBzJ2qqhZZ+juO6HXjBOqJzzWOEUtsenNTo=; b=lzOkwvEfRp1i2ko4iEtgGswI+NvPpgDxO290Bpgb39nTyVQwj+6WPDLLKqkCI8xztTi9YAiZxw+cdILdgfhbZ3urABhZv+F1UB7VAV5bHOAaG0jOYLXZzIrtPXKzkamLCAPA05HqZS8e3jTA864MxQ/1XdPFDDQtTotRkWJh5XM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1679389490657722.4164486270253; Tue, 21 Mar 2023 02:04:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1peXuW-0000NR-LU; Tue, 21 Mar 2023 05:04:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peXuR-0000N5-N0 for qemu-devel@nongnu.org; Tue, 21 Mar 2023 05:03:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peXuQ-0001kx-Be for qemu-devel@nongnu.org; Tue, 21 Mar 2023 05:03:59 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-260-f6-cQY60PWCYynQLnAN5FQ-1; Tue, 21 Mar 2023 05:03:56 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E9D5F3810B07; Tue, 21 Mar 2023 09:03:55 +0000 (UTC) Received: from localhost (unknown [10.39.208.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2E1DDC15BA0; Tue, 21 Mar 2023 09:03:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679389437; 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=awOXNY7RbBzJ2qqhZZ+juO6HXjBOqJzzWOEUtsenNTo=; b=h9RKb8gWaXNPDOnNn7gNZcvbeUDQ2b+62x/EHiTmF+unvGHyq8V+Y9Vdc7ct6H7VI6/HdR lh3sT4GtjyW/uynwl2dG+z8NjBhxOdxsDLjGH7vlBRzbkqIC/aiZ8cS8QacTwEBIVLKeuq 6dJd6qmZYoTqSqrpfNKayaGdvBF0ivM= X-MC-Unique: f6-cQY60PWCYynQLnAN5FQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , berrange@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Stefan Weil Subject: [PULL 4/7] ui/gtk: fix cursor moved to left corner Date: Tue, 21 Mar 2023 13:03:31 +0400 Message-Id: <20230321090334.1841607-5-marcandre.lureau@redhat.com> In-Reply-To: <20230321090334.1841607-1-marcandre.lureau@redhat.com> References: <20230321090334.1841607-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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=-0.001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1679389491000100001 From: Marc-Andr=C3=A9 Lureau Do not attempt to move the pointer if the widget is not yet realized. The mouse cursor is placed to the corner of the screen, on X11 at least, as x_root and y_root are then miscalculated. (this is not reproducible on Wayland, because Gtk doesn't implement device warping there) This also fixes the following warning at start: qemu: Gdk: gdk_window_get_root_coords: assertion 'GDK_IS_WINDOW (window)' f= ailed Fixes: 6effaa16ac98 ("ui: set cursor position upon listener registration") Reported-by: Bernhard Beschow Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Tested-by: Bernhard Beschow Message-Id: <20230320132624.1612464-1-marcandre.lureau@redhat.com> --- ui/gtk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/gtk.c b/ui/gtk.c index fd82e9b1ca..e9564f2baa 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -450,7 +450,8 @@ static void gd_mouse_set(DisplayChangeListener *dcl, GdkDisplay *dpy; gint x_root, y_root; =20 - if (qemu_input_is_absolute()) { + if (!gtk_widget_get_realized(vc->gfx.drawing_area) || + qemu_input_is_absolute()) { return; } =20 --=20 2.39.2 From nobody Sat May 4 21:13:37 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1679389536; cv=none; d=zohomail.com; s=zohoarc; b=BFybEZG/1h367PBLZ/tT4I7q3RH2h8lARyVdOYSlgiCL+r0MrgezPw2bZr4hK18btWXZdUsY9SpOoLrhZaNpTma3dgS/UJfhAE3Y+gRXFY8IEjA1ba6Xks+Fz7EJqgSoNeQAXaTEBfLuMTL3kpY/JHoGr/p6wFvLp5goJUzb5FA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679389536; 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=AgK4wygSPELOpiFGSCtUt00Nxqa7d+Vmm2uKT2n8E1s=; b=N1i6Js1bRHQzKxYjvo5O734C1hMClE//mCRl8hfxR7lo4k/OVJraVeTx1Xvkdnl2OPQenIkYTBgzJ5lvJA+qbABCXyqZfghIK1ifgR/E3iBuzdQPUEuNzieLzzcnWRCdLwvSwyl5xfSXxgJZfcGqyXJna7pKhz4PnaRo1ZnWIl0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1679389536237572.3288706263232; Tue, 21 Mar 2023 02:05:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1peXuZ-0000OJ-8q; Tue, 21 Mar 2023 05:04:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peXuY-0000O2-0O for qemu-devel@nongnu.org; Tue, 21 Mar 2023 05:04:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peXuW-0001lM-E0 for qemu-devel@nongnu.org; Tue, 21 Mar 2023 05:04:05 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-658-dAlBC6XaNdWHab5CQcVjeg-1; Tue, 21 Mar 2023 05:03:59 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9D1F23810B0D; Tue, 21 Mar 2023 09:03:59 +0000 (UTC) Received: from localhost (unknown [10.39.208.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id D6C7640C94AC; Tue, 21 Mar 2023 09:03:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679389441; 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=AgK4wygSPELOpiFGSCtUt00Nxqa7d+Vmm2uKT2n8E1s=; b=Z4wZtXlFtdE58DPzBtu1Be1QhGSCzgaSQ3mQeGL/cSB6Ih2xnY6E62ButOqu1VWqmExGD9 J5G3heVP/Q4ljHC7Welpq9Et6n4XThrlEH2/EIXyK4UF5G3vSM9QIYqBsQhLJZTQI5nogf eoCPrEC2imfU+jj4il/eLOdfN0WSgR0= X-MC-Unique: dAlBC6XaNdWHab5CQcVjeg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , berrange@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Stefan Weil Subject: [PULL 5/7] ui: return the default console cursor when con == NULL Date: Tue, 21 Mar 2023 13:03:32 +0400 Message-Id: <20230321090334.1841607-6-marcandre.lureau@redhat.com> In-Reply-To: <20230321090334.1841607-1-marcandre.lureau@redhat.com> References: <20230321090334.1841607-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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=-0.001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1679389537595100001 From: Marc-Andr=C3=A9 Lureau VNC code relies on con=3D=3DNULL to mean the default console. Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1548 Fixes: commit 385ac97f8 ("ui: keep current cursor with QemuConsole") Signed-off-by: Marc-Andr=C3=A9 Lureau Reported-by: Helge Konetzka Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230319111017.1319880-1-marcandre.lureau@redhat.com> --- ui/console.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/console.c b/ui/console.c index f3783021e5..6e8a3cdc62 100644 --- a/ui/console.c +++ b/ui/console.c @@ -2303,6 +2303,9 @@ QemuConsole *qemu_console_lookup_unused(void) =20 QEMUCursor *qemu_console_get_cursor(QemuConsole *con) { + if (con =3D=3D NULL) { + con =3D active_console; + } return con->cursor; } =20 --=20 2.39.2 From nobody Sat May 4 21:13:37 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1679389472; cv=none; d=zohomail.com; s=zohoarc; b=oD7Vdcw4EQRFa2kDfWZ8bmpBUycAwh89vDh1O9rnhZnlfbMNJkZBDfyhD7CEHoIC1aEod9zKTzhi99R4ZUIGFTgRLzGPPiHP7v5tDvvbw2D1Cp+CuREUGhzvVcVikqQLmxTxb8FbPMgN4J+H92dFEtGeEh7/KPP2C24L3SkiDVE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679389472; 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=vH7zTPiaoGaq8Q2uwTCzLejD9bpRmFXSK20hMRwDRzc=; b=EralJw8gvWyNn5nc1/1eDPhGBvCseKP0vmRmg0uDtGw7MAhk1D4WP+tA83Y7d4I9Qpmc3j0SJuuWs7OlqKAkN+PzXJYIOHZu1b7A0NAtxBP1AFks6qvbj/VUH6cbqACY4tqi8ZAEnY1EggSqw3FgTuoewW/Mr7Db/SVZ+Q2c5mM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1679389472559978.5642434528802; Tue, 21 Mar 2023 02:04:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1peXug-0000Sk-IV; Tue, 21 Mar 2023 05:04:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peXuc-0000Q3-Tt for qemu-devel@nongnu.org; Tue, 21 Mar 2023 05:04:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peXub-0001m6-Er for qemu-devel@nongnu.org; Tue, 21 Mar 2023 05:04:10 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-581-QUJnkEp0OZCNKCmZSLToDw-1; Tue, 21 Mar 2023 05:04:05 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1B6EE185A7A2; Tue, 21 Mar 2023 09:04:05 +0000 (UTC) Received: from localhost (unknown [10.39.208.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id C3F0642C827; Tue, 21 Mar 2023 09:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679389448; 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=vH7zTPiaoGaq8Q2uwTCzLejD9bpRmFXSK20hMRwDRzc=; b=DrOUrdQFwUbrzfPWiOiQg3kJzwC1rkn+5G9pctJWAACo+FDbn+U0BgAAd8k9e3efdbf2pD h4omiyTfmaLi3QegY+7RB5j1pm2tbV1r+qSwo7qu8xNUpd44GCn/zogmF+wLG+qdmdTm1l +g3hLOqvNg+XrFkhHikdxxoKUXkYRsw= X-MC-Unique: QUJnkEp0OZCNKCmZSLToDw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , berrange@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Stefan Weil , Erico Nunes Subject: [PULL 6/7] ui/sdl2: remove workaround forcing x11 Date: Tue, 21 Mar 2023 13:03:33 +0400 Message-Id: <20230321090334.1841607-7-marcandre.lureau@redhat.com> In-Reply-To: <20230321090334.1841607-1-marcandre.lureau@redhat.com> References: <20230321090334.1841607-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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=-0.001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1679389473400100002 From: Erico Nunes This workaround was put in place in the original implementation almost 10 years ago, considering a very old SDL2 version. Currently it prevents users to run in a wayland-only environment without manually forcing the backend. The SDL2 wayland backend has been supported by distributions for a very long time (e.g. in Fedora, first available 8 years ago), and is now considered stable and becoming the default for new SDL2 releases. Instead of requiring the x11 backend to exist by default, let new qemu releases run with the default chosen by the installed SDL2 version. Signed-off-by: Erico Nunes Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230301141205.514338-1-ernunes@redhat.com> --- ui/sdl2.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/ui/sdl2.c b/ui/sdl2.c index 35c58c1104..b12dec4caf 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -843,22 +843,6 @@ static void sdl2_display_init(DisplayState *ds, Displa= yOptions *o) =20 assert(o->type =3D=3D DISPLAY_TYPE_SDL); =20 -#ifdef __linux__ - /* on Linux, SDL may use fbcon|directfb|svgalib when run without - * accessible $DISPLAY to open X11 window. This is often the case - * when qemu is run using sudo. But in this case, and when actually - * run in X11 environment, SDL fights with X11 for the video card, - * making current display unavailable, often until reboot. - * So make x11 the default SDL video driver if this variable is unset. - * This is a bit hackish but saves us from bigger problem. - * Maybe it's a good idea to fix this in SDL instead. - */ - if (!g_setenv("SDL_VIDEODRIVER", "x11", 0)) { - fprintf(stderr, "Could not set SDL_VIDEODRIVER environment variabl= e\n"); - exit(1); - } -#endif - if (SDL_GetHintBoolean("QEMU_ENABLE_SDL_LOGGING", SDL_FALSE)) { SDL_LogSetAllPriority(SDL_LOG_PRIORITY_VERBOSE); } --=20 2.39.2 From nobody Sat May 4 21:13:37 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1679389511; cv=none; d=zohomail.com; s=zohoarc; b=MOrNDbibxAz1Ge33Aw/+lbpzPSESkGblH663m4GLfx6MGF3Jt1qK4Pg+hxpCWaf+wv7T8NiMbaJJ+53/zNnmyv4z9HQwHfKtXr4+TZbxlnEJXyH1pOqRHkkQNVso6CkEgxUDVtmmLkImyGtknIgENjY/COxzKfbgzuiKfqasuyU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679389511; 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=16GmHz5aj2Onmq0mbYZx03TB3ayk3JUm+RQDOq+eVxc=; b=fN1RtlNEOHAbS1iu87C89Z0FVmo44lJsWPTJxmvYAlXkr2AiUOU1DBAXNE9m73o9gLat5Kf5+goDb+8ebgaZkZxifZkDsXWnzYU1L4pj0/FNtVk1YEMxAgvlbrbfrLS2HslX4CjAB9Z3q31bcFVagQubbAHol9rvvHhahprHcsM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1679389511566277.0002047292072; Tue, 21 Mar 2023 02:05:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1peXuu-0000XN-Kq; Tue, 21 Mar 2023 05:04:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peXuj-0000Tq-T6 for qemu-devel@nongnu.org; Tue, 21 Mar 2023 05:04:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peXui-0001mL-Ba for qemu-devel@nongnu.org; Tue, 21 Mar 2023 05:04:17 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-192-W4LPYSzIMcG8xPAdyFOZYw-1; Tue, 21 Mar 2023 05:04:09 -0400 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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 63F6B29A9D49; Tue, 21 Mar 2023 09:04:09 +0000 (UTC) Received: from localhost (unknown [10.39.208.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F6622027047; Tue, 21 Mar 2023 09:04:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679389453; 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=16GmHz5aj2Onmq0mbYZx03TB3ayk3JUm+RQDOq+eVxc=; b=AB6BAUA8KMcPkqnfssjdNKJyP4aH0y8AAMW+w7/CREYWUlgn5bMR/gaUQNKSCMi+Ypzsp1 PDhYipRUO+aOAuoGboCJb4iqfdZRgRGsUEHpLibu1RokVQeDLeV8acnLgmPhpIVyHuLGLJ wP22p/8yOq97brbPeKl65uqzC5JAk2w= X-MC-Unique: W4LPYSzIMcG8xPAdyFOZYw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , berrange@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Stefan Weil Subject: [PULL 7/7] ui: fix crash on serial reset, during init Date: Tue, 21 Mar 2023 13:03:34 +0400 Message-Id: <20230321090334.1841607-8-marcandre.lureau@redhat.com> In-Reply-To: <20230321090334.1841607-1-marcandre.lureau@redhat.com> References: <20230321090334.1841607-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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=-0.001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1679389513346100001 From: Marc-Andr=C3=A9 Lureau For ex, when resetting the xlnx-zcu102 machine: (lldb) bt * thread #1, queue =3D 'com.apple.main-thread', stop reason =3D EXC_BAD_ACCESS (code=3D1, address=3D0x50) * frame #0: 0x10020a740 gd_vc_send_chars(vc=3D0x000000000) at gtk.c:1759:41 [opt] frame #1: 0x100636264 qemu_chr_fe_accept_input(be=3D) at char-fe.c:159:9 [opt] frame #2: 0x1000608e0 cadence_uart_reset_hold [inlined] uart_rx_reset(s=3D0x10810a960) at cadence_uart.c:158:5 [opt] frame #3: 0x1000608d4 cadence_uart_reset_hold(obj=3D0x10810a960) at cadence_uart.c:530:5 [opt] frame #4: 0x100580ab4 resettable_phase_hold(obj=3D0x10810a960, opaque=3D0x000000000, type=3D) at resettable.c:0 [opt] frame #5: 0x10057d1b0 bus_reset_child_foreach(obj=3D, cb=3D(resettable_phase_hold at resettable.c:162), opaque=3D0x000000000, type=3DRESET_TYPE_COLD) at bus.c:97:13 [opt] frame #6: 0x1005809f8 resettable_phase_hold [inlined] resettable_child_foreach(rc=3D0x000060000332d2c0, obj=3D0x0000600002c1c180, cb=3D, opaque=3D0x000000000, type=3DRESET_TYPE_COLD) at resettable.c:96:9 [opt] frame #7: 0x1005809d8 resettable_phase_hold(obj=3D0x0000600002c1c180, opaque=3D0x000000000, type=3DRESET_TYPE_COLD) at resettable.c:173:5 [opt] frame #8: 0x1005803a0 resettable_assert_reset(obj=3D0x0000600002c1c180, type=3D) at resettable.c:60:5 [opt] frame #9: 0x10058027c resettable_reset(obj=3D0x0000600002c1c180, type=3DRESET_TYPE_COLD) at resettable.c:45:5 [opt] While the chardev is created early, the VirtualConsole is associated after, during qemu_init_displays(). Signed-off-by: Marc-Andr=C3=A9 Lureau Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230220072251.3385878-1-marcandre.lureau@redhat.com> --- ui/gtk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/gtk.c b/ui/gtk.c index e9564f2baa..f16e0f8dee 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1784,7 +1784,9 @@ static void gd_vc_chr_accept_input(Chardev *chr) VCChardev *vcd =3D VC_CHARDEV(chr); VirtualConsole *vc =3D vcd->console; =20 - gd_vc_send_chars(vc); + if (vc) { + gd_vc_send_chars(vc); + } } =20 static void gd_vc_chr_set_echo(Chardev *chr, bool echo) --=20 2.39.2