From patchwork Thu Apr 4 06:48:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Romero X-Patchwork-Id: 785808 Delivered-To: patch@linaro.org Received: by 2002:adf:f001:0:b0:33e:7753:30bd with SMTP id j1csp684564wro; Wed, 3 Apr 2024 23:49:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWkNmS/nr5+nlQ6mNZtepRQy+oeasDuBb6K1NnWJtxD55TzFU1cMIAHjFbdY/TEc4jlqEh3Hi++XtcGZC6IpufH X-Google-Smtp-Source: AGHT+IG7Q0OFcqv+hFYCvM4LnaiCq1vKvmQwVJoiKZE/PsPwH7yk5c0Z7Qw0gwGe3r29G2+2LCyA X-Received: by 2002:ae9:e206:0:b0:78b:cf48:afcd with SMTP id c6-20020ae9e206000000b0078bcf48afcdmr1538030qkc.34.1712213356499; Wed, 03 Apr 2024 23:49:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712213356; cv=pass; d=google.com; s=arc-20160816; b=hxfoIny4tdOXoS22mOFgfrVGHwN7Mv1p1N9LqGp85DvwZA5cFpiHEePX8fOlif1mh3 5hfwjacAhHt6diDTO6hCUijO9rNnJv+jUE6pB02gzJriS2J24s/3CKAzChdj0KRx8pWX bkrMNq+BoakZcuCQ3HniXCnlPT0kP3Ua01VXhTaIJn1bRoeyYtKYw9jnHRsFIHIUOzEN BDAQ+sZNVMX1asG2UP+rfUCv1kfdCrNtyuHT380s15bD8p7lgB4pkDzEegQ2G0sAw/O+ X08divNB778I+Wuiv0DvCS9ioQz76DIM/Zb5rKq2HLFtJdwuTLbAC7VZmdrMGrVG0vfz rukA== 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=nFpODmsS60D0MgO2Sq0vHP1Bf80f04kJ09zfTtn5e6M=; fh=ip7+QkkM488k9wyzFaZPu3h7BUQARzj44zdeG2KNIXU=; b=GcwM0OJNSQDGK5+nGCNCbn6bZLVBhWQHLHRKzOqib+hlIOJPjZdFHzurqUn7Cl/a9S kLBvJhdcJufScndlzX19flxVRAyRK4nOllJ2q9O9b+zC2ijS0iflHZHclu9WUb1kjIv6 4ABeEfg0NDDjQ3VLqJ54+TByD2lVTW0vJsmdBw6T/pF70xNkCyDqCyY0/23xhLwwlTRB cElunLdW9S+AxFTPIqEYUGDWwZ9Hx+3M0Zk3xtr0DbQMKh+ohpB52bOI+UY61dr2jsNb mii95oHJohMkDso2NXL3Yy6z4tZzltELjHAmxsYsGNzGeteRZoTCl6xT1nQeqlFMN6BT FUGQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=di+pJtgG; 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 pe47-20020a05620a852f00b0078bc2576789si14566783qkn.159.2024.04.03.23.49.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 23:49:16 -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=di+pJtgG; 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 D5A123846405 for ; Thu, 4 Apr 2024 06:49:15 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org 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-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 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+patch=linaro.org@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 Tested-By: Luis Machado --- 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);