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: 789344 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp234169wrm; Wed, 17 Apr 2024 14:07:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXbQ7J95Dkul3EFLUepUW9WdzTcqBMQcewk8LT32ml/Qwob3/khjQCacCYFtvdvTaEWpXlld4h9I6GjmBMTqw9z X-Google-Smtp-Source: AGHT+IF5/0w/Dj7ThCLKKFc/rvEdBH3EQOB2sFzMcHzZ0gaJpnlLePYI2wiKBtWK8/1ZMfeWysAE X-Received: by 2002:ac8:70d:0:b0:437:99d9:662f with SMTP id g13-20020ac8070d000000b0043799d9662fmr20949qth.62.1713388052718; Wed, 17 Apr 2024 14:07:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713388052; cv=pass; d=google.com; s=arc-20160816; b=c73sQ5DioEGkFFNRdE3ZgkWa0goTWFsmfatsD0i61AWDXo3PHp6v71kQoDzObbGaPO 7Y7rXcuFR2Vsfq1YeqEXe7lTXLGgx0YBl22RUp+/kmS5achyyf7bJZGydXiI4RI/WCmr OsduJDfG+teqOzDbDXxuLCaiKsv3SfJXO1y4D2kbzmbXt2qit70zgxVxeW4kyJ+x1/d9 LzGXTdri0Pxo+uvHt8aAdMk8ZeYy4UaIkKG2BEDfX6DGp+LZvwYO0rdjURGWL6uIo6GE DRlPdq2Qjp0uE3ZRyNMAXoNw2/lSsfpoNV87qKZyC/6A/D+ZLDf8cfBb4XIW5UJb1YT4 ZvSg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=tczhSMFbAb94s7h358uCBvjkww/Sz3Pq7Jj3xfcGsKQ=; fh=PHP0XrDyWzrRvU96cs6sxWXpzsZ2PqUxQqbJpAaSNaA=; b=k/gkLXy9ZOO2xX9ojJE2xywc5XUmgul68dzRYFkEO2jzWg+Rrox5q35bRSFkPMVeeu fy2V4LM2KSU5sLHbKN5pVs4DHTbKRDKKuIQ4qzG4yjGYRHaGDNSUyPY/juAafp6Zl0pU sc05gZOZwE7zJc5y7f1GhvdbCFz+jY2xgRd/MpU8Sh/N3sq+ypmRC+ciCnIlxfcKMFH9 qh1bPUfcl0LcbwVQUctofEhHXbKT49UE2mxoNw5l3ylndBIPUHRxGxETaUuTep5VWOUU smnvwKXwyE0in8Ar4QpGmxPVsAvLJ9doY8/gUFJ/8yOxchzISN7uDBJ0396iRM/Z3Z78 9atA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SJHM23IA; arc=pass (i=1); spf=pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gdb-patches-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id u20-20020ac858d4000000b004347cf7c206si32992qta.216.2024.04.17.14.07.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 14:07:32 -0700 (PDT) Received-SPF: pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SJHM23IA; arc=pass (i=1); spf=pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gdb-patches-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7401B3858CD1 for ; Wed, 17 Apr 2024 21:07:32 +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-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+patch=linaro.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