From patchwork Thu Apr 18 20:10:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Romero X-Patchwork-Id: 789870 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp750778wrm; Thu, 18 Apr 2024 13:12:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWLYfRMj4+r9EnIya5Kdp/sfv/XRaeL2dP/rLjCk0L6ldpDAjIUphq8UhVIIBSTHD3WAJK5+po0ZjUpOI8ObWOg X-Google-Smtp-Source: AGHT+IHQvage9BFpNFTgQ17iAjNT+hw7+f1SYdfvFRIizcG/hGLkBmHUIqBXwV5Q2uCWIXv+b/x4 X-Received: by 2002:a37:de0e:0:b0:78e:eb64:d91 with SMTP id h14-20020a37de0e000000b0078eeb640d91mr546670qkj.1.1713471124298; Thu, 18 Apr 2024 13:12:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713471124; cv=pass; d=google.com; s=arc-20160816; b=RCQtClYHD2tuWQaHXpzWTFaEnpmstTQ538PudCTz20wRe0KDMQCzo+7aZgodtmXRAe 7z1ivISpVj7cngJLkWhlb5OZYi4Z9+DD1zWNeoTOBcUWRfE4ehf10JDguQhJHPVjWyzC F2S9dDzKZGb3AZ3G2vq1ZbN0p744kGiohSEttTFcuwezSn8F+Yr2th/a3637p3/G9L2A YZFPp4RsiKngY+wPWUUBLB0k7HbfBGie1RsgVQnn6hBN5BUtEXy/c6ix7HvZgS+Ngi2C 2qVSPgBega8OQY3cEprBZaUf4LR/0tn7o3Uqz/K6PRcBNAoxidNX7x4J4lHprFC6cU6o tSdg== 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=TF2Nl3FJrU/baf5Up/FEuXBwOW/ZL2rAiN9OJnXXfF4=; fh=PHP0XrDyWzrRvU96cs6sxWXpzsZ2PqUxQqbJpAaSNaA=; b=a2niyq+1/qez0Z3L88ukKWYxmqeH7oWGxIdvMlIubfRrUz1Z8EncARcwa9pHrqaCIq qLIFV8BS1T3yEiqbE6bmgXQlwUC94vQTwRhBti3W9hCL2HC01qM7oDczRSkgEsFiM+e2 GCTqdM+3k+7P8vykARwc6s2dg770ZxLz0RTGJnnhSABVydwJlbYIAcq9LxD9TaNhlM+2 gHB87YCzcAfVSJS/+sDaVwRJu+2sYvqrb80NZDlhWsAP2d3C5fqeabEFBPDxs5viuscp e1FWaniCSAQsR7t/Qbs2iw39SaJp3P0N8E1C84mwkXbKEHwWYZADZjrybmbwjZDKUsT6 e4IA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gbBtFLB9; arc=pass (i=1); spf=pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 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. [8.43.85.97]) by mx.google.com with ESMTPS id pa5-20020a05620a830500b0078eeb70f535si2138078qkn.383.2024.04.18.13.12.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 13:12:04 -0700 (PDT) Received-SPF: pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gbBtFLB9; arc=pass (i=1); spf=pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 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 E029F384AB40 for ; Thu, 18 Apr 2024 20:12:03 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id 82B29384AB7D for ; Thu, 18 Apr 2024 20:11:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 82B29384AB7D 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 82B29384AB7D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::635 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713471081; cv=none; b=cfg4+9I55O6fv8lwZa6pCAr4+aNBmofml1b5EHexorLSP1gnw+IdkSs6g+CsBMQA34Ejyu1ssWdgDojHysAkcowGG1Sf6F6IIEp5t5mVIU9dmTMs7duAxiSolmKG5KW1IaScIRIpkhk4QfPtAugTtbBgFsBsD287IqtC72PMSxI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713471081; c=relaxed/simple; bh=mPTe+q7MJUDvKWdOmh4uT07j7CKJAiaL8Lmczphlc9o=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=ix9abt/8lTIn6A+Z77KGZsz4ImcgCjC7vaQwqPm2XD1RqGJUIJB8it1mWxHF98rgQGTcVEGHi3XPx6nyRjwswR5V5o9lISe63KiNPMNXgtAee7K9Xy+9DVhtSn4KsZJT+xogvtE/8A9iMmk/lSPtw86incS/wHaWgAhkfU1IFuU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1e3ff14f249so9894595ad.1 for ; Thu, 18 Apr 2024 13:11:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713471075; x=1714075875; 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=TF2Nl3FJrU/baf5Up/FEuXBwOW/ZL2rAiN9OJnXXfF4=; b=gbBtFLB9VFTC16IWYdzn3lCuCCzHmsxrFO3a1Pq9QgwFwQTtDUF6Ee3vQcZbMI9BZb 2G/YGajKBNi+i+R4Oko3Qf9H4+mD7iNmJsXjxCDNw+EYnILyew+Lzj3B3KyofdkQ3Ai5 3nzp7A9d4+hrhd7OWyOQ5zK1Xc+WCEHWDZT0L9khNIgVOeOBFiE4J14jNIAOsWIg69JP pDh5oqIfaCek2bAZXgzUuKTqq3/A3M+ybYtb6gWFiZIyOymzTVe+dP65i2zUDXO56HJC nR4UAR7/5b+2LyturGRkyE4DiFVbovPVDl2bvNi7t2e6/QtFmOYh0EF/6j3i+GM+ou5C tfFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713471075; x=1714075875; 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=TF2Nl3FJrU/baf5Up/FEuXBwOW/ZL2rAiN9OJnXXfF4=; b=QwgIa9n5y+K/gBFUH1Ns4qJ/mZYtpnPRNGc62ij75m5Rd7uLIFIiGY5wkghYDB7a0t 7hobXAMkZYLuDqNsvJyvDCa2sglt8encM0413SnUfPX7km374TyBD4u/N435yZTbPUey aqzpBMTG7v3n2iTqeito2usyJDrJnF/yV76HQhnBBNO+Mnm0PT1xE9V0hMEn79Y1GhoH iK6Tgh0RPqvLnCRplKYhXlePApyIvePFHdnF9pOxoAW808pfuKQZ2XaBLbu7HEfpVPx+ ucB64iFnltoNAG18f3pdE0S79u+QWXUYoVzg3jMaYDSzJJBHJTfPI4dUfzQAeEhmy0C1 1Xjw== X-Gm-Message-State: AOJu0YwYY2mRCam/Z9/tQCrJXOEub3tKu12Oz7bGMMOnsH+kA1LoqFjE wPwkcXNkPl87Xpnw0kXXSQHIN+mgxy3cyYifAO34NFi232FrD9VtduNheq1Wn+r+WRGq3jpAzTd S X-Received: by 2002:a17:903:234e:b0:1e5:e664:9c12 with SMTP id c14-20020a170903234e00b001e5e6649c12mr5817226plh.0.1713471075160; Thu, 18 Apr 2024 13:11:15 -0700 (PDT) Received: from amd.. ([2804:7f0:b403:ad57:3e7c:3fff:fe7a:e83b]) by smtp.gmail.com with ESMTPSA id n18-20020a170903111200b001e0b5eee802sm1925524plh.123.2024.04.18.13.11.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 13:11:14 -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 v6 8/8] gdb: Document qIsAddressTagged packet Date: Thu, 18 Apr 2024 20:10:39 +0000 Message-Id: <20240418201039.236867-9-gustavo.romero@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240418201039.236867-1-gustavo.romero@linaro.org> References: <20240418201039.236867-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 942453c7064..050f6f96e62 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -196,6 +196,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..31a531ee992 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 +@cindex check if a given address is in a memory tagged region +@cindex @samp{qIsAddressTagged} packet +@item qIsAddressTagged:@var{address} +@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