From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id wG2eAXFNDmaMySIAWB0awg (envelope-from ) for ; Thu, 04 Apr 2024 02:49:21 -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=di+pJtgG; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id EF5C51E0C0; Thu, 4 Apr 2024 02:49:20 -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 D166F1E08C for ; Thu, 4 Apr 2024 02:49:18 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6DDE5385840D for ; Thu, 4 Apr 2024 06:49:18 +0000 (GMT) Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) by sourceware.org (Postfix) with ESMTPS id 5023D3858D34 for ; Thu, 4 Apr 2024 06:48:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5023D3858D34 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 5023D3858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::231 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712213330; cv=none; b=rXI828GC1QFsGTZ6ZRJXqSTb9yWabQG/vISPufboAMAn2lW/WUDjE3KkrXsKQY6sM9ehK3dadtGKjHV34Q43gOjSTBTFm1tZ9aOwOetUKk35cmNrPrfYLGERZUFMYn+SnFlEEDiziVtoXaEjzQLS+9FYlHjhEEonjFLo+DQ0IgI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712213330; c=relaxed/simple; bh=cw8HWoi0GK9IULJ9tjjvNvNLD3bq4hT65KiMLi9O98c=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=F2QTjALJX1iKlPQcmc3OuYw06s9RqHz38ccODqd11anNQkQeNFZMpsxU5BMWGHgh5+tZ7sI2IRjMCld1Cejs3nyOJnVtI7fJy4HOm6a8+1xKGvjq4Uv6rm+0N4yD+B3y6gXBIR6J5fqC9309iqsvBEGs8HIHbBz+Na/ycgmJd9k= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3c38eced701so335886b6e.1 for ; Wed, 03 Apr 2024 23:48:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712213326; x=1712818126; 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=nFpODmsS60D0MgO2Sq0vHP1Bf80f04kJ09zfTtn5e6M=; b=di+pJtgGQBNTkBlHWfiLaiDVZilWCZwJXDVacmmY9MR9VRdtCcBR410av3R8Av3xoh CwE3p1Z0N2MYbfZ/LtMEpF8U6k+K50nFcAKIx8Q6bhZjGB4Y30mI19ET6vJBKT5ubs4/ tveuRTjpmGT46muNhsqNGscs0HMtELcTRhQwqwftJvrbzLugdoKa6y+AtZ+C8exz7UFi W9eJRNgHMvkLqYroixhUhFCw7UAn+0uqhGshTpW4YjkFQKSiiEDVCXqp1JefvfcAB1++ 2bIpoWcWkydEW6WyOTUrw5cQtNFRfbWK8im5h7DZayWfOvQdIv3twLFTDpSofPCQkIIb zTMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712213326; x=1712818126; 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=nFpODmsS60D0MgO2Sq0vHP1Bf80f04kJ09zfTtn5e6M=; b=bMwdkhuaC5uZL7xlkPOLU6IQKEEtjVbzmHNYDArRvXgmeer/J22fmaxaFoda9teAzb E5tcwQh2TSle5SNtR9A5TP4jF/bS98x1k1ekNjovN6UrhZhYo/FPHkihL7lfKrTMsvnS 8l+uZruUlmhedlJbXMoRS3AzXKgMmy8y0taObjtOnpF8+Q1DzDtZB+/WLjdoiQqGdXgk CcKN8FOg+HTG5R/RTzVyzOhg2G42ceuGeSGaP2z0mLgvsBoISxkcgXYCTT/P8Ecb9OEQ s1k/5qF9AR2ZKOgQlhX5/Ip1wSd2g/gWGHe8anmx1IQYayacVx3aAHzfEpZnUuP6FZK8 MyYA== X-Gm-Message-State: AOJu0Yw9SluvbyAJzOX7+bxSo2WthaYsWi5AEYpZzQs6Gq/bRoNax4lv u9OuXAMmeP8Ywk2HXaxvrmAunWzGlPMCItaSnKuNja6Ad9XW8yQ7/eY22KzDrLof7BEFQM1eGzK k X-Google-Smtp-Source: AGHT+IE3WJToUq0i6S9cPt17KFYvzGFVOfvhyOIFwdC2a1+peRjyIEKK+4UomM67O0eikLNPxTqROg== X-Received: by 2002:a05:6808:228f:b0:3c5:d998:6eb4 with SMTP id bo15-20020a056808228f00b003c5d9986eb4mr163714oib.7.1712213326231; Wed, 03 Apr 2024 23:48:46 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 23:48:45 -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 1/7] gdb: aarch64: Remove MTE address checking from get_memtag Date: Thu, 4 Apr 2024 06:48:13 +0000 Message-Id: <20240404064819.2848899-2-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.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+public-inbox=simark.ca@sourceware.org This commit removes aarch64_linux_tagged_address_p from aarch64_linux_get_memtag. aarch64_linux_tagged_address_p checks if an address is tagged (MTE) or not. The check is redundant because aarch64_linux_get_memtag is always called from the upper layers (i.e. from printcmd.c via gdbarch hook gdbarch_get_memtag) after either gdbarch_tagged_address_p (that already points to aarch64_linux_tagged_address_p) has been called or after should_validate_memtags (that calls gdbarch_tagged_address_p at the end) has been called, so the address is already checked. Hence: a) in print_command_1, aarch64_linux_get_memtag (via gdbarch_get_memtag hook) is called but only after should_validate_memtags, which calls gdbarch_tagged_address_p; b) in do_examine, aarch64_linux_get_memtag is also called only after gdbarch_tagged_address_p is directly called; c) in memory_tag_check_command, gdbarch_get_memtag is called -- tags matching or not -- after the initial check via direct call to gdbarch_tagged_address_p; d) in memory_tag_print_tag_command, address is checked directly via gdbarch_tagged_address_p before gdbarch_get_memtag is called. Also, because after this change the address checking only happens at the upper layer it now allows the address checking to be specialized easily per target, via a target hook. Signed-off-by: Gustavo Romero --- gdb/aarch64-linux-tdep.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c index 0b9784f38e4..50055ac3f48 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -2575,10 +2575,6 @@ aarch64_linux_get_memtag (struct gdbarch *gdbarch, struct value *address, tag = aarch64_mte_get_ltag (addr); else { - /* Make sure we are dealing with a tagged address to begin with. */ - if (!aarch64_linux_tagged_address_p (gdbarch, address)) - return nullptr; - /* Remove the top byte. */ addr = gdbarch_remove_non_address_bits (gdbarch, addr); std::optional atag = aarch64_mte_get_atag (addr); -- 2.34.1