From patchwork Thu Mar 28 22:48:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Romero X-Patchwork-Id: 783641 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp2966052wrt; Thu, 28 Mar 2024 15:50:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUPf6a8hdUTX615V7gSCS5HRceTZyWZvp8X7wCNVyplc5rPvKv7ze2A9R7NBH/XG/L4X9E1FphQvhGPDTyIo4uV X-Google-Smtp-Source: AGHT+IHvleyoAbztMN44Dp8BmfsmJCKOJanBzgHE+Ykba449I5rxgo64cnSAJ/9QSgZOFMGJNzwm X-Received: by 2002:a05:620a:5623:b0:78a:3524:11f with SMTP id vv3-20020a05620a562300b0078a3524011fmr1343639qkn.10.1711666222840; Thu, 28 Mar 2024 15:50:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711666222; cv=pass; d=google.com; s=arc-20160816; b=y3yF/CrX6d609iRPskxP6xp3dq7psD+8bDbdxcD+h+5oz4ntL856AjSgTEuVlnUDEK RSuK3v2eW0rIKRMN6neqXzkAYhFYYb0H5v2GxErEhOtoQ7ftyRTLjHhUtYftGItaRlRP 9DbKgnr27DVoF6uMhG3x8dVkhGQ/ohO/SQR3GwlO6Nnjomu+HdxHqSJK/UZfmgYe1GPa qNn1U7IoeWerNHPu7UgLPl+ojzv2xzD3oGDlRRZA/gZOCxZ0nOheJE1kOX1UlIqZuG3k WwBRaWceWu1AGwUcrwMuzyHL8gjFaPghG68FVVCJniCbQMS71R6rIc+kSam2p0244udl 8dDw== 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=CkpJndIS961iAMYqy80lEUh7uV3OrKV2zpeEaXIJ8mU=; fh=ip7+QkkM488k9wyzFaZPu3h7BUQARzj44zdeG2KNIXU=; b=lTMtylkPJ2R2P12VKFLAXf4un0PA9Yd0KF+X0h2gEwa51D/ak7NtIGequf8ULEUWNi O5Rz/SkyK7mf1H9D4AUnsiaq6uyUBxfpoFltt1VsA9k00TyPnMuWLXQRpGP/JDA9fe73 h8hYOr+6sEAtDLv89G5Xdi18M6Gl8xaeTlpCtx6FdX0rs6VVlITlth0ATElANoCKiKOW wKkzMGxKkIQbsYk1bRpP2LVrLWIqPvJxCa1HMkD9TYZ2nQ7/gPfZN0qvCHgFGyjHq5OU d6q0El2YvUXsx1g46kE7E9yOAtFHJnuuleyfiXhn0Tjd4PDfWTqXZODpqqs6uC1jd6J2 k6DA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TWJ0H1qj; 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 ea20-20020a05620a489400b0078a5e629b00si2847628qkb.127.2024.03.28.15.50.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 15:50:22 -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=TWJ0H1qj; 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 211A4385C6E8 for ; Thu, 28 Mar 2024 22:50:22 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org 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-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 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+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 Reviewed-by: Thiago Jung Bauermann --- 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. */