From patchwork Wed Apr 17 21:04:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Romero X-Patchwork-Id: 88632 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4B54A385841E for ; Wed, 17 Apr 2024 21:07:36 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id 0A4F83858408 for ; Wed, 17 Apr 2024 21:05:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0A4F83858408 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0A4F83858408 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::632 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713387908; cv=none; b=vdNW6ZbOKRHOXvhESMjeDHO7rNzlnx8nwEWXX74zpgwqMEnAwxywvMmLkrufGPYlKX8c/RGjz39/hXRSEltHSVwyoINKuMbyZxnqHpIzYX7hNaTkgmPaz9hTHH071PHt0i/np50V9vWkjIPBrBsB3LUhg2kxMphayFjvNCRtuKE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713387908; c=relaxed/simple; bh=cVLWOxkA1VHFRsgEUHjDQ4iZA5qrg0m1xE0cjIpH+RI=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=ROa7dN7ildxQAbglseCHGu3UjQc/zcjAEGPt5yYo2U8Ap3DvjrITkSgp6Gf8kZiFNzVxeI4lffVtadMrIEJlAzdMYeNhrKNvOu0lS36c4+ZmNHU1CKpH2XKbL7D39TeEwPZ4pye8SK2CX8NNK7u4IGL7jhBkJsIcj6V9nAR4JHw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1e4f341330fso1790755ad.0 for ; Wed, 17 Apr 2024 14:05:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713387903; x=1713992703; darn=sourceware.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=tczhSMFbAb94s7h358uCBvjkww/Sz3Pq7Jj3xfcGsKQ=; b=SJHM23IAHxSUjyThRGQLx6ooWJKAL/bk6S/aFQ6K7i95Ou3n19umUaETP3RXjFYUNr j/bGza/KRT8ONZ279j+eDvg5t9/4wL+hO4w5sXpxdl9Gw0kGy7jX4Dg9JHB4A1wYn/6t 9+lukBpgf7/tIxmuPpimWH//+3BCGBMkMcGyTTr6mjUg8lh7l9Y3eXYff2MNTYO3+GRi e3/DWV63F2eNdaJzgFkHvzHEFe1yqCR6vDZ0+6jEcblsFmvlFl+4fUleBvBlvvCfGZZt 1iPjJkg1flCqHpkGqGX5aQ3vlE7JKdr8Ms1eXa7vsy2Xk8gm+OGHQN/NFsxjAY7qviyR aajw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713387903; x=1713992703; 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=tczhSMFbAb94s7h358uCBvjkww/Sz3Pq7Jj3xfcGsKQ=; b=BH8h0wFlnaz2ozIaO1GL/I2kWtGe9qeY0reiTQ5OqCh/wwr6VmeLVYz/LihEIiKEhU nNGc6WWREOS74qmauWLKE0NvK8Cnfp8k3YQQPaw9O5hYZnQ0qk8tWeoAdHFwnvbCnPRj U2CBt1fsP325Lc3ZRi0+AGIMADzBDv/ml4nKGX+4mR+lvVK5j/lA6XRdZzigSm9vgZkF Ev3e7FCZCgIEg+VHPBCFjHxBC76WlaUgflJXArDPMAuzHxMGsGP3qjLuIsZs8J2qGYld wRbj2XCs9DkuTHTdesLz50aLl1fkimaqj00oOJh2HcqxM6MUVJ7zljZh3MWbGEvpve1z D+ew== X-Gm-Message-State: AOJu0YyKoY0ycixLGPV2EiVAY5OlCFfwDCHTp8+9jQW+wJJpKtLbBuq3 EUgLQ+VmRR8PEItJ2gdC4pf+31PwHWeX5ydTO3oeUaEoUy9YEgnR/8MhAQelXGPPRoNFAf5tD8B B X-Google-Smtp-Source: AGHT+IFIz/8OBscW/gRG5kQ41FuDITvWsO2c2+VKSWQ9629IGYf7m+4E0CHYSPA2Z3k9KZyBKNW0Bg== X-Received: by 2002:a17:902:8692:b0:1e2:7dc7:477 with SMTP id g18-20020a170902869200b001e27dc70477mr628915plo.57.1713387902662; Wed, 17 Apr 2024 14:05:02 -0700 (PDT) Received: from amd.. ([2804:7f0:b403:ad57:3e7c:3fff:fe7a:e83b]) by smtp.gmail.com with ESMTPSA id l9-20020a170903120900b001e3e0aa9776sm80494plh.27.2024.04.17.14.05.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 14:05:02 -0700 (PDT) From: Gustavo Romero To: gdb-patches@sourceware.org Cc: luis.machado@arm.com, thiago.bauermann@linaro.org, eliz@gnu.org, tom@tromey.com, gustavo.romero@linaro.org Subject: [PATCH v5 8/8] gdb: Document qIsAddressTagged packet Date: Wed, 17 Apr 2024 21:04:24 +0000 Message-Id: <20240417210424.216374-9-gustavo.romero@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240417210424.216374-1-gustavo.romero@linaro.org> References: <20240417210424.216374-1-gustavo.romero@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org This commit documents the qIsAddressTagged packet. Signed-off-by: Gustavo Romero Reviewed-by: Eli Zaretskii --- gdb/NEWS | 10 ++++++++++ gdb/doc/gdb.texinfo | 37 ++++++++++++++++++++++++++++++++++--- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/gdb/NEWS b/gdb/NEWS index feb3a37393a..1693a7a15f8 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -192,6 +192,16 @@ QThreadOptions in qSupported QThreadOptions packet, and the qSupported response can contain the set of thread options the remote stub supports. +qIsAddressTagged + This new packet allows GDB to query the stub about a given address to check + if it is tagged or not. Many memory tagging-related GDB commands need to + perform this check before they read/write the allocation tag related to an + address. Currently, however, this is done through a 'vFile' request to read + the file /proc//smaps and check if the address is in a region reported + as memory tagged. Since not all targets have a notion of what the smaps + file is about, this new packet provides a more generic way to perform such + a check. + *** Changes in GDB 14 * GDB now supports the AArch64 Scalable Matrix Extension 2 (SME2), which diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 82a617e9ad3..90b0b68a279 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -44093,6 +44093,35 @@ although this should not happen given @value{GDBN} will only send this packet if the stub has advertised support for memory tagging via @samp{qSupported}. @end table +@item qIsAddressTagged:@var{address} +@cindex check if a given address is in a memory tagged region +@cindex @samp{qIsAddressTagged} packet +@anchor {qIsAddressTagged} +Check if address @var{address} is in a memory tagged region; if it is, it's +said to be @dfn{tagged}. The target is responsible for checking it, as this +is architecture-specific. + +@var{address} is the address to be checked. + +Reply: +@table @samp +Replies to this packet should all be in two hex digit format, as follows: + +@item @samp{01} +Address @var{address} is tagged. + +@item @samp{00} +Address @var{address} is not tagged. + +@item E @var{nn} +An error occurred whose code is @var{nn}. This means that address could not +be checked for some reason. + +@item @w{} +An empty reply indicates that @samp{qIsAddressTagged} is not supported by the +stub. +@end table + @item QMemTags:@var{start address},@var{length}:@var{type}:@var{tag bytes} @anchor{QMemTags} @cindex store memory tags @@ -45141,9 +45170,11 @@ The remote stub supports and implements the required memory tagging functionality and understands the @samp{qMemTags} (@pxref{qMemTags}) and @samp{QMemTags} (@pxref{QMemTags}) packets. -For AArch64 GNU/Linux systems, this feature also requires access to the -@file{/proc/@var{pid}/smaps} file so memory mapping page flags can be inspected. -This is done via the @samp{vFile} requests. +For AArch64 GNU/Linux systems, this feature can require access to the +@file{/proc/@var{pid}/smaps} file so memory mapping page flags can be +inspected, if @samp{qIsAddressTagged} (@pxref{qIsAddressTagged}) packet +is not supported by the stub. Access to the @file{/proc/@var{pid}/smaps} +file is done via @samp{vFile} requests. @end table