From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id CEr7AUtt5V/GSwAAWB0awg (envelope-from ) for ; Thu, 24 Dec 2020 23:40:43 -0500 Received: by simark.ca (Postfix, from userid 112) id EF4961F0AA; Thu, 24 Dec 2020 23:40:42 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id A17381E99A for ; Thu, 24 Dec 2020 23:40:42 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EE5F93858026; Fri, 25 Dec 2020 04:40:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EE5F93858026 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1608871242; bh=DaOTeeanoMdSMa5HDma4XjVw4yjEYI4jRYwVXzL9NoY=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=veJSGudJQiaol80wo+iaBVhok4dS25oAutd2Uynn1PSHAxhLGpRMkpvRJoI+wyVhI /lEzPndMv4OZ4gb8K8URiBVffme60yp2P9WEm+hC31T4u8mZiyJAB0V+HFrrYbJlI1 Wsouxiedj+recFPQEud9+hyx/wK1t+Wv7t1imFuM= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 029173858026 for ; Fri, 25 Dec 2020 04:40:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 029173858026 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 0BP4eXbP016092 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Dec 2020 23:40:38 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 0BP4eXbP016092 Received: from [10.0.0.213] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 8AF001E99A; Thu, 24 Dec 2020 23:40:33 -0500 (EST) Subject: Re: [PATCH v3 02/24] New gdbarch memory tagging hooks To: Luis Machado , gdb-patches@sourceware.org References: <20201109170435.15766-1-luis.machado@linaro.org> <20201109170435.15766-3-luis.machado@linaro.org> Message-ID: <689b47a9-e9bc-fd00-7575-ba70f40b4ae7@polymtl.ca> Date: Thu, 24 Dec 2020 23:40:33 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20201109170435.15766-3-luis.machado@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 25 Dec 2020 04:40:33 +0000 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Cc: david.spickett@linaro.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 2020-11-09 12:04 p.m., Luis Machado via Gdb-patches wrote: > We need some new gdbarch hooks to help us manipulate memory tags without having > to have GDB calls the target methods directly. calls -> call? > > This patch adds the following hooks: > > gdbarch_memtag_to_string > -- > Returns a printable string corresponding to the tag. > > gdbarch_tagged_address_p > -- > Checks if a particular address is protected with memory tagging. > > gdbarch_memtag_mismatch_p > -- > Checks if there is a mismatch between the logical tag of a pointer and the > allocation tag. It would seem more natural to me to have gdbarch_memtag_matches_p instead,which would just be the opposite gdbarch_memtag_mismatch_p. If I want to know if a tag matches, I have to do: if (!gdbarch_memtag_mismatch_p (...)) and that's like a double negative, "if the memtag does not not match". > gdbarch_set_memtags: > -- > Sets either the allocation tag or the logical tag for a particular value. > > gdbarch_get_memtag: > -- > Gets either the allocation tag or the logical tag for a particular value. > > gdbarch_granule_size > -- > Sets the memory tag granule size, which represents the number of bytes a > particular allocation tag covers. For example, this is 16 bytes for > AArch64's MTE. I'd suggest having "memtag" in the name of this function, to make it clear it's memtag-related. Like "gdbarch_memtag_granule_size". > > I've used struct value as opposed to straight CORE_ADDR so other architectures > can use the infrastructure without having to rely on fixed types. What do you mean by "having to rely on fixed types"? Otherwise, this LGTM. Simon