From patchwork Tue Apr 16 14:07:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Romero X-Patchwork-Id: 88543 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 78377384641E for ; Tue, 16 Apr 2024 14:09:02 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id BDA933858CDA for ; Tue, 16 Apr 2024 14:07:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BDA933858CDA 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 BDA933858CDA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::436 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713276477; cv=none; b=yEUva6kbmDF73cw/rY46oz+8ecvMLK3HWzpgtAK5mcY1PeWU5v/loxE9RvN6puEV2bTHFX6DiDabm62MuL/o756dXCqi4dV46WsB8zDxfVkWdwrw1dJlWeJQmrLe1hsX1dXuPLfslh6L5vIW2tZtAyVdxxI8ne9VqJIs8P+/SjI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713276477; c=relaxed/simple; bh=WxhGoGvDUNyHMS4tOjdoth41+fxv5hm536NHqm7b6zY=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=TrIhqZ1W4G2wEeqhPrfKXmi0sWedQN1GDJqP2YTN5CGfM3uJlgLy1cTyrY7T4soBZe+Uq4Qmt04yRX7X9Eh3K+sxcS2F8msp4b1/gl3TQS+lgGAWl/+PaOOriD4u2FuPPQgff58ecQb+SJTo+2+ahA0w+17q7lmckbsIwDOFwVM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6ecf3943040so3515803b3a.0 for ; Tue, 16 Apr 2024 07:07:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713276469; x=1713881269; 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=dNFdL19de/q8RksWV8R0X0vx/ia9BRg7pSYUGSwEDMN2b6cnjaIIbq/DOq+736ibvr 3biDpcmSaM9BeQCe/CSlTJ2QebgM1MbjWVoh0X+3n28oyia/PtQFoonYExw6wp5QRU8p rvXiPc+ckyXvSpdG/9jdIjZJQlkEkyvpo3cuidVCqBUc3utsaTfGP5Y+91pTjPyqTO1/ F4CM3GyrQ9XJwX6IB/CMFoS/4KKCoBeuZY7c1PxF63avkBtBRKMoWk3S8s8LVC4iY1wK n4IsMXUi8FbgxuUUAND3hWvxRt9B86069nVSXmYzs7NzSECb4gk3BdnV/UHKSSGLVZBz TAmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713276469; x=1713881269; 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=nQ1XcTUO/2xnpIXSTJvEXzrv70EOjJPnED/CRFkCgmZQA8LXW6b29jbVzfK3gLb+tD sWyW7REmqzK/JIPTtRB6JOJAD/DwdRkPK5L8m8bacDDrxCEggR1BbeF9MFvtaPnCohhi G/8JWluzaASEicTJgOR65x/dVgPD5kvkplcpcX9jratVg30tTik6ohhwWj8bVqwmHoXX fj5yAfkBGjuUOY7EXteMMPA0uxkWOM67HKRaqpJmQbIbE3rTSUl2z4A/S5mJhXlNSOeh eJ0Jsdoz0K8S7iGimukZaVtb5n9pmeLJEnNgQEKYfkth5zcnTbs1nmyYyvO7BQ2uiFAM Oqrw== X-Gm-Message-State: AOJu0Yxf3uZYfaoItmYBZKTkAwjQqmR5j9o8ByQdGJg6XlgVw/vuyTI6 pXan2VAhmKwfKBEcmRe+2eS9sfPjK+l1b3gL7iSBL0nzzqCjzgomTESNdpmHnZjAPJKH7ubQ57B B51I= X-Google-Smtp-Source: AGHT+IFBhYDZN1aLqAHbMaavxFFmTClRHvaDRke67+ZnQ/YNC23VrFXFTkUcBkDsnTeMol0GltrUcA== X-Received: by 2002:a05:6300:630e:b0:1a7:a21b:66f9 with SMTP id jn14-20020a056300630e00b001a7a21b66f9mr10310191pzc.43.1713276469439; Tue, 16 Apr 2024 07:07:49 -0700 (PDT) Received: from amd.. ([2804:7f0:b403:ad57:3e7c:3fff:fe7a:e83b]) by smtp.gmail.com with ESMTPSA id o3-20020a63e343000000b005f3d54c0a57sm8937473pgj.49.2024.04.16.07.07.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 07:07:49 -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 v4 3/8] gdb: aarch64: Remove MTE address checking from memtag_matches_p Date: Tue, 16 Apr 2024 14:07:23 +0000 Message-Id: <20240416140728.198163-4-gustavo.romero@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240416140728.198163-1-gustavo.romero@linaro.org> References: <20240416140728.198163-1-gustavo.romero@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 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+patchwork=sourceware.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. */