From nobody Tue Feb 10 17:53:06 2026 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1691186527; cv=none; d=zohomail.com; s=zohoarc; b=QsMtz2Z21a4Q37Pts8SGObApX39KfsYDP4wcz28A0a64Kn3CqSzg0ZYUQLAMDH7eByvPKWBmk39R67rwj901afTMSAlbKgaTqxfCh5fA49a1/TkFLzCNvCZSao3ppcPpNBGB5eER737MYuzf/rDYci3zB7oVyiyzosItSwJ+Z4w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691186527; h=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=PGTKa1g9aGwPuG4tk4crlE1qhIW/f2V62gcPYilpvuU=; b=ejDj3Ba5WZfE13swkRj/mry38vKYYw5JObtXBnOmnsPXF5SojeheYEU51T0JDYaG/W2YyXd/+M/RvfgWTXaLJGP+sllLjeoSfqyG0bCQZqdmosMtpjloUq8bd+dv86qlhrtvS8FCAGQ8gN4KdLekhOsUmNVpi4DXm5z/3VXUMos= 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+importer=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 1691186527277362.84667891056654; Fri, 4 Aug 2023 15:02:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qS2qx-0004mf-8W; Fri, 04 Aug 2023 18:00:59 -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 1qS2qi-0004X5-HX for qemu-devel@nongnu.org; Fri, 04 Aug 2023 18:00:46 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qS2qe-0001hv-9F for qemu-devel@nongnu.org; Fri, 04 Aug 2023 18:00:43 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6874d1c8610so1992198b3a.0 for ; Fri, 04 Aug 2023 15:00:38 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:1eed:f77f:f320:8b14]) by smtp.gmail.com with ESMTPSA id u1-20020a17090282c100b001bbf7fd354csm2185568plz.213.2023.08.04.15.00.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 15:00:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691186437; x=1691791237; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PGTKa1g9aGwPuG4tk4crlE1qhIW/f2V62gcPYilpvuU=; b=s9cAvl0v4H4zwkHp1GZ77ZUqutqZYy1YF9LPPySv8NJK1+jttVkJxaKyoWghoOrhE5 N45bFSSOu3VJ4goYkIdbm/T3D/lasAS4AwZ+YBXzoBLbV9/9RpGGsQTAeu64H65VOGrk 5B1+ZlEpelpnHdmObccylzhTtu9d7RpNxGsHcazfbxR4Q5vpXjF+yd7aK5GyuqyAWGbT XgfWAK16jY06hwp8CO/r6bHlaV4ZokQpSVyT9f4hGV4lu1fZEn49hqa4+2LRSSlkQfM/ lopJvU3opo2NWuw8cVB/LgA22PdtDjqmg5ikr5TW9ftHMLrmC94sVCTF/MTV9FSGZgUh TeEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691186437; x=1691791237; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PGTKa1g9aGwPuG4tk4crlE1qhIW/f2V62gcPYilpvuU=; b=S4PsaJ9T0q01esMDTOaUjajFfvc7RxYRdB33MUUosep0Crnz+LCh2GGclTTZG5HEES proDXhivkkDIFa6yEf+zHSCvIJDfmsvzDo/gc0lPusA26NYTLlFBRatYhDUoIEH5vddc ONQGp6EwSustdn7VM8ZW2DD3EcZ/F3rp0OEnEoD9Mt/Gf6aJmy8hOzItIbegcMY50VM5 h+BJznyhnWY/Q/7ZbEedWjskEvn28ysV8duCLL2yIga6zUa7ufeIAHUU8RX2k6S8w59H wdlxGgbjpHovGG8RM0H2Pf7m551xlysnunwcdWmweGwLxMvECAnaGgiz9/Z0axYBbfig HpnA== X-Gm-Message-State: AOJu0YwCbJc67VSO++Hlum653H5KOXfpl8JPPT6OBf+b6hiCgsyoV4+B ICXUlFsNZFgdVrzqLHH++bd8SQ2EO0r3Qq/9xj0= X-Google-Smtp-Source: AGHT+IGybyUU1dJU0XPYU0BYXNuf1Sl9Qc2NvYjRHbge/8qmYWCuS8uEl7wSJ9JSbyTsIrQ0Qu+3xQ== X-Received: by 2002:a05:6a21:3b49:b0:140:2805:6cc8 with SMTP id zy9-20020a056a213b4900b0014028056cc8mr1277625pzb.27.1691186437430; Fri, 04 Aug 2023 15:00:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Matheus Tavares Bernardino , Ilya Leoshkevich Subject: [PATCH v9 04/24] gdbstub: use 0 ("any process") on packets with no PID Date: Fri, 4 Aug 2023 15:00:12 -0700 Message-Id: <20230804220032.295411-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230804220032.295411-1-richard.henderson@linaro.org> References: <20230804220032.295411-1-richard.henderson@linaro.org> 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 client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1691186527678100001 Content-Type: text/plain; charset="utf-8" From: Matheus Tavares Bernardino Previously, qemu-user would always report PID 1 to GDB. This was changed at dc14a7a6e9 (gdbstub: Report the actual qemu-user pid, 2023-06-30), but read_thread_id() still considers GDB packets with "no PID" as "PID 1", which is not the qemu-user PID. Fix that by parsing "no PID" as "0", which the GDB Remote Protocol defines as "any process". Note that this should have no effect for system emulation as, in this case, gdb_create_default_process() will assign PID 1 for the first process and that is what the gdbstub uses for GDB requests with no PID, or PID 0. This issue was found with hexagon-lldb, which sends a "Hg" packet with only the thread-id, but no process-id, leading to the invalid usage of "PID 1" by qemu-hexagon and a subsequent "E22" reply. Signed-off-by: Matheus Tavares Bernardino Acked-by: Ilya Leoshkevich Message-Id: <78a3b06f6ab90a7ff8e73ae14a996eb27ec76c85.1690904195.git.quic_m= athbern@quicinc.com> Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson --- gdbstub/gdbstub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index ce8b42eb15..e74ecc78cc 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -537,7 +537,7 @@ static GDBThreadIdKind read_thread_id(const char *buf, = const char **end_buf, /* Skip '.' */ buf++; } else { - p =3D 1; + p =3D 0; } =20 ret =3D qemu_strtoul(buf, &buf, 16, &t); --=20 2.34.1