From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 8NLVG5xNDmaMySIAWB0awg (envelope-from ) for ; Thu, 04 Apr 2024 02:50:04 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=fcaI1r5V; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 6CD851E0C0; Thu, 4 Apr 2024 02:50:04 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 524841E0AC for ; Thu, 4 Apr 2024 02:50:02 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E35603858414 for ; Thu, 4 Apr 2024 06:50:01 +0000 (GMT) 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-Google-Smtp-Source: AGHT+IHLvBwa5t2e46NIr/wuOiD9ReXrUXEqXyChUoxC3U9eqFNneoa54uilnqILkrLmevy5//Cz0Q== 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 Content-Transfer-Encoding: 8bit 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+public-inbox=simark.ca@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 --- 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 -- 2.34.1