From patchwork Tue Apr 16 14:07:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Romero X-Patchwork-Id: 789237 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:dcf:b0:346:15ad:a2a with SMTP id dw15csp305334wrb; Tue, 16 Apr 2024 07:09:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUcfxnW1sPmOzZLw8hgq63y2Z0Ak2XxBHv/a0AddAXroVWglkntJdgKNXPGywtEefahKKmHB+CqXnJdzMbqy3Xy X-Google-Smtp-Source: AGHT+IHXiA9aP6oPGOyPk4nlpKYDUJY3zDHAmNJ2niKfwxW1/K6OHGVMdKjuZNTVQiA2qFV6nfuN X-Received: by 2002:a05:620a:47c2:b0:78e:bd2f:1088 with SMTP id du2-20020a05620a47c200b0078ebd2f1088mr3151825qkb.4.1713276593635; Tue, 16 Apr 2024 07:09:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713276593; cv=pass; d=google.com; s=arc-20160816; b=sDDXtmVqy9bY/nIobSxtJqqylTLSbjtBEbRNDCkva3E9xJuCFTVU/kaesPcvx66sGp yHqTPZXXKrvLPd/10fvCY19twEd8L0flb+JBPIKsAGp00Q+42g6wDi8nqwIXjOI/+uzZ MpupGNE6rVRnePJp57Z89+6TOp9fvnSfJbujGhu87o1/lLYWBfqAwkYXZmGOTsVjdI2A j1Mzn8A8oRoAISw4YAYA5hL9LRi1vSw4EAVOrJJnhwLC+HL74D15Nj523eosY9IJbwSz rmnqF4mPkFCsW6ENf41GO2YQkP9kkpVBLzlEfDoNGPIHKb8cv8TpNhR2R9Vb1K2tf6zA wvog== 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=TySCtsAV9w2OFUsPqDtQ4yT0bercISlHKAJQghi98fU=; fh=PHP0XrDyWzrRvU96cs6sxWXpzsZ2PqUxQqbJpAaSNaA=; b=xsefOHvZ/bdKvx7Jkg6SRXvSsrX9LV6DaijLbBaWFqmRyxN2UtkrSKa2YkxTGVgj9s gtz+Nql+wFa2FUYkzRDyVJBhLUIx5WDN6sQWRWlWpjzOLEM86KZYkLiqocwADEtZV2sp 6+w1KmoRxj00awyRAWzdKQtLDTxA2XMxwhvKPT1RLqYBLe3UOymyJ/BABSUwS+4LIvVU Zf9Rg61l/QUGweRBn2DySH+DNA/Ee8QQHPWhdTnyl484C6DKciAhL+Wn6x9YTBK+nu2U RAm5umpyWXEJ2Ko3daWYfoof8P9oIs8dHbEQ7kms9EMZkcWBhN2SpsjZ9bbwuhkYdBiR BA8A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P2iwK47d; 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 d14-20020a05620a136e00b0078d778420c3si11976872qkl.647.2024.04.16.07.09.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 07:09:53 -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=P2iwK47d; 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 31DE6385840B for ; Tue, 16 Apr 2024 14:09:53 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id 4381E3858431 for ; Tue, 16 Apr 2024 14:08:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4381E3858431 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 4381E3858431 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::42d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713276495; cv=none; b=BjgTNInB51tZMYavJ7jQzk657h9G9J4Jh/AeINXtL6byUlT6xbiNbhVlZdULUvqB/ESZiMgwJT+XYizQd+qIE28UjzMlU6HL+I5ZJIH4e71QVbk9b85AmCyfFxmC85QzH3ega9PjIZqtnNw1U7oq6BJIMIuXoKqintXpbAgm910= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713276495; c=relaxed/simple; bh=uX7XlHxVf0V1WMrVHD1NCj+jz5ubqQflYFbXbd+PMaQ=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=aTw/DuUJ+uUoxaUYws2QigN82oSStYsvweI3KXcJPduvd1fjBsOr9Q2hjLrXSPRCoIZ8DepSj/6FMH15X2tG+C2kGro6a9yz1/+4nmtpNJLI//PdhcZuoHHCHlE2KDpHcWM1b8+xaf7fyLz9bF2bE0/NLTB71+/5CdKYGHdPlCk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6ee12766586so2928792b3a.0 for ; Tue, 16 Apr 2024 07:08:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713276481; x=1713881281; 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=TySCtsAV9w2OFUsPqDtQ4yT0bercISlHKAJQghi98fU=; b=P2iwK47dYWVDxK1VHobPzCcHYA6eKPKn0m+/pDnOJVp86eETHmehVZvP5y+YK0JoCz pOd1fan35zSy+IueN8vM8AgdnIx+FyKlsDsFwPM+pO0JkFYEhVW87NrHdEG0kARPk9a0 f0pkcem/iEQIrrDUUyIulLvo31eDf6sfRQKbXuN0A0cQKagVmLCox9SWKZA6IX1vHgiO M1iCV/LQQNqgPQxvyUAomKoGEyZW0qSumTG+fjVwj6PrAfGESKf/iuW8NZ5ek8pD4W/s zhq9Zo9MFO8ifh5vLDxvMQ1NWILyFHVmyMGFN53SVSWVT3XNkXBJSUZld8UGEQzjQLFU l3Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713276481; x=1713881281; 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=TySCtsAV9w2OFUsPqDtQ4yT0bercISlHKAJQghi98fU=; b=jdTOVmZowjERqhAFos54gq6SwpLIf7+k485TxInWIlY1NBjRbsNlkEZZ8apwnmzrB0 dj0UcBsuGNbSwhK+TgFnTeL6L42Kox5NVNSt07nvuOa/YvkuxbSdvBnunNyTAC4gpL1p WAQgW9Up3xrJ4oQ60ZIxJQnFaSw1Mc3pQOgwCMSnYJvnd1KmmVjdHsXlQC4SJAlel6L8 34Bw4AdP/BlZjg0hKU7an+nUi5CJ9VMAkwdyRRfioYywJ8JX5Zq5X7Fb0pyQ6YrC5bj1 EIywP/JrRGigU6L4WdrK8znnIf0K+67gs/2Vk4k0Fg8k7VURRU11wCTlocOEd2mOnG58 Tqtg== X-Gm-Message-State: AOJu0YxDA9+PKol1SHabW6xpQ4C2rhNEm3TMm9Kcqme2t6s0G/7yk6pz 2TU5Wi1zJDxAVQSzMflBCZP9spVUVocfKIQwHU8aEOGx+lfcoF3sQ261433wGQqODnBL2v5P5wv ET5w= X-Received: by 2002:a05:6a20:3d86:b0:1aa:3ee3:8d5d with SMTP id s6-20020a056a203d8600b001aa3ee38d5dmr3101796pzi.14.1713276480816; Tue, 16 Apr 2024 07:08:00 -0700 (PDT) Received: from amd.. ([2804:7f0:b403:ad57:3e7c:3fff:fe7a:e83b]) by smtp.gmail.com with ESMTPSA id o3-20020a63e343000000b005f3d54c0a57sm8937473pgj.49.2024.04.16.07.07.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 07:08:00 -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 v4 8/8] gdb: Document qIsAddressTagged packet Date: Tue, 16 Apr 2024 14:07:28 +0000 Message-Id: <20240416140728.198163-9-gustavo.romero@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240416140728.198163-1-gustavo.romero@linaro.org> References: <20240416140728.198163-1-gustavo.romero@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.0 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 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..cb6033bbbee 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 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 @var{01} +Address @var{address} is tagged. + +@item @var{00} +Address @var{address} is not tagged. + +@item E @var{nn} +An error occurred. 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