From nobody Wed Feb 11 06:03:53 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=1691690975; cv=none; d=zohomail.com; s=zohoarc; b=oH4pdoN0nbtNWVpDoATibgtdUW6TWzZnRmbn11VhNRDRRZkM9FZURsUgilPgtwBpxP+I7I2udmYzCfLITlnwcxeB/hdyJdrpmM7lIMNCBrOx4mjl/e5txmHAYfNwdXUC8HO782EZzUN5YGeMhqfYnO1k3/M5TErF5VFLKxGzXYs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691690975; 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=OWzlEvnCZbe3wAuEoxcRs6D4p7xFPp7msfwWBLYlOkc=; b=ARo+KzVXXYlIIK5/r/QeJjgkqvHs/m+QDPWKNIiPEWU+hOm/ezzMWJKJfCz4ImkU+zJPqsyAYz5ddngv2dFyAi17uPXCa4hErJFWLyT5YSZtIBH8dQSKrbZd8UiFMpGaYkWmCYsi0rLkXVJqT2ZrIeBpj1xo9JnnNvmObd/Dbok= 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 1691690975364410.4730033893193; Thu, 10 Aug 2023 11:09:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qUA6A-00021K-93; Thu, 10 Aug 2023 14:09:26 -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 1qUA5q-0001xj-6C for qemu-devel@nongnu.org; Thu, 10 Aug 2023 14:09:08 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qUA5m-0001y2-DX for qemu-devel@nongnu.org; Thu, 10 Aug 2023 14:09:05 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1bc0d39b52cso8858435ad.2 for ; Thu, 10 Aug 2023 11:08:56 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:9e4d:b830:d4fd:9164]) by smtp.gmail.com with ESMTPSA id b14-20020a170902b60e00b001bd41b70b65sm2085212pls.49.2023.08.10.11.08.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 11:08:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691690935; x=1692295735; 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=OWzlEvnCZbe3wAuEoxcRs6D4p7xFPp7msfwWBLYlOkc=; b=v8KrTjxpBNjVL9pVvfo4PG2aZisELRBVKAsfI2iaRxjXhGFkHAcJZEjNE7pNBdyBYM xZwYC3hCfCkeP/MXTWhOl05Fv7b7VUB6WkRgdVH5tEHKj2eym7TFnMkH5h92CIhxNsoR LlZkBNC5s3MIEebKWbghZOD6sH7find+OFFyRUAt8tho/j2s1LHSzB+kDO5X0c0iQIDI GZmH4GMTqpBrUlS/6/ZIzfQU974VvTRPQUAG1BjsOzR0o94IgaZkWe1KokXeyiHSRpJb qN9nEu8cMDQdSqDXIEidUoRDNhNIWsBWuxQ2qz1dIfwCQz8pskQQorsohu2R7B6Lai5Z vzJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691690935; x=1692295735; 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=OWzlEvnCZbe3wAuEoxcRs6D4p7xFPp7msfwWBLYlOkc=; b=NDK+v1iQxGa8RVQdI8zB8yLLRts9/pWZV6+rv1pL3pTBK8nvY7BKt+/TlAF7i8lM+c muDIu29X1qNJHA8Mlcxq85RyLLSqMifmkLufEVEPPfnZCOYi8xtSzqKgRch9qszTAF2O OQWbVn6j80gP9oE8r+XJoU1YYLqbfKRCzik4d7fmA6Cj8tgMPN24jeR6lzv1MyeQX1LM MphsdCDnuxhDhaZYqCFU2/N4iKZJY5qf6xXzTKeWpbolHlYjT19zr9yo7cwk6dLij8mx n3A6uj1mY33K6wBT5IwT0uguIcnZm4O1cE+Jhs46GUCQRsjvxKoTMg6namXzmHZGhv7g v0sw== X-Gm-Message-State: AOJu0YybOejhQ0pR7NbZ44RyAgifwpl8goSkLfosNHCuluAHGNlwKODf WPX0Cm4N/7ngA0T65y0OzysCg12EKTsI0oycTeE= X-Google-Smtp-Source: AGHT+IHtp41GHigQIZhOqy9VMSLKLp98sql5MYEGLWIjQIyBx0EMoQ0Te6DLmc75HWh3pKKjKTQOXQ== X-Received: by 2002:a17:903:44c:b0:1bc:6e8c:eef9 with SMTP id iw12-20020a170903044c00b001bc6e8ceef9mr2112331plb.51.1691690935568; Thu, 10 Aug 2023 11:08:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 1/4] accel/tcg: Avoid reading too much in load_atom_{2,4} Date: Thu, 10 Aug 2023 11:08:49 -0700 Message-Id: <20230810180852.54477-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230810180852.54477-1-richard.henderson@linaro.org> References: <20230810180852.54477-1-richard.henderson@linaro.org> MIME-Version: 1.0 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=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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: 1691690977087100005 When load_atom_extract_al16_or_al8 is inexpensive, we want to use it early, in order to avoid the overhead of required_atomicity. However, we must not read past the end of the page. If there are more than 8 bytes remaining, then both the "aligned 16" and "aligned 8" paths align down so that the read has at least 16 bytes remaining on the page. Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- tests/tcg/aarch64/lse2-fault.c | 38 +++++++++++++++++++++++++++++++ accel/tcg/ldst_atomicity.c.inc | 10 ++++++-- tests/tcg/aarch64/Makefile.target | 2 +- 3 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 tests/tcg/aarch64/lse2-fault.c diff --git a/tests/tcg/aarch64/lse2-fault.c b/tests/tcg/aarch64/lse2-fault.c new file mode 100644 index 0000000000..2187219a08 --- /dev/null +++ b/tests/tcg/aarch64/lse2-fault.c @@ -0,0 +1,38 @@ +#include +#include +#include +#include + +int main() +{ + int psize =3D getpagesize(); + int id; + void *p; + + /* + * We need a shared mapping to enter CF_PARALLEL mode. + * The easiest way to get that is shmat. + */ + id =3D shmget(IPC_PRIVATE, 2 * psize, IPC_CREAT | 0600); + if (id < 0) { + perror("shmget"); + return 2; + } + p =3D shmat(id, NULL, 0); + if (p =3D=3D MAP_FAILED) { + perror("shmat"); + return 2; + } + + /* Protect the second page. */ + if (mprotect(p + psize, psize, PROT_NONE) < 0) { + perror("mprotect"); + return 2; + } + + /* + * Load 4 bytes, 6 bytes from the end of the page. + * On success this will load 0 from the newly allocated shm. + */ + return *(int *)(p + psize - 6); +} diff --git a/accel/tcg/ldst_atomicity.c.inc b/accel/tcg/ldst_atomicity.c.inc index e5c590a499..1b793e6935 100644 --- a/accel/tcg/ldst_atomicity.c.inc +++ b/accel/tcg/ldst_atomicity.c.inc @@ -404,7 +404,10 @@ static uint16_t load_atom_2(CPUArchState *env, uintptr= _t ra, return load_atomic2(pv); } if (HAVE_ATOMIC128_RO) { - return load_atom_extract_al16_or_al8(pv, 2); + intptr_t left_in_page =3D -(pi | TARGET_PAGE_MASK); + if (likely(left_in_page > 8)) { + return load_atom_extract_al16_or_al8(pv, 2); + } } =20 atmax =3D required_atomicity(env, pi, memop); @@ -443,7 +446,10 @@ static uint32_t load_atom_4(CPUArchState *env, uintptr= _t ra, return load_atomic4(pv); } if (HAVE_ATOMIC128_RO) { - return load_atom_extract_al16_or_al8(pv, 4); + intptr_t left_in_page =3D -(pi | TARGET_PAGE_MASK); + if (likely(left_in_page > 8)) { + return load_atom_extract_al16_or_al8(pv, 4); + } } =20 atmax =3D required_atomicity(env, pi, memop); diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile= .target index 617f821613..681dfa077c 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -9,7 +9,7 @@ AARCH64_SRC=3D$(SRC_PATH)/tests/tcg/aarch64 VPATH +=3D $(AARCH64_SRC) =20 # Base architecture tests -AARCH64_TESTS=3Dfcvt pcalign-a64 +AARCH64_TESTS=3Dfcvt pcalign-a64 lse2-fault =20 fcvt: LDFLAGS+=3D-lm =20 --=20 2.34.1 From nobody Wed Feb 11 06:03:53 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=1691690992; cv=none; d=zohomail.com; s=zohoarc; b=HY4BjAawPnvwHaQOrJ88lWLNfgiC2LLVNCPDh4D6GotPh4aLmIByuFmOdlEbSoHN/0sBwSbJbLCDmC5aqprZJeKZQghDeiWzlR/f1ZS2mjrWSJ8J37Grff+xpUgiNw/CUDmNR9waLNUS1MlsntyCALt6AY+/Jv/bkPOhadhjVGY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691690992; 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=fo39w1Ncf4bpUzNN7kkWxqgkT7EH9KrCL5R8N2HXRgE=; b=WSrCL4WhYjmEsEXxZbVvuAbBspe3pUY87w5fIZtGvTgI00WqyK6Mzs689F/WvGfwCeCvoEs2ozTzgaGuKCGS9U70BYJ8kVrOt7gZMYvnwSHHCeq6bG2PoRo+7A0v/y/UkqXgFLe+XpbPs4lYUJ/vnsmyduM4gT0fTVZVQsiKNvs= 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 1691690992426950.2785167176945; Thu, 10 Aug 2023 11:09:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qUA6A-000242-94; Thu, 10 Aug 2023 14:09:26 -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 1qUA5s-0001yc-DB for qemu-devel@nongnu.org; Thu, 10 Aug 2023 14:09:10 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qUA5m-0001y7-Di for qemu-devel@nongnu.org; Thu, 10 Aug 2023 14:09:06 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1bc0d39b52cso8858485ad.2 for ; Thu, 10 Aug 2023 11:08:57 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:9e4d:b830:d4fd:9164]) by smtp.gmail.com with ESMTPSA id b14-20020a170902b60e00b001bd41b70b65sm2085212pls.49.2023.08.10.11.08.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 11:08:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691690936; x=1692295736; 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=fo39w1Ncf4bpUzNN7kkWxqgkT7EH9KrCL5R8N2HXRgE=; b=De5lx/fQBqDRIGzs7BXZmBUhFKVgkX4zg/MSoiNOzZjflBt9LZGUPKMhMHHsiac0/l sEZAVZFc6FAQC5M0cJFXdurVAhelCFyRXo+yXexiFVj7/ynaNsdiftJg+AMOC0ZAqe+R HpH36TkUaUSB47DBkPlsxg8DqmTmj4J7VWUZXXF2wbRh0xzEXPavNErGyuQj3ZbePFdG 0/mAeoa+UiimoC/35cM3AmT67x8OqlfaoArVkIV9WiJEvdYCUeuoOsMi7Ny9v91OnXwf ZgjOpxbgjvlgxIRhhIIdOdPI0/MKP2DuvUYNnFVMLq1Mv7rG7k5wIoI1ciDG6w0L2RTT HHhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691690936; x=1692295736; 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=fo39w1Ncf4bpUzNN7kkWxqgkT7EH9KrCL5R8N2HXRgE=; b=mHaU13qctogNUzhtDqjqg2DaVy9ioXRM2HUADjSeWLF/SGZBtfoljEX7ZLpzil0Vwc oe1Q6tHtlPSNKB21mvBW95A/CedNlx2zGp5Aq+WpW0Ivc5qiFBToQw14XaFSwLvPzdia 1DOMFuqCol7fvdGe3Kv2VOIqNtdk5+NR7pIBckLPmt4aGWQcvLZlcOCrq99/sxRetw9o yD9lg+enZHKEXJfzoL4mcTddJObto4dTDLvA5L9UlD4f6mhLfZ7aZVx7xK66yVJLU2W6 TWwrVk+cpnfspAiyPw4j0KXrd+UjrkmyjfmWPV4SCfnGkjSAsMexSEGBTUrfGgxE4f4/ oAVw== X-Gm-Message-State: AOJu0Yw7v6+cpQEfq2nNmtu8DGTa26ELkwJB1MlxsUl/mexYBra7Bzzr 6W9Dkrqk7UOK3pAE1hjXCM5CyEhUkjMqgSdFPB4= X-Google-Smtp-Source: AGHT+IG59eB5ANwqx/NMqJf9yYBM4UPXeX7YrR4K+6rzEP9HezqTCzcytbsWOBQ62Mz/lqAl1eZUVQ== X-Received: by 2002:a17:903:234e:b0:1bc:8c6c:217d with SMTP id c14-20020a170903234e00b001bc8c6c217dmr3234350plh.61.1691690936363; Thu, 10 Aug 2023 11:08:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 2/4] tests/tcg: ensure system-mode gdb tests start stopped Date: Thu, 10 Aug 2023 11:08:50 -0700 Message-Id: <20230810180852.54477-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230810180852.54477-1-richard.henderson@linaro.org> References: <20230810180852.54477-1-richard.henderson@linaro.org> MIME-Version: 1.0 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=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.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: 1691690993258100002 From: Alex Benn=C3=A9e Without -S we run into potential races with tests starting before the gdbstub attaches. We don't need to worry about user-mode as enabling the gdbstub implies we wait for the initial connection. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230810153640.1879717-7-alex.bennee@linaro.org> Signed-off-by: Richard Henderson --- tests/guest-debug/run-test.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/guest-debug/run-test.py b/tests/guest-debug/run-test.py index de6106a5e5..a032e01f79 100755 --- a/tests/guest-debug/run-test.py +++ b/tests/guest-debug/run-test.py @@ -69,13 +69,10 @@ def log(output, msg): =20 # Launch QEMU with binary if "system" in args.qemu: - cmd =3D "%s %s %s -gdb unix:path=3D%s,server=3Don" % (args.qemu, - args.qargs, - args.binary, - socket_name) + cmd =3D f'{args.qemu} {args.qargs} {args.binary}' \ + f' -S -gdb unix:path=3D{socket_name},server=3Don' else: - cmd =3D "%s %s -g %s %s" % (args.qemu, args.qargs, socket_name, - args.binary) + cmd =3D f'{args.qemu} {args.qargs} -g {socket_name} {args.binary}' =20 log(output, "QEMU CMD: %s" % (cmd)) inferior =3D subprocess.Popen(shlex.split(cmd)) --=20 2.34.1 From nobody Wed Feb 11 06:03:53 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=1691691004; cv=none; d=zohomail.com; s=zohoarc; b=Ug6DO5bpCFDnEVeRoVLLCsfXZu1K1B+iIl7S39tDCj1Nqk12kblnqwnI5c88/x0nHKqlJ1z0WwEUD7Z0kZETRzLvwsxvsreX6P9f8/K8yRR7Ssi5gQYAFkpRfB4ENsb10izVTlZQ/3v3UdhoS/XI28Icw+Kth4t4UJ+Y7PmG0Z0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691691004; 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=ZN+1yYSBIrLJScTtAThKTp6Rq6Vl+u2vg/TEhX0ETmw=; b=dWFBgSPe3JSDkjaNTv7847697EhvrJnLpSbsuq6e4e6F+sV9UbIKDrg8CqJiHqRXlu3G36nPl3KFL9TscusQKhWzvvjmey9fqHEvVkYIaH8aIurgaloxXziviaffQ0BX5zhi9Pm65t/ModbawuFxjDzhB//9ffh8taq7y/IeaIM= 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 169169100479142.48823847421215; Thu, 10 Aug 2023 11:10:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qUA6A-00021Y-8p; Thu, 10 Aug 2023 14:09:26 -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 1qUA5q-0001xh-62 for qemu-devel@nongnu.org; Thu, 10 Aug 2023 14:09:07 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qUA5m-0001yG-Dx for qemu-devel@nongnu.org; Thu, 10 Aug 2023 14:09:05 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1bc0d39b52cso8858595ad.2 for ; Thu, 10 Aug 2023 11:08:58 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:9e4d:b830:d4fd:9164]) by smtp.gmail.com with ESMTPSA id b14-20020a170902b60e00b001bd41b70b65sm2085212pls.49.2023.08.10.11.08.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 11:08:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691690937; x=1692295737; 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=ZN+1yYSBIrLJScTtAThKTp6Rq6Vl+u2vg/TEhX0ETmw=; b=uyUazPTwX+ezXYgxtT14sMXI1T3E0DmaYURCuQNjnLKkbsnOXNw+VQtuhzqFqsZ/kU XKynZ9YAX4w4ArelbeOZOhrpfWgpNOiWtgm327pnXgn5+E82AXq788s8z9BqERKZTpxf UGhRnwkQulqdRcb2vL/EG5h9ArKIKdT2ysSwpVCB0SQzSm2EqFCKhMdqYfx/HhQd+eJe br/4NetyfZdtQTLGWG/vqQYiPsN4dyBDkZ2+5pdKcXchoPCxww0Qo/QJ6IaAxKETgMpd lmM4l47gN1mYA4fBU0Bh8qh1b0p51+IeUazo6HLsTqS9GFuVDo9BRCalv5AswzjiXnmj Ly+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691690937; x=1692295737; 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=ZN+1yYSBIrLJScTtAThKTp6Rq6Vl+u2vg/TEhX0ETmw=; b=dwxkBpbwvxSyjPVUGsOnoSmHOGFqVkfKZA9ZeNRXHCESerpLRaQyfhiNxLPwvV4O4Q OuQHy83nE0S8McGJUIIs1DSe8y824MUcs28IfpcES+Qj2sjehxo67Q/8gePwwaw1PWu2 Zmg6HQq9hCS+HSlcgoSbhiZZGrmEGsAY9w5bkrQMs+zRoCnLGT3a33Bn3KXwq3jp3fNb VUPlPge6Ao3MzhclNd24C1LM5W+xlMdQzw6DffZm+Na/L7e17ek1Ff9y5KgLswOn1gFj VoVegp1USK8AmeOMoDnQhpnGJpMTEnynhZteFi8zRjCN3UXFqc4aHwQQycgXJnPfuGKV vtvg== X-Gm-Message-State: AOJu0YxfAU/+GQ3I+XUgIIN+6TuufxtOJBPbczX9M54u7sCc6RWOY7Fc 2yzXB0fRxUiKEisbCiPRqOi2vLC/FmxcuhZBXcA= X-Google-Smtp-Source: AGHT+IEBi9hGODKRD1WQJuHg2C5nMML/zcOT6mMUJJXA25kZiD5+B1cVFBVP5R53hggI33jSYSwKug== X-Received: by 2002:a17:903:26d2:b0:1b8:6e2e:78cd with SMTP id jg18-20020a17090326d200b001b86e2e78cdmr2774317plb.40.1691690937362; Thu, 10 Aug 2023 11:08:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Matheus Tavares Bernardino , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 3/4] gdbstub: more fixes for client Ctrl-C handling Date: Thu, 10 Aug 2023 11:08:51 -0700 Message-Id: <20230810180852.54477-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230810180852.54477-1-richard.henderson@linaro.org> References: <20230810180852.54477-1-richard.henderson@linaro.org> MIME-Version: 1.0 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=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.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: 1691691006742100001 From: Alex Benn=C3=A9e The original fix caused problems with spurious characters on other system emulation. So: - instead of spamming output make the warning a trace point - ensure we only allow a stop reply if it was 0x3 Suggested-by: Matheus Tavares Bernardino Signed-off-by: Alex Benn=C3=A9e Message-Id: <456ed3318421dd7946bdfb5ceda7e05332da368c.1690910333.git.quic_m= athbern@quicinc.com> Reviewed-by: Richard Henderson Tested-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230810153640.1879717-8-alex.bennee@linaro.org> Signed-off-by: Richard Henderson --- gdbstub/gdbstub.c | 5 +++-- gdbstub/trace-events | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index e74ecc78cc..20b6fe03fb 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -2059,9 +2059,10 @@ void gdb_read_byte(uint8_t ch) * here, but it does expect a stop reply. */ if (ch !=3D 0x03) { - warn_report("gdbstub: client sent packet while target running\= n"); + trace_gdbstub_err_unexpected_runpkt(ch); + } else { + gdbserver_state.allow_stop_reply =3D true; } - gdbserver_state.allow_stop_reply =3D true; vm_stop(RUN_STATE_PAUSED); } else #endif diff --git a/gdbstub/trace-events b/gdbstub/trace-events index 0c18a4d70a..7bc79a73c4 100644 --- a/gdbstub/trace-events +++ b/gdbstub/trace-events @@ -26,6 +26,7 @@ gdbstub_err_invalid_repeat(uint8_t ch) "got invalid RLE c= ount: 0x%02x" gdbstub_err_invalid_rle(void) "got invalid RLE sequence" gdbstub_err_checksum_invalid(uint8_t ch) "got invalid command checksum dig= it: 0x%02x" gdbstub_err_checksum_incorrect(uint8_t expected, uint8_t got) "got command= packet with incorrect checksum, expected=3D0x%02x, received=3D0x%02x" +gdbstub_err_unexpected_runpkt(uint8_t ch) "unexpected packet (0x%02x) whil= e target running" =20 # softmmu.c gdbstub_hit_watchpoint(const char *type, int cpu_gdb_index, uint64_t vaddr= ) "Watchpoint hit, type=3D\"%s\" cpu=3D%d, vaddr=3D0x%" PRIx64 "" --=20 2.34.1 From nobody Wed Feb 11 06:03:53 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=1691690995; cv=none; d=zohomail.com; s=zohoarc; b=ZC1b82ire6/ccSpW7oos+8EB0Swjw8tiNkQZnbKzhfW5yDhHxXnGjbmQiHUhVms8n+4VSZgu/ok4u2ZO21cyHGftbpNoCwJvtxxpzQsecRyXMht9QNCwsUhmkFndKXNzwyqheaCtDsOmOyenm+WT5YqJABtOOqBLPj85kBuN1ZM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691690995; 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=iU+C7JV6FbRgzBVC3R2lwvlAYCK7PTnMEPRpbCh3lQ4=; b=B+GibnQQYTUibOFnURDLrTq3DLeVp+PqHI6apiuPXYu+c+SKoDxzw4My3t/v2veJIO/dRYbJnXdyPSCTI7JyTn24UET/xnGqyZfESJtZktq6LbnTNTqbOAVBcVOYZP0wl57SLyDE9VCRLpKjhvCgLARFFKAlpEJfrr/SoqbuEwE= 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 1691690995123636.1277085229606; Thu, 10 Aug 2023 11:09:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qUA6I-00027b-5R; Thu, 10 Aug 2023 14:09:34 -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 1qUA5s-0001yb-CN for qemu-devel@nongnu.org; Thu, 10 Aug 2023 14:09:10 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qUA5m-0001yM-E6 for qemu-devel@nongnu.org; Thu, 10 Aug 2023 14:09:06 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1b9c5e07c1bso10702985ad.2 for ; Thu, 10 Aug 2023 11:08:59 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:9e4d:b830:d4fd:9164]) by smtp.gmail.com with ESMTPSA id b14-20020a170902b60e00b001bd41b70b65sm2085212pls.49.2023.08.10.11.08.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 11:08:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691690938; x=1692295738; 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=iU+C7JV6FbRgzBVC3R2lwvlAYCK7PTnMEPRpbCh3lQ4=; b=u4xReyEiduAa4QPqqP4aQsYdKCZivVj0uaVEqP0oyPLjnVa8DiZ8D5d2MGwoN2gAd5 GBZt/t6yOI+Htsj/gKii8+DYYD92KcZNnhsRX4KvXe7e1iUbawOCVPyO88Z8F/0DAG/S EUVOXSRR4NmmLIuYDpBYXI9KOM/I34Qyi9OjRfDtBKRF0ijwAWdDCp6s91zJVqIhF4Dm Mm1SW3q4FKhImBQLSDsoZVGCBw3qe6vm2kS+nAOHgWr69xrRkxVlZY8cQdssaEzk6chd c/cfNHJVUvqVgrvK+Hi+CC7MVgD3BwB7ISe7DiHgDcte57ihOzXLU5mb5gDTctmbeA5C QRNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691690938; x=1692295738; 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=iU+C7JV6FbRgzBVC3R2lwvlAYCK7PTnMEPRpbCh3lQ4=; b=M6CorlAK1PovWAmhuq/m5wQp0mCtf0kWTHkNlShMq2XwRE4n3TdFIn3wZjEzV+Mjkf ICevO7up2EFNq4OihyjHs0JChL1XjLMHLkiJrcARBDojtpZfbD0yNGR6U/GFSovBpFFU JoW0sN0WHc2ywCPItzAUJovjt55lxZssFY52CpRLBZxWtDSAxiExpafXGqhtZtr4qYsR bDNzxd85LBNAF1BVjwPsbOfD1a40SC6W7Ug0UWbH7sKeuNEqflTnTsLp4PxmEJTxiTxA lFKiqrZBdnr3ACMcvAe73wzivSkHn9Gj/zoxSjBGo4dhmcxxi2mrRCPvGGPeNox8HGZP mrlA== X-Gm-Message-State: AOJu0YyVVq602izMwga4nGZhC7l92xAkHAbzp1GaQTbOKzlnvfncj7Hx kT7RCCMuZOvt0nnwKczBFO2kBO4NjBVAKB9ta2g= X-Google-Smtp-Source: AGHT+IG9CaD3itHY1VXsxUaoP/wll9eupisFYO/QWFELt+lNRDjEfS8WhUUaC30jFme5671xc50gVw== X-Received: by 2002:a17:902:e741:b0:1bb:8e13:deba with SMTP id p1-20020a170902e74100b001bb8e13debamr3233468plf.11.1691690938381; Thu, 10 Aug 2023 11:08:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , gdb-patches@sourceware.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 4/4] gdbstub: don't complain about preemptive ACK chars Date: Thu, 10 Aug 2023 11:08:52 -0700 Message-Id: <20230810180852.54477-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230810180852.54477-1-richard.henderson@linaro.org> References: <20230810180852.54477-1-richard.henderson@linaro.org> MIME-Version: 1.0 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=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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: 1691690997194100001 From: Alex Benn=C3=A9e When starting a remote connection GDB sends an '+': /* Ack any packet which the remote side has already sent. */ remote_serial_write ("+", 1); which gets flagged as a garbage character in the gdbstub state machine. As gdb does send it out lets be permissive about the handling so we can better see real issues. Signed-off-by: Alex Benn=C3=A9e Cc: gdb-patches@sourceware.org Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230810153640.1879717-9-alex.bennee@linaro.org> Signed-off-by: Richard Henderson --- gdbstub/gdbstub.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 20b6fe03fb..5f28d5cf57 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -2074,6 +2074,11 @@ void gdb_read_byte(uint8_t ch) gdbserver_state.line_buf_index =3D 0; gdbserver_state.line_sum =3D 0; gdbserver_state.state =3D RS_GETLINE; + } else if (ch =3D=3D '+') { + /* + * do nothing, gdb may preemptively send out ACKs on + * initial connection + */ } else { trace_gdbstub_err_garbage(ch); } --=20 2.34.1