From nobody Fri Apr 4 03:55:04 2025 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1743427177; cv=none; d=zohomail.com; s=zohoarc; b=Jtx4dAIdE4S2l3CzVeKVYtLEAyXrfH3l0r/ZZfhkIBNmvciBc06zGW0i+q/OL8Fazu+YRveaKrfdD0GMbmZmG+9ThaVq2qvubNkWaAbkghqj3Y1NFB0pso5KrkcXSDf0EpfJvMLANwddDtVCmzbHxGyOGTdT6bYn9I2wsz3MdLc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1743427177; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BYuLLevDThsIlhYiPwTOv7bRzn5s5UV46Vyannfxfao=; b=jsoi2OHOtxMykFTkYLOU53nXv88UNiYYwpBn8YsBFW4dxeBsyHrcmtdRaeASL36+7YgB3TYi8SpcgHTyBHny2Y03DtmoSBBoStk5dS2Ev30+SMHUHdo3p9B4/wkmilQFc7gNC06XhfkR0sbHW4AXXO9R7YLO7j8zg/4RVWbuLwA= 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 1743427177825636.4884001773657; Mon, 31 Mar 2025 06:19:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tzF2r-0006Kg-Cm; Mon, 31 Mar 2025 09:19:17 -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 1tzF2n-0006Jb-Kr for qemu-devel@nongnu.org; Mon, 31 Mar 2025 09:19:13 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tzF2m-00052m-0l for qemu-devel@nongnu.org; Mon, 31 Mar 2025 09:19:13 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-227b650504fso89553645ad.0 for ; Mon, 31 Mar 2025 06:19:10 -0700 (PDT) Received: from wheely.local0.net ([203.185.207.94]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7397109c494sm7090671b3a.136.2025.03.31.06.19.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Mar 2025 06:19:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743427149; x=1744031949; darn=nongnu.org; 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=BYuLLevDThsIlhYiPwTOv7bRzn5s5UV46Vyannfxfao=; b=B+CXsHg6wGGsRfbtFTS/o8Emeasgd9XphpSXX4NJ22RvpJZzq0BLBsOWKM2GN8MEu7 4r2yB0rVQ2Ce+kqYzSe4Zx0mWrfVf6qEqrVvm+7m7I/zen1ccoSeuLViutGr93kRmDuX m5rcdPZpb42omhQ50VIjxnwGiZPXpMwRC47t/o+EXgkaL3aXNBT8R263nLsjeL1lPaxi dRMphyxPT2TIaxrhtmt4ARsplyXivqCMu3uhBoZ3N4j2/kj7THyM5eMXzrQI+w4nniSN BlVEOBa0BdXGd/pDwbaWVTIlanCyod2qvnNYMpkQ+UXIihZ9Ad8HJX3nb6zYpXznuTly GvHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743427149; x=1744031949; 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=BYuLLevDThsIlhYiPwTOv7bRzn5s5UV46Vyannfxfao=; b=PlvnZ18Joc7Zw3wyZqoe1yIHqdsmegPxX/79ZWyfo+A3sAfSmOkgpgVvGAQ6QKjExx mVKMrgipw/ztpX+ip0RQh217OJPjefsvfCZbrcO2Hi81y2xBQj3UUiLAIYLVN7M1q/sr SOjPVEeuhfOVJnQLDFXnS+by2xIHUJ4hNs0npcJuqpZojkOGWSJomJ7oTpVeUiXkBvgE aZe5kle7CjWIdSlaTOIvsymiNJ86MxeLGqeqWuA4ZaI5CxIIAeTo35RmJ7kYgPVNgp+J oWhe6+kkVO2WADuC5E69wJ39MAoyFVEc6hu4HxgxeEX06uBMy0nskLZqLjRMg9vN6Zo2 UAHg== X-Gm-Message-State: AOJu0Yyzlu82+yi9E80rm4lvEpxSgBNtBsm6IdXEXNr3DCjrzmM860hZ X39XUTVgc+OZVeJQmFUWi/lSbtm76IMf3PFjyJd6GuE2DaomYppQJDSntw== X-Gm-Gg: ASbGncuKpCe6/yuonV7w10XXXxOuMZXuROjx66tR8cTok0pvO6L3LIawdvvLEa9Qx3V 6HXV25N9JMF+RQWiPH1s2UtNiL28oXRA3zg29K3DyUEZPQWI47kJXAsByqunTj7ValsTRHWJGyC 8YZvNRCK1DI6rC2eIXnAzKPDztbytN0kCyXqGWhN1YYal5k/hYcu62RDdafecKiEz3Vpbq+29la kn4ebHmt1Fok+44/ZwJ4ILS29SqJ+q9dtrGvdxCTJwq6RJEOdIuDy39uRpBDSL58xf0qbKP+ONk zXx7iIt0Sk+9ng/TMeDHIPOBsCz3UsLM1UNbhhJhRM7v9npmWg== X-Google-Smtp-Source: AGHT+IHTsK7MV+NL7jbzeHzsoELLHPnFcqLnfL/fawOkQZxR7CwIYDo30xA75mHXsfLEku19EyNipw== X-Received: by 2002:a17:903:2446:b0:221:85:f384 with SMTP id d9443c01a7336-2292f95d401mr136652195ad.16.1743427149112; Mon, 31 Mar 2025 06:19:09 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , Paolo Bonzini , Peter Xu , David Hildenbrand Subject: [PATCH v3 2/2] memory: suppress INVALID_MEM logs caused by debug access Date: Mon, 31 Mar 2025 23:18:51 +1000 Message-ID: <20250331131852.612406-3-npiggin@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250331131852.612406-1-npiggin@gmail.com> References: <20250331131852.612406-1-npiggin@gmail.com> 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::62b; envelope-from=npiggin@gmail.com; helo=mail-pl1-x62b.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, FREEMAIL_FROM=0.001, 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 @gmail.com) X-ZM-MESSAGEID: 1743427180057019100 Content-Type: text/plain; charset="utf-8" Debugger-driven invalid memory accesses are not guest errors, so should not cause these error logs. Debuggers can access memory wildly, including access to addresses not specified by the user (e.g., gdb it might try to walk the stack or load target addresses to display disassembly). Failure is reported synchronously by the GDB protcol so the user can be notified via the debugger client. Reviewed-by: David Hildenbrand Signed-off-by: Nicholas Piggin --- system/memory.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/system/memory.c b/system/memory.c index 4c829793a0a..4c64a56676d 100644 --- a/system/memory.c +++ b/system/memory.c @@ -1412,7 +1412,9 @@ bool memory_region_access_valid(MemoryRegion *mr, { if (mr->ops->valid.accepts && !mr->ops->valid.accepts(mr->opaque, addr, size, is_write, attrs= )) { - qemu_log_mask(LOG_INVALID_MEM, "Invalid %s at addr 0x%" HWADDR_PRIX + /* Don't log memory errors due to debugger accesses */ + int log_mask =3D attrs.debug ? 0 : LOG_INVALID_MEM; + qemu_log_mask(log_mask, "Invalid %s at addr 0x%" HWADDR_PRIX ", size %u, region '%s', reason: rejected\n", is_write ? "write" : "read", addr, size, memory_region_name(mr)); @@ -1420,7 +1422,8 @@ bool memory_region_access_valid(MemoryRegion *mr, } =20 if (!mr->ops->valid.unaligned && (addr & (size - 1))) { - qemu_log_mask(LOG_INVALID_MEM, "Invalid %s at addr 0x%" HWADDR_PRIX + int log_mask =3D attrs.debug ? 0 : LOG_INVALID_MEM; + qemu_log_mask(log_mask, "Invalid %s at addr 0x%" HWADDR_PRIX ", size %u, region '%s', reason: unaligned\n", is_write ? "write" : "read", addr, size, memory_region_name(mr)); @@ -1434,7 +1437,8 @@ bool memory_region_access_valid(MemoryRegion *mr, =20 if (size > mr->ops->valid.max_access_size || size < mr->ops->valid.min_access_size) { - qemu_log_mask(LOG_INVALID_MEM, "Invalid %s at addr 0x%" HWADDR_PRIX + int log_mask =3D attrs.debug ? 0 : LOG_INVALID_MEM; + qemu_log_mask(log_mask, "Invalid %s at addr 0x%" HWADDR_PRIX ", size %u, region '%s', reason: invalid size " "(min:%u max:%u)\n", is_write ? "write" : "read", --=20 2.47.1