From patchwork Thu Apr 4 06:48:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Romero X-Patchwork-Id: 785813 Delivered-To: patch@linaro.org Received: by 2002:adf:f001:0:b0:33e:7753:30bd with SMTP id j1csp684744wro; Wed, 3 Apr 2024 23:50:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWssgGDDrAPsj8uSJxGs4VwoSCPpYRCYpOwn5om3kDoIgWyjVZibnDQsC7UXmUS/ZnsIF2VHqXpOMHjiRJtvd5r X-Google-Smtp-Source: AGHT+IGfNmNI/S0Ggquo5QpBtOMTD1XfeHy0AjQGCqT7MjL12GInYjvY5euyRE6GmviO7nh10CZ1 X-Received: by 2002:ac8:5c8a:0:b0:434:338b:6be0 with SMTP id r10-20020ac85c8a000000b00434338b6be0mr1608946qta.8.1712213400840; Wed, 03 Apr 2024 23:50:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712213400; cv=pass; d=google.com; s=arc-20160816; b=BrhYKVyeSRbrcaCxr4S03z6+Z9VoLJYgHU5+CFSlK2OvP++d49IsddKaiF1qiXZkDK wtbqglUF42IED4BI6ENmFlJ6AE4Oja3sInFSwYiSZsNHoWd6Tj7TQAwQxQWsVKj2banC Vrb1AA0CIQ6t9CBqwEfgZFkp6LI7+eRmHPL7yh9QlPXcKaeLCHLFXqO8kRXQgDoOal9M UIHWyrr879nER9PPoPuwvsku5jCy8OAMVjpw4anvQo7RSRd4fMCOKk8q+emPPlpjg3GI /KLNr6RNZyIP1CKJhJB6Q7CDUw3VEX8pwQSixroAnaCcfKu96go7csTTr02N8FKG0o+j Y8xA== 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=XWjkfvtd9SBgDUnFrV+O02//Ju3oUvg/eI1DG3feFo4=; fh=ip7+QkkM488k9wyzFaZPu3h7BUQARzj44zdeG2KNIXU=; b=1GgcxGNcZBaC3V8CNqnFALgnrxAv4kHoEPemsn3zz+Z/ynha0lxbD8CVkJiNuhdIIe SZTW+SJbxtscM41iY67rXqmmUhycK4v5sO5cCWVipeij6YCIOiwNAGz4mmQd/UEghICq LJGgbF0JdvVugRhbF0ww0XO2ioKsNgE2ANmT6+o/SAiW46BuymT0OC6JmGIO1vN9x7Zp Y552sGpdlEL4I3BtO2R6vA2tJo8AU1htwTWZy8WmnSytRPZqw3UHGpJKIiB5A5LbEB1p DCMbVxtvchN07x7mNksodr3wKHIGgwumKQ8/VjS3DuJHDvsKayprqwiHFUAZD+70AJr7 9pLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fcaI1r5V; 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 s13-20020a05622a1a8d00b00432d2f8478dsi11100731qtc.375.2024.04.03.23.50.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 23:50:00 -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=fcaI1r5V; 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 77B683858294 for ; Thu, 4 Apr 2024 06:50:00 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-oa1-x2d.google.com (mail-oa1-x2d.google.com [IPv6:2001:4860:4864:20::2d]) by sourceware.org (Postfix) with ESMTPS id 4758F3858C24 for ; Thu, 4 Apr 2024 06:49:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4758F3858C24 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 4758F3858C24 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4860:4864:20::2d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712213342; cv=none; b=XrSSBhdrlr4QuUn6Il38xMwZm7+IWCxv4VhDuCFTEYCBi6JTurzXSAmPK6L+khI47atH1uLXQ8j273xC8RLbNVvDIMm3vFsewR4vpl35yEU5srG3/nh4SzBTvFXtxmhWG7kUxHYgdYUWO/jrIxeR5/qU3KWINGwfa4qWmDOj894= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712213342; c=relaxed/simple; bh=25R6Lo0ZPs6vmg7inSkR1rYr1lXnedOqF4np2mkyvmc=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=fbSxG4q9ioOMU6cVzYnOvqXO932RRhZmaeznSxRbLNNW/umgRqiWai9EjoEgxY0oCFSMSBqWgQTnc6atp8SbjmDQiiQfhk13GdmTxKwQlqujmNGxp+HnqIW+lx8xQYszbIORWUHev5gnAVknWMm8xjANLjk8V9hbFg+FsOHW2zc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-22a96054726so569740fac.0 for ; Wed, 03 Apr 2024 23:49:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712213338; x=1712818138; 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=XWjkfvtd9SBgDUnFrV+O02//Ju3oUvg/eI1DG3feFo4=; b=fcaI1r5V1uPf/PsQI86iyjuZkj2naT8NiLJj/Lssasio5ls/j2ija0syhWX4LAj74B txxl9nIkDudon+Ahv9TTnOChvxgeDmEbw9p/jGJnXrZtxFc3XimmfVzI65RdTkv6S776 yH/k600mN1yvoTIRpyqvhQNizMNxYWdQSaOrNFaG0PSzxAUb8z3xs/nd+/A9Y0aJK4Ax lLB3o3FoHLho76Km7+KpHW5U59NVEmnHFE5mTdPm6Bc8jQrrqSDd8zZ3lTsYMHyXbzF1 QyPqupMAZdjATogTBNRpwJQvKngCOZ0QJ0rI0SDqa3L1m1hZ+gB6WvsHkztFTnqa0yEA JsUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712213338; x=1712818138; 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=XWjkfvtd9SBgDUnFrV+O02//Ju3oUvg/eI1DG3feFo4=; b=f/9hQdhofzwzcYOJrP7pXtLB/1Rmpteo0dD8aaODBN/R7VsFlddf/AoyMJM88fIwqB g8wQFh4HhsSRrF/7JZdBv74nU4QhINMAPSwkUsYX7EtueCDV0ZZTFNFcIgDAYc/1z4A5 o7Tu3qQJtJvvanyNmGmK3rxOpW3X5JRyi3rdbbuFpi4djXa6ZwmveTrz1xHMHCsREp05 7IyxTFbmhceoGy5NhzLyxs31LUOk8hxfo6iZJhNsbhUKyX7OBZHv+/o18C9U05xoEGhi wNHVsMllMLqukByo8PBtvSvkHmyILSn4eLiVlnGRXl4rvn65ZyWsAwB1efEeVqlw/kaI y/Ig== X-Gm-Message-State: AOJu0YzoQkefJ6La7Fu6vN6s+Gh77P9L8C5LiSJqY1Bxrd+pdOUFF4NG 01A16AlUq0/V/nYQYcI0HZRzgEWYYMKecZEMjMUU14VllLP/BW9L4dbS1HVLB2q5z4ydbwn+/IT 6 X-Received: by 2002:a05:6870:9e91:b0:220:8d82:3838 with SMTP id pu17-20020a0568709e9100b002208d823838mr1702286oab.28.1712213338607; Wed, 03 Apr 2024 23:48:58 -0700 (PDT) Received: from amd.. ([2804:7f0:b402:d0dc:3e7c:3fff:fe7a:e83b]) by smtp.gmail.com with ESMTPSA id n16-20020aa79850000000b006e64ddfa71asm13218899pfq.170.2024.04.03.23.48.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 23:48:58 -0700 (PDT) From: Gustavo Romero To: gdb-patches@sourceware.org Cc: luis.machado@arm.com, thiago.bauermann@linaro.org, gustavo.romero@linaro.org Subject: [PATCH v3 7/7] gdb: Document qMemTagCheckAddr packet Date: Thu, 4 Apr 2024 06:48:19 +0000 Message-Id: <20240404064819.2848899-8-gustavo.romero@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240404064819.2848899-1-gustavo.romero@linaro.org> References: <20240404064819.2848899-1-gustavo.romero@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 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 'qMemTagCheckAddr' packet and the associated feature 'memory-tagging-check-addr' that informs if this packet is supported by the target. Signed-off-by: Gustavo Romero Reviewed-By: Eli Zaretskii --- gdb/NEWS | 9 ++++++++ gdb/doc/gdb.texinfo | 50 ++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/gdb/NEWS b/gdb/NEWS index feb3a37393a..1158715f41c 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -192,6 +192,15 @@ QThreadOptions in qSupported QThreadOptions packet, and the qSupported response can contain the set of thread options the remote stub supports. +qMemTagCheckAddr + 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..afd57ff874c 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -44093,6 +44093,37 @@ 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 qMemTagCheckAddr:@var{address} +@anchor {qMemTagCheckAddr} +@cindex check if a given address is in a memory tagged region. +@cindex @samp{qMemTagCheckAddr} packet +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 are in a 2 hex digits format. + +@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{qMemTagCheckAddr} is not supported by the +stub. This situation should not occur because @value{GDBN} will only send this +packet if the stub has advertised support for memory tagging check via the +@samp{memory-tagging-check-addr} feature in @samp{qSupported}. +@end table + @item QMemTags:@var{start address},@var{length}:@var{type}:@var{tag bytes} @anchor{QMemTags} @cindex store memory tags @@ -44914,6 +44945,11 @@ These are the currently defined stub features and their properties: @tab @samp{-} @tab No +@item @samp{memory-tagging-check-addr} +@tab No +@tab @samp{-} +@tab No + @end multitable These are the currently defined stub features, in more detail: @@ -45141,9 +45177,17 @@ 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{memory-tagging-check-addr} feature (see below) is not supported by the +stub. Access to the @file{/proc/@var{pid}/smaps} file is done via @samp{vFile} +requests. + +@item memory-tagging-check-addr +The remote stub supports and implements the required memory tagging address +check functionality and understands the @samp{qMemTagCheckAddr} +(@pxref{qMemTagCheckAddr}) packet, which is used for address checking instead +of accessing the @file{/proc/@var{pid}/smaps} file. @end table