From patchwork Wed Apr 17 21:04:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Romero X-Patchwork-Id: 789341 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp233591wrm; Wed, 17 Apr 2024 14:06:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUB+axGOvaaFgI2mT/c/IMcWNy1kJMnBiSUkf5rjWx4Yza+EaJSMiuMROa0PtMIIxWxTE2oEeckuQWDaIfz15Og X-Google-Smtp-Source: AGHT+IG1eUTc9AolNKqkegaBhbZNQ1+LLCrSBV5+OsOF/T/rHF+E55zDxYogZoY12TgGuP/HyUBV X-Received: by 2002:a05:6870:1641:b0:22a:a40c:4bf2 with SMTP id c1-20020a056870164100b0022aa40c4bf2mr1007902oae.14.1713387971095; Wed, 17 Apr 2024 14:06:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713387971; cv=pass; d=google.com; s=arc-20160816; b=FnS4jLu0pJBT0qhl/C19HbKfnmiWtyMBIkbzdzunFtdeF2BCtWzezPctBEott4f5oC /Cr1+ytENq2hAKkud1CRLxbTHBNIwfnDwxixCEQnV/2hE7C/jcpuD/Fnj2bBdWf2cLRT 4MuBydNUMIP75EG5YYe4pr4b9GoeA6zAdFFir6djtme9WksZ521TlrtNnqpX/4jMayuu c975rzJcfYrJz+Qwy8ca6stToNeB6/UPDK5WL1K8XCjlN6mZoU1f9sYmMeOL0UYUO8w2 P/DCbCALYPT0rdd9HU21qQrtxm3zWNTPYqkgRNDutG/sjtc+3Ce/jcSlFy1mLt9sPBOU 44Yw== 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=k4t/OkSdqXOFOVdbmZG+QDE0aaiWd592cOChHpmR15U=; fh=PHP0XrDyWzrRvU96cs6sxWXpzsZ2PqUxQqbJpAaSNaA=; b=SUG9VaX9a1qdH4uZO3OmbrAbh2E/nzWOWxW4Kd55CXbCZ/802y8mBrBSj2i2cyk1/k dgH3t7Az5//eJRnY6nsAb5p7ZimVEIHG/yiGIckLO9Ls0OarZcbW+m50kjmzAdfy5iRH zlobzQjJEVEH3Ks9BXd4KouCNocK11qTTm0qsuLil79DtlEthPqQWWCfyfzKuM56wiPv cJw4VKRg7/EBCI1N7G+273ZzzgHbqGl6qVdKMrn0p5Nzfrh3w2VfNuDUynS0mfiWzXeZ zYg9PFD6GmfhZ1N674r3NXjHUeHktGjESCAWoWUbWPylXdPGgKeHUthh7N+m9Ol69Qdw IK+g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pTTH0+iD; 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 wh5-20020a05620a56c500b0078a72677be0si36361qkn.194.2024.04.17.14.06.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 14:06:11 -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=pTTH0+iD; 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 B6230385F014 for ; Wed, 17 Apr 2024 21:06:10 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id A1B1F3858D39 for ; Wed, 17 Apr 2024 21:04:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A1B1F3858D39 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 A1B1F3858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::635 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713387894; cv=none; b=OrZDAaWqRUBnLzKGOI6Lp3P8W9lMDoSrW3D10A/LR9P9aWYwk3v/oU2sxe/6oVlQQzUUC21F6I5TJ9a4BJoqXHhWXhCG9K28/zOY29Y9s9V5GnQGcraGVv6t1+8N6wPOVeBsxk2fTU5MtarYcVtkrX2lbDX+5Nleuxcwd3BEVYc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713387894; c=relaxed/simple; bh=WxhGoGvDUNyHMS4tOjdoth41+fxv5hm536NHqm7b6zY=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=prM8IDOyR5KMpeP8PPCHypUGi5YTczlOnnAYzOQsPYXrQstkLQJeXbla5c+y66wkxryzhuDKEEgjyx2+UZV5Y9nAPEuTXOeomr6n55ksgF4mhmpgCxMgO/rlnogtd9VGJAYivmZeHNCxFjWj1y1YrQxOcUwqpg1/iPlP46HCpMY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1e51398cc4eso1845465ad.2 for ; Wed, 17 Apr 2024 14:04:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713387891; x=1713992691; 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=k4t/OkSdqXOFOVdbmZG+QDE0aaiWd592cOChHpmR15U=; b=pTTH0+iDWmfZzjxSZ6R9gn/FRBTn/5XMlcc4QRI5pnNDMiHZrW/p/jtRofYWWkW3Gz IQzmD/QFPub50aaG2p6/ZG/H37yF2yXNCZKv1V/wuSopgyZwP6iNj4MbkwME6WW6qsTC x3Q8e7enFDURo43McQJwmr++jyJEtjrazMA8wJLIKo2G1qP219Ykh3sHuKGpcHenyGlV 7NTVAEPR3fYsYcUDqEYJmofzQQhvyB+uVPpsAkL+vF7V1txoUBERzz34kUqAfOh6s6wU TeB+TzHg22fuKrVIlpC0/gODqzYQ7U/AhSG6tAPqwuATQf1z6Vms7/s51tzbReBAHzMv ZlCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713387891; x=1713992691; 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=k4t/OkSdqXOFOVdbmZG+QDE0aaiWd592cOChHpmR15U=; b=PEmy5oXGQ7gVje17iwwseScnFXqUAokDeZjU6uKrUjaaAJ5ng6M+ts1eRJbk1S1+IR qOmeGQvE4v4eByTpBXBq30CPUTbNGkOZw+V7//MysGVnyj+qc5r6n6aCAlrN0cWE219X 2dVIG0TkJchgknpeT+J2P2zBN0xjQaUTZelB6B5kd+i8M3Qu2BXUMLigkUnFKff2bnkM 0pPMB6YDztoUx2FkZ8KHTAkET3q3fdLIkuWu9y0sMpZ71lLNBr31mCaEJQNdMpZhBRg8 Qs6Eo/sM8+4Aa7VHLpFF48fnTcp51lGnBZCNdB3xzMI/gXyKJahrDmKPVivqDtopNCvq /E4A== X-Gm-Message-State: AOJu0YzQbznawWKs83sry4tYWYUlWLQMoRzgRuCDkMvcgGgTlXx9mkyR dQlyBxMUJS8iPPHCb+qbO6/ftTM74pg+O0rdDjdp17QMO2uajKhsQzYj4S/jLanuq9L/62GASTc 1 X-Received: by 2002:a17:902:6f16:b0:1e7:d482:9d96 with SMTP id w22-20020a1709026f1600b001e7d4829d96mr664372plk.10.1713387891203; Wed, 17 Apr 2024 14:04:51 -0700 (PDT) Received: from amd.. ([2804:7f0:b403:ad57:3e7c:3fff:fe7a:e83b]) by smtp.gmail.com with ESMTPSA id l9-20020a170903120900b001e3e0aa9776sm80494plh.27.2024.04.17.14.04.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 14:04:50 -0700 (PDT) From: Gustavo Romero To: gdb-patches@sourceware.org Cc: luis.machado@arm.com, thiago.bauermann@linaro.org, eliz@gnu.org, tom@tromey.com, gustavo.romero@linaro.org Subject: [PATCH v5 3/8] gdb: aarch64: Remove MTE address checking from memtag_matches_p Date: Wed, 17 Apr 2024 21:04:19 +0000 Message-Id: <20240417210424.216374-4-gustavo.romero@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240417210424.216374-1-gustavo.romero@linaro.org> References: <20240417210424.216374-1-gustavo.romero@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.0 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_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 Approved-By: Luis Machado 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 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. */