From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id uNo5ECz0BWZrCBoAWB0awg (envelope-from ) for ; Thu, 28 Mar 2024 18:50:20 -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=jTHqrtJL; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 3E5B71E0C0; Thu, 28 Mar 2024 18:50: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 27DFB1E0BB for ; Thu, 28 Mar 2024 18:50:18 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 69C783858D32 for ; Thu, 28 Mar 2024 22:50:17 +0000 (GMT) Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id 61D7E3858D33 for ; Thu, 28 Mar 2024 22:49:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 61D7E3858D33 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 61D7E3858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::632 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711666186; cv=none; b=mRasjPhmWYrWvFSaxB/GRhZnUNcqA53U6AiwrKQHdFqANldPahbhJLejOGzHuCkZjuFZtxpIjAPQxzxj6IksUIYLsjCM5yBFgXIH4KMWH2LutAWaascWAe2A9e2Jq+S7D+pX+mAcxH/LLQkrZQSDjmWsO2CCvVhcY+6N5Fr6F1g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711666186; c=relaxed/simple; bh=cw8HWoi0GK9IULJ9tjjvNvNLD3bq4hT65KiMLi9O98c=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=L74qLKPo6fT+2LbTMLFv0iKu8yr+T+sL0PGMXNBjac2fH2YEcFtkrGScf6eiotpRH1wCkzTYDSXd7yXlTwfTZZUmi3uCCEdoNhlrxEDXkJMJcikeOa7p3LolYIp38lJ4QAGePyqNWZOXrezYs2NWWHFEIQ/CBRw8Sp65+WiUT0A= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1e220e40998so6942075ad.1 for ; Thu, 28 Mar 2024 15:49:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711666183; x=1712270983; 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=jTHqrtJLf0iNT0KHECkJJDqjPvdcFJm6lJMHmKxcWWY66QRAYiqIkePPatgF4yBwys rTYMQDx4IvKQm60jWwLF6pHMCI+8G4YFWzq6osNIS0PCRfzBFvJ2j4BfGmTgXPPvSREi Oys+uEu/QVbECjyDLTF16oVD6HhRybTm6qBT02zV4GaOa4GJyv7rmdJmlYiZhEDc05cM 1APwxP/Gd+HEfmUXxcbGllAaYnG1qCzSKPl17VBIPP6LaUtsuxoihUlX0UnqwmUgCTa0 rVinejkZxGrMQxwm3ETKECI4wg2kQl+Zr4C7DBGMxX1Z9aQHziblaqLhSE8aa3P/Ohfx 9O2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711666183; x=1712270983; 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=MzDmre629ocDJuhux3oMw8vpcTar9RKuvEtDWnCKviep3wkAjKrBb6WDYnibAr8lPB 7we1+cT6hfkRFHWzOnqcga24ZPzAhkSVlykzSKqFwhZ1Ojj4qvxJfWh1NIEw9yX1Jpmt KYd0QZJun2KlflBwNTPU9ar1ZhyE+pFHIBbYTfd+1juhwynEVxCHNlYFuh9VsV6T8jA0 TN2THDHuooyG3f2IkeoidAbQK7RbTg78bIcXpX2tNSYFQUXYITEd3SKKswKE/nsbkjnE pkGwvlF1cmkaCecGdxECWHYlEuSyyF9hgGFcCOj/mOi9zbGnTILoYWK3Uona1wjV/uci evYw== X-Gm-Message-State: AOJu0YzNJYKixnUKU/ThzoJ9gIejWhiZwVx69+fzoLx2b/NDhLyz1CbN hTbbTPDaBqSqhxFjCfuq5rcaODyWV4lA4Zl1gTfrOYvVGzZ6OQ4UyDyITKCyepDWhH/q4fPKAho R X-Google-Smtp-Source: AGHT+IEQQ5Bd4iGlEi/K3ostcd127+NU8RQ0Zdop2bR946RHDffgPUVK3iXiN23QfGiXi4w2Q5oiUA== X-Received: by 2002:a17:902:e849:b0:1e0:b871:53f5 with SMTP id t9-20020a170902e84900b001e0b87153f5mr1168238plg.20.1711666182872; Thu, 28 Mar 2024 15:49:42 -0700 (PDT) Received: from amd.. ([2804:7f0:b402:d0dc:3e7c:3fff:fe7a:e83b]) by smtp.gmail.com with ESMTPSA id t4-20020a170902e84400b001d8be6d1ec4sm2162999plg.39.2024.03.28.15.49.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 15:49:42 -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 v2 1/4] gdb: aarch64: Remove MTE address checking from get_memtag Date: Thu, 28 Mar 2024 22:48:47 +0000 Message-Id: <20240328224850.2785280-2-gustavo.romero@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240328224850.2785280-1-gustavo.romero@linaro.org> References: <20240328224850.2785280-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