From nobody Tue Feb 10 21:59:34 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 176891274749857.29485144092803; Tue, 20 Jan 2026 04:39:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1viB04-0002bV-3B; Tue, 20 Jan 2026 07:38:24 -0500 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 1viAz6-0001ai-DI; Tue, 20 Jan 2026 07:37:30 -0500 Received: from isrv.corpit.ru ([212.248.84.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1viAz1-0002Xn-5q; Tue, 20 Jan 2026 07:37:24 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 99C281802C0; Tue, 20 Jan 2026 15:21:33 +0300 (MSK) Received: from think4mjt.tls.msk.ru (mjtthink.wg.tls.msk.ru [192.168.177.146]) by tsrv.corpit.ru (Postfix) with ESMTP id 209D1351749; Tue, 20 Jan 2026 15:21:51 +0300 (MSK) From: Michael Tokarev To: qemu-devel@nongnu.org Cc: Michael Tokarev , qemu-trivial@nongnu.org Subject: [PULL 1/9] Revert "gdbstub: Try unlinking the unix socket before binding" Date: Tue, 20 Jan 2026 15:21:38 +0300 Message-ID: <20260120122150.2254321-2-mjt@tls.msk.ru> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260120122150.2254321-1-mjt@tls.msk.ru> References: <20260120122150.2254321-1-mjt@tls.msk.ru> MIME-Version: 1.0 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 (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=212.248.84.144; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1768912750877158500 Content-Type: text/plain; charset="utf-8" This reverts commit fccb744f41c69fec6fd92225fe907c6e69de5d44. This commit introduced dependency of linux-user on qemu-sockets.c. The latter includes handling of various socket types, while gdbstub only needs unix sockets. Including different kinds of sockets makes it more problematic to build linux-user statically. The original issue - the need to unlink unix socket before binding - will be addressed in the next change. Reviewed-by: Ilya Leoshkevich Signed-off-by: Michael Tokarev --- gdbstub/user.c | 29 ++++++++++++++++++++++++++--- stubs/meson.build | 2 -- util/meson.build | 2 -- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/gdbstub/user.c b/gdbstub/user.c index e233c59816..5e920a9b51 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -314,10 +314,12 @@ static bool gdb_accept_socket(int gdb_fd) return true; } =20 -static int gdbserver_open_socket(const char *path, Error **errp) +static int gdbserver_open_socket(const char *path) { g_autoptr(GString) buf =3D g_string_new(""); + struct sockaddr_un sockaddr =3D {}; const char *pid_placeholder; + int fd, ret; =20 pid_placeholder =3D strstr(path, "%d"); if (pid_placeholder !=3D NULL) { @@ -327,7 +329,28 @@ static int gdbserver_open_socket(const char *path, Err= or **errp) path =3D buf->str; } =20 - return unix_listen(path, errp); + fd =3D socket(AF_UNIX, SOCK_STREAM, 0); + if (fd < 0) { + perror("create socket"); + return -1; + } + + sockaddr.sun_family =3D AF_UNIX; + pstrcpy(sockaddr.sun_path, sizeof(sockaddr.sun_path) - 1, path); + ret =3D bind(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)); + if (ret < 0) { + perror("bind socket"); + close(fd); + return -1; + } + ret =3D listen(fd, 1); + if (ret < 0) { + perror("listen socket"); + close(fd); + return -1; + } + + return fd; } =20 static bool gdb_accept_tcp(int gdb_fd) @@ -483,7 +506,7 @@ bool gdbserver_start(const char *args, Error **errp) if (port > 0) { gdb_fd =3D gdbserver_open_port(port, errp); } else { - gdb_fd =3D gdbserver_open_socket(port_or_path, errp); + gdb_fd =3D gdbserver_open_socket(port_or_path); } if (gdb_fd < 0) { return false; diff --git a/stubs/meson.build b/stubs/meson.build index d3b551f4de..2b5fd8a88a 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -61,8 +61,6 @@ if have_user if not have_system stub_ss.add(files('qdev.c')) endif - - stub_ss.add(files('monitor-internal.c')) endif =20 if have_system diff --git a/util/meson.build b/util/meson.build index 59e835a8d3..a0cfdc30ba 100644 --- a/util/meson.build +++ b/util/meson.build @@ -83,8 +83,6 @@ if have_block or have_ga util_ss.add(files('qemu-coroutine.c', 'qemu-coroutine-lock.c', 'qemu-cor= outine-io.c')) util_ss.add(files(f'coroutine-@coroutine_backend@.c')) util_ss.add(files('thread-pool.c', 'qemu-timer.c')) -endif -if have_block or have_ga or have_user util_ss.add(files('qemu-sockets.c')) endif if have_block --=20 2.47.3