From patchwork Thu Apr 4 06:48:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Romero X-Patchwork-Id: 785810 Delivered-To: patch@linaro.org Received: by 2002:adf:f001:0:b0:33e:7753:30bd with SMTP id j1csp684615wro; Wed, 3 Apr 2024 23:49:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUO4bxDjMcU5cjr7gErkpUaVAtoH6FyGNgb99YZhaO8NC+PplScl2joGYYdkTg5NGQFNTtiCYo/uFPjqEULH/36 X-Google-Smtp-Source: AGHT+IG8j0uUSg2Ew9h4xD3MqYZH0oz9Kwc5OHbILQ8/opuQsjuw5rioVRBhEchZdGBIB14h3Ltj X-Received: by 2002:ae9:f442:0:b0:78b:d716:64c0 with SMTP id z2-20020ae9f442000000b0078bd71664c0mr1509778qkl.3.1712213369036; Wed, 03 Apr 2024 23:49:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712213369; cv=pass; d=google.com; s=arc-20160816; b=JOIAob87n8dtuOc0yBYvHmOGJkvBVs9S6m2Z1UdR27VW5Os9rWPxJPQi9IGS2t7Yjx Jab0okp1fsB0I7dDiAWA0jXX1l4a3udTvfSHBSlHNk1+Us3fGj6PUHloQAzvM22vNfgp T7ULAV728uOPZ3inbW18PxHDMdLStMsdCb0iR0Ow06i631nN+1rlCj5RRVQAnv0aRJuW v2uUSphAK1FOPBVvCxlTHU1G+Y6hYtYgHzFD1ghcyBtb22rEhvUSKIQ9KWdBC860pdFC juUz03x19OYzXqCWTQQsNgyvCwh+/BBHWvqvdCts3ry+mizvpGJc0rs1Cenoy/s0oI3N 54aA== 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=0ZcpEQU5SkwkCN6LngWqKW9faLlqWVkF20754f/Vnr7qnaQQzCd75ugpZ7ZjixgVwu rr1QS1lXSVtzZqzfkIqzGvs8QlfSq5JGOnAvxJ6C8jg469bqaFQa+6eaVkbhOZsCKuZm k6jIOCsmj1FUuL8xFzWZ/JF6QM+5KvAj2Nu6GSD18i6ZftgyOJU43hyToSrpwENB4dj/ 9xzI+69h7MwCJ2dm2fZ4cdBgRTHp/L1ar1yw/oQp5dtAHgB8MGFlZT1yzwhN9GXkIYHg U5VBQ5FF8XUYlm8k41C97tYqePpZQ2hIwbxLRKXabou6tzZpdnF0ge3GUQUjjmIHivud fqvA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MIl5LrkE; 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 f26-20020a05620a20da00b0078a025958fdsi15502367qka.275.2024.04.03.23.49.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 23:49:29 -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=MIl5LrkE; 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 A78B93846405 for ; Thu, 4 Apr 2024 06:49:28 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by sourceware.org (Postfix) with ESMTPS id E215F385840A for ; Thu, 4 Apr 2024 06:48:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E215F385840A 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 E215F385840A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::236 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712213333; cv=none; b=q4f3QmK325omzM7ZCA2jtkz6UaD2Bz3/sCYNUl51f86Z/ENH9gDJ+HEmg2YomtE1sH4ewdofnst8tUlF3XG8w+i79wX/50z2LqcaP8xW6amW8PV5GHfOFV5bRHlwiOhxXkg+CCtmv9Gl8HTAobaOXFgS3Cwl3pH+WkEze4EJKjc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712213333; c=relaxed/simple; bh=m0zxqCy8ZHC4pqDMn5zPMAeOHRoB5JgRRsV+IvPQPCM=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=cBdAMT2YC+EPnErO3wfTJVnN2P8YD3PSqESzo8ITc+MUa/cJ8StkUOTggKjXf6Z9bQt6STA2IzNUizdQXlyvZpDTUuYIpXIsp8gmZQNbKuu/fb8nazgMDHCmfaV3L1FyHVaMaZjvZI98qtpqh3OftaioeXUF4k59jhMdlI4I+fU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-3c3e2e18db7so377936b6e.0 for ; Wed, 03 Apr 2024 23:48:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712213330; x=1712818130; 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=MIl5LrkErzFqCMBwR/1Boz/58FrG02lP3qxaJDK0Qmg/d+xFHg8bOGaiHIUwBzR1hp V4o7DpYCgLzIVUTjxO6PNRqj7FhRRdFJw0qOXOfSHiFfkT4DFNNSVzTn8MgPlhxecoch XUhtDuucKOKsXAGPnDYeRdOcqekhQwoh4EQ4d5cz+pEQr625STf+h2ymgNx+Wq9PEq2h J9XcI9uFJ1w7qCT9qp/71wADa4/5jmGosgu4wCTO7G2uQd5DvHw9SBcxZHxj+Di/7O9L lBEta+ogyTaBGbYcJ6dac72w9PmRzfMyr8MFUSAMZQkpy8BGAMawjCMbxycLikFzOMfv spIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712213330; x=1712818130; 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=Xezg1hy8sXaCfePta0Z6foYheuFnTNDb50j2aITKS8BBsH7qWGxVo3BLLbtOYkzFkM JgRtgsuFIYd8ftsGyLfL7uxRbOIYWi89brtsTLAyNiDZj3mgKblEvh8v3Ccmm/dyCJJR CJEVkG/3J2YCdm5aghcC92uylq9DQYzBC+lWnNHGPimYFtOsDyWHSItKBDsx0gZb/iyc J2uglPre/YVt2x72njp5rpPDGOJ7w+wzMo9lc1BV1VuYCdLknxt+xo9Lkgzl67JSw0T/ FoC+j5j9o1WwJNXCccNLSSkMhY/HJTRPdtwqswAFlpa1ptUfnlIMIK53UkkvRJkr5Zm8 ye2w== X-Gm-Message-State: AOJu0YzXluY0zO+xlywmqfhBlatc/OM1+f1ToURbvfwBkdTphoiUIvsM Ypo4tk1CMtpZ7bSzCXNUZlJez0yUbKK9OBzYd6LHHkKC55OPhWAXCAVpo35BAxFrl7aclh/EGU9 v X-Received: by 2002:a05:6808:178d:b0:3c5:d4e0:b295 with SMTP id bg13-20020a056808178d00b003c5d4e0b295mr1684394oib.0.1712213330609; Wed, 03 Apr 2024 23:48:50 -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.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 23:48:49 -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 3/7] gdb: aarch64: Remove MTE address checking from memtag_matches_p Date: Thu, 4 Apr 2024 06:48:15 +0000 Message-Id: <20240404064819.2848899-4-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.3 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 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. */