From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id OPO2GDT0BWZrCBoAWB0awg (envelope-from ) for ; Thu, 28 Mar 2024 18:50:28 -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=TWJ0H1qj; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 61E1F1E0C0; Thu, 28 Mar 2024 18:50:28 -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 531161E08C for ; Thu, 28 Mar 2024 18:50:26 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0F82F385828B for ; Thu, 28 Mar 2024 22:50:26 +0000 (GMT) Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by sourceware.org (Postfix) with ESMTPS id 3D5F03858407 for ; Thu, 28 Mar 2024 22:49:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3D5F03858407 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 3D5F03858407 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::636 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711666190; cv=none; b=Kxdu3GA14dH7j8g7Zfr0Q+gronFYeMhbPXEpb8WUtUvwr+sVf9rkbpAkbUQmpBPCqCbey7YJomosoF55rFg1eA31pekydqcHL/PoskIDPK1qxPrSaG4cjUXoGsZEOA8x2lNbn19jrwdchTJmtCJguD2ryNh4jyMlf+9a3VyMoQ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711666190; c=relaxed/simple; bh=m0zxqCy8ZHC4pqDMn5zPMAeOHRoB5JgRRsV+IvPQPCM=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=Dcef5/VdYls72LN/TL90eW50I0+YsCDQNwqu6RmaZyOJWK6cIcutR6zYim2aZjt8WHFUb3yhNpg/sK8t2kUsiytz0K2MphBb6cY3kIsCQBa9Abu1eDcktYEBa0fak87Q6Fvs/Y6BHTnP+ARyoRuztigNEyFBgieT1AsO8B+48Y0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1e228c12468so3609005ad.1 for ; Thu, 28 Mar 2024 15:49:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711666187; x=1712270987; 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=CkpJndIS961iAMYqy80lEUh7uV3OrKV2zpeEaXIJ8mU=; b=TWJ0H1qjnjjqhg582qN3IEviiVMbrkf0El9AR4YLeab8JIRyGBSlON2+JZ38z3dPFx sEX0iYoK/VUWIaPlmV9gf80x41q/JmJEzbl8TyIt9eIz2THwSX0f/1Vp8wt8T4jL274U J0d1AjxVA1gTeGNUxcgsEEU5Qpe4WilDgF42CWnzbwrYC8M2B6UJn1X/qxv2Vw9+P6jW fB0AASQqZy6WjHJTs8EVsG+clPOaoAOcjz9XutEKsCeqf0Kcx4B7kdehihqe+6dDmbm5 UE6eBP8XuEKo63yUMWqEWDNrCHIouU1SUTP96/OscYIwifBGnQckVCzFX8h/5UJ7JISn zYMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711666187; x=1712270987; 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=CkpJndIS961iAMYqy80lEUh7uV3OrKV2zpeEaXIJ8mU=; b=bF7HuP1PoI41qPgwY0wr2ETzY9R0w9Iqam+ex8MkEI7VDNV/LCwTYliVRCbyd/FZHv DLHbTW2VcZq5MU60yjsW7U4Y7zRLbugTm2Ej2gdeO/zIBGqGGgk+GNvRSlqhQprZHXor OiEF8PdTZtfqpg4s23yoNAh962GITl8CxJFlpZAJ2xmX442RLWluVf876RUZ9ZsOmPUo Wyay89MZWKFcOEXCSFGJvDgfXTQgRKDB5qQiVFSANMz58PNviNYmonlYo3lSvzkgk48W qAtg2AxFuIIop/d8o6bZQQVKM3/vYvaFSw6ph0g03DlFq7XGZEOGXY755HQsberi2kar Bi4g== X-Gm-Message-State: AOJu0YwoLrPJmohORyqgOnfMqnh/VH/3oVicmSLhWEpwaUuZNlyw73oi 10zMzLB2sPMAokfUEe/Wt4Y+RIgZr1t/NW4nib5x5KT6NNoLv/35uJVoRwO0yu8QFWJvyRkFddL O X-Google-Smtp-Source: AGHT+IFs9zPlBsrbIIlkZoFU3sUmANFcfAfFXr7twEyPlNihLu2TegTmXwt6coxTTrNpt/VFDU6Slg== X-Received: by 2002:a17:902:7686:b0:1de:f571:837c with SMTP id m6-20020a170902768600b001def571837cmr4699419pll.28.1711666186793; Thu, 28 Mar 2024 15:49:46 -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.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 15:49:46 -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 3/4] gdb: aarch64: Remove MTE address checking from memtag_matches_p Date: Thu, 28 Mar 2024 22:48:49 +0000 Message-Id: <20240328224850.2785280-4-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.6 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_memtag_matches_p. aarch64_linux_tagged_address_p checks if an address is tagged (MTE) or not. The check is redundant because aarch64_linux_memtag_matches_p is always called from the upper layers (i.e. from printcmd.c via gdbarch hook gdbarch_memtag_matches_p) 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, gdbarch_memtag_matches_p is called only after should_validate_memtags is called, which checks the address at its end; b) in memory_tag_check_command, gdbarch_memtag_matches_p is called only after gdbarch_tagged_address_p is called directly. 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 8e6e63d4dcb..fc60e602748 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -2476,10 +2476,6 @@ aarch64_linux_memtag_matches_p (struct gdbarch *gdbarch, { gdb_assert (address != nullptr); - /* Make sure we are dealing with a tagged address to begin with. */ - if (!aarch64_linux_tagged_address_p (gdbarch, address)) - return true; - CORE_ADDR addr = value_as_address (address); /* Fetch the allocation tag for ADDRESS. */ -- 2.34.1